CPU pinning: preserve "emulatorpin" entry

This commit is contained in:
bergware
2018-09-16 13:28:12 +02:00
parent 29300c2c5b
commit 17dd281b47

View File

@@ -52,6 +52,7 @@ case 'vm':
$xml->cpu->topology['cores'] = $cores;
$xml->cpu->topology['threads'] = $threads;
$xml->vcpu = $vcpus;
$pin = []; foreach ($xml->cputune->emulatorpin->attributes() as $key => $value) $pin[$key] = (string)$value;
unset($xml->cputune);
$xml->addChild('cputune');
for ($i = 0; $i < $vcpus; $i++) {
@@ -59,6 +60,10 @@ case 'vm':
$vcpu['vcpu'] = $i;
$vcpu['cpuset'] = $cpuset[$i];
}
if ($pin) {
$attr = $xml->cputune->addChild('emulatorpin');
foreach ($pin as $key => $value) $attr[$key] = $value;
}
// stop running vm first?
$running = $lv->domain_get_state($dom)=='running';
if ($running) {