mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed display "Power Status" for libvirt vm's (#12283)
* Update print-vm.inc.php virsh (libvirtd (libvirt) 4.5.0) displaying status of VMs: ``` shut off running paused ``` * Update libvirt-vminfo.inc.php
This commit is contained in:
@@ -74,6 +74,7 @@ if (Config::get('enable_libvirt') && $device['os'] == 'linux') {
|
||||
// libvirt does not supply this
|
||||
exec(Config::get('virsh') . ' -rc ' . $uri . ' domstate ' . $dom_id, $vm_state);
|
||||
$vmwVmState = ucfirst($vm_state[0]);
|
||||
unset($vm_state);
|
||||
|
||||
$vmwVmCpus = $xml->vcpu['current'];
|
||||
if (! isset($vmwVmCpus)) {
|
||||
|
||||
@@ -11,11 +11,11 @@ if (getidbyname($vm['vmwVmDisplayName'])) {
|
||||
|
||||
echo '</td>';
|
||||
|
||||
if ($vm['vmwVmState'] == 'powered off') {
|
||||
if ($vm['vmwVmState'] == 'powered off' || $vm['vmwVmState'] == 'Shut off') {
|
||||
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-default">OFF</span></td>';
|
||||
} elseif ($vm['vmwVmState'] == 'powered on') {
|
||||
} elseif ($vm['vmwVmState'] == 'powered on' || $vm['vmwVmState'] == 'Running') {
|
||||
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-success">ON</span></td>';
|
||||
} elseif ($vm['vmwVmState'] == 'suspended') {
|
||||
} elseif ($vm['vmwVmState'] == 'suspended' || $vm['vmwVmState'] == 'Paused') {
|
||||
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-warning">SUSPEND</span></td>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user