Libvirt virtual machine power status

hello

i am trying to use the libvirt module, i have it up and running so far,
some hints for users also trying to use it: enabling the module at the “device” level is not enough,
you have to set

$config['enable_libvirt'] = 1;
$config['libvirt_username'] = 'sshuser'; 

in your defaults.inc.php

sshuser is the user at the hypervisor who is allowed logging in with a key.

i have one problem:

on the (Devices -> All Devices -> Servers ->ServerX -> Virtual Machines i can see the virtual machine powerstatus,

on the tab “Devices -> Virtual Machines” i can see the VM, on which host, CPU and memory, but the power status is just missing.

any ideas?

regards
M.

Hello!

This is my solution: with VMWARE it is “powered on” not “Running”.

 --- html/pages/vminfo.inc.php.orig	2018-10-18 12:58:32.233632520 +0200
+++ html/pages/vminfo.inc.php	2018-10-18 13:05:01.600207585 +0200
@@ -65,9 +65,9 @@
             }
         },
         "powerstatus": function(column, row) {
-            if (row.powerstat == "powered on") {
+            if ((row.powerstat == "powered on") || (row.powerstat == "Running")) {
                 var response =  '<span class="label label-success">ON</span>';
-            } else if (row.powerstat == "powered off") {
+            } else if ((row.powerstat == "powered off") || (row.powerstat == "shut off")) {
                 var response =  '<span class="label label-default">OFF</span>';
             }
             return response;

Regards

M.

Please, submit a PR :wink: