Change in vdsm[ovirt-3.6]: virt: add logic for POWER cpu xml element

mpolednik at redhat.com mpolednik at redhat.com
Mon Sep 21 09:33:22 UTC 2015


Hello Francesco Romani,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/46451

to review the following change.

Change subject: virt: add logic for POWER cpu xml element
......................................................................

virt: add logic for POWER cpu xml element

Current flow in appendCpu caused ppc to be skipped, generating empty
element (<cpu/>). In order to specify cpu model on ppc, we have to use
libvirt's cpu with POWER8 model.

This is currently the only way of safely adding CPU to ppc64le host,
and hopefully will be enhanced in future.

Change-Id: I9303b76904ef1344508136343104b37c09d2a370
Bug-Url: https://bugzilla.redhat.com/1259318
Signed-off-by: Martin Polednik <mpolednik at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/42736
Continuous-Integration: Jenkins CI
Reviewed-by: Michal Skrivanek <michal.skrivanek at redhat.com>
Reviewed-by: Francesco Romani <fromani at redhat.com>
---
M tests/vmTestsData.py
M vdsm/virt/vmxml.py
2 files changed, 33 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/46451/1

diff --git a/tests/vmTestsData.py b/tests/vmTestsData.py
index a7b610e..00f39e2 100644
--- a/tests/vmTestsData.py
+++ b/tests/vmTestsData.py
@@ -92,7 +92,7 @@
     'displayPort': '-1', 'vmName': 'testVm',
     'display': 'vnc', 'emulatedMachine': 'pc',
     'boot': '', 'timeOffset': 0,
-    'acpiEnable': 'true', 'cpuType': 'qemu64',
+    'acpiEnable': 'true', 'cpuType': 'POWER8',
     'smpCoresPerSocket': 1, 'smpThreadsPerCore': 1,
     'smp': '1', 'cpuPinning': {}, 'numaTune': {}, 'maxVCpus': '160',
     'tabletEnable': False,
@@ -133,6 +133,7 @@
                 </clock>
                 <cputune/>
                 <cpu>
+                    <model>POWER8</model>
                     <topology cores="1" sockets="160" threads="1"/>
                     <numa/>
                 </cpu>
diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py
index 4e27b48..dd93461 100644
--- a/vdsm/virt/vmxml.py
+++ b/vdsm/virt/vmxml.py
@@ -359,6 +359,33 @@
             <feature policy="require" name="sse2"/>
             <feature policy="disable" name="svm"/>
         </cpu>
+
+        For POWER8, there is no point in trying to use baseline CPU for flags
+        since there are only HW features. There are 2 ways of creating a valid
+        POWER8 element that we support:
+
+            <cpu>
+                <model>POWER{X}</model>
+            </cpu>
+
+        This translates to -cpu POWER{X} (where {X} is version of the
+        processor - 7 and 8), which tells qemu to emulate the CPU in POWER8
+        family that it's capable of emulating - in case of hardware
+        virtualization, that will be the host cpu (so an equivalent of
+        -cpu host). Using this option does not limit migration between POWER8
+        machines - it is still possible to migrate from e.g. POWER8 to
+        POWER8e. The second option is not supported and serves only for
+        reference:
+
+            <cpu mode="host-model">
+                <model>power{X}</model>
+            </cpu>
+
+        where {X} is the binary compatibility version of POWER that we
+        require (6, 7, 8). This translates to qemu's -cpu host,compat=power{X}.
+
+        Using the second option also does not limit migration between POWER8
+        machines - it is still possible to migrate from e.g. POWER8 to POWER8e.
         """
 
         cpu = Element('cpu')
@@ -392,6 +419,10 @@
                     elif feature[0] == '-':
                         featureAttrs['policy'] = 'disable'
                     cpu.appendChildWithArgs('feature', **featureAttrs)
+        elif self.arch in caps.Architecture.POWER:
+            features = self.conf.get('cpuType', 'POWER8').split(',')
+            model = features[0]
+            cpu.appendChildWithArgs('model', text=model)
 
         if ('smpCoresPerSocket' in self.conf or
                 'smpThreadsPerCore' in self.conf):


-- 
To view, visit https://gerrit.ovirt.org/46451
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9303b76904ef1344508136343104b37c09d2a370
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list