Add QEMU arg Support

This commit is contained in:
SimonFair
2023-11-04 11:31:46 +00:00
parent 00a0087d2b
commit 9f39b162d0
2 changed files with 29 additions and 2 deletions
@@ -1300,7 +1300,9 @@ private static $encoding = 'UTF-8';
'pci' => $arrOtherDevices,
'nic' => $arrNICs,
'usb' => $arrUSBDevs,
'shares' => $lv->domain_get_mount_filesystems($res)
'shares' => $lv->domain_get_mount_filesystems($res),
'qemucmdline' => getQEMUCmdLine($strDOMXML),
'clocks' => getClocks($strDOMXML)
];
}
@@ -1447,6 +1449,23 @@ private static $encoding = 'UTF-8';
$memorybacking = $memoryBacking->memoryBacking ;
return json_encode($memorybacking); ;
}
function getClocks($xml) {
$clocks = new SimpleXMLElement($xml);
$clocks = $clocks->clock ;
return json_encode($clocks); ;
}
function getQEMUCmdLine($xml) {
$x = strpos($xml,"<qemu:commandline>", 0) ;
if ($x === false) return null ;
$y = strpos($xml,"</qemu:commandline>", 0) ;
$z=$y ;
while ($y!=false) {
$y = strpos($xml,"<qemu:commandline>", $z +19) ;
if ($y != false) $z =$y ;
}
return substr($xml,$x, ($z + 19) -$x) ;
}
function getchannels($res) {
global $lv ;