Update HyperV Option changes.

This commit is contained in:
SimonFair
2022-10-28 14:07:09 +01:00
parent 4fe93fbefa
commit 6dace82c6c
2 changed files with 3 additions and 2 deletions
@@ -431,7 +431,7 @@
</clock>";
$hyperv = '';
if (!empty($domain['hyperv']) && $os_type == "windows") {
if ($domain['hyperv'] == 1 && $os_type == "windows") {
$hyperv = "<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
@@ -1177,7 +1177,7 @@
foreach ($old['devices']['disk'] as $k => $d) if ($source==$d['source']['@attributes']['file']) $new['devices']['disk'][$key]['driver']['@attributes'] = $d['driver']['@attributes'];
}
// settings not in the GUI, but maybe customized
unset($new['memoryBacking'], $new['clock'], $new['features']);
unset($new['memoryBacking'], $new['clock']); //, $new['features']);
// preserve vnc/spice port settings
// unset($new['devices']['graphics']['@attributes']['port'],$new['devices']['graphics']['@attributes']['autoport']);
if (!$new['devices']['graphics']) unset($old['devices']['graphics']);
@@ -1188,6 +1188,7 @@
if (!$new['devices']['tpm']) unset($old['devices']['tpm']);
// remove existing auto-generated settings
unset($old['cputune']['vcpupin'],$old['devices']['video'],$old['devices']['disk'],$old['devices']['interface'],$old['devices']['filesystem'],$old['cpu']['@attributes'],$old['os']['boot'],$old['os']['loader'],$old['os']['nvram']);
unset($old['features']['hyperv']) ;
// set namespace
$new['metadata']['vmtemplate']['@attributes']['xmlns'] = 'unraid';
}