Add qemu:override support

This commit is contained in:
SimonFair
2024-04-25 18:53:55 +01:00
parent f79f907923
commit d9588b7c83
2 changed files with 14 additions and 2 deletions
@@ -1801,7 +1801,7 @@
}
function domain_define($xml, $autostart=false) {
if (strpos($xml,'<qemu:commandline>')) {
if (strpos($xml,'<qemu:commandline>') || strpos($xml,'<qemu:override>')) {
$tmp = explode("\n", $xml);
for ($i = 0; $i < sizeof($tmp); $i++)
if (strpos('.'.$tmp[$i], "<domain type='kvm'") || strpos('.'.$tmp[$i], '<domain type="kvm"'))
@@ -1370,7 +1370,7 @@ private static $encoding = 'UTF-8';
'nic' => $arrNICs,
'usb' => $arrUSBDevs,
'shares' => $lv->domain_get_mount_filesystems($res),
'qemucmdline' => getQEMUCmdLine($strDOMXML),
'qemucmdline' => getQEMUCmdLine($strDOMXML)."\n".getQEMUOverride($strDOMXML),
'clocks' => getClocks($strDOMXML)
];
}
@@ -1564,6 +1564,18 @@ private static $encoding = 'UTF-8';
return substr($xml,$x, ($z + 19) -$x) ;
}
function getQEMUOverride($xml) {
$x = strpos($xml,"<qemu:override>", 0) ;
if ($x === false) return null ;
$y = strpos($xml,"</qemu:override>", 0) ;
$z=$y ;
while ($y!=false) {
$y = strpos($xml,"<qemu:override>", $z +16) ;
if ($y != false) $z =$y ;
}
return substr($xml,$x, ($z + 16) -$x) ;
}
function getchannels($res) {
global $lv ;
$xml = $lv->domain_get_xml($res) ;