[libvirt PATCH 05/10] virDomainDefFormatFeatures: Write attribute "mode" of element "hyperv"

Tim Wiederhake twiederh at redhat.com
Fri Nov 26 14:34:57 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/domain_conf.c                            | 5 +++--
 tests/qemuxml2xmloutdata/hyperv-off.xml           | 2 +-
 tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml | 2 +-
 tests/qemuxml2xmloutdata/hyperv.xml               | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0ea00955c5..7d1edf14c3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27785,10 +27785,11 @@ virDomainDefFormatFeatures(virBuffer *buf,
             break;
 
         case VIR_DOMAIN_FEATURE_HYPERV:
-            if (def->features[i] != VIR_TRISTATE_SWITCH_ON)
+            if (def->features[i] == VIR_DOMAIN_HYPERV_MODE_NONE)
                 break;
 
-            virBufferAddLit(&childBuf, "<hyperv>\n");
+            virBufferAsprintf(&childBuf, "<hyperv mode='%s'>\n",
+                              virDomainHyperVModeTypeToString(def->features[i]));
             virBufferAdjustIndent(&childBuf, 2);
             for (j = 0; j < VIR_DOMAIN_HYPERV_LAST; j++) {
                 if (def->hyperv_features[j] == VIR_TRISTATE_SWITCH_ABSENT)
diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml
index 20c7f653af..94288e2516 100644
--- a/tests/qemuxml2xmloutdata/hyperv-off.xml
+++ b/tests/qemuxml2xmloutdata/hyperv-off.xml
@@ -10,7 +10,7 @@
   </os>
   <features>
     <acpi/>
-    <hyperv>
+    <hyperv mode='custom'>
       <relaxed state='off'/>
       <vapic state='off'/>
       <spinlocks state='off'/>
diff --git a/tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml b/tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml
index d49eb75b12..3710191d75 100644
--- a/tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml
+++ b/tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml
@@ -10,7 +10,7 @@
   </os>
   <features>
     <acpi/>
-    <hyperv>
+    <hyperv mode='custom'>
       <vpindex state='on'/>
       <synic state='on'/>
       <stimer state='on'>
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml
index 00af005671..87f09257c7 100644
--- a/tests/qemuxml2xmloutdata/hyperv.xml
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
@@ -10,7 +10,7 @@
   </os>
   <features>
     <acpi/>
-    <hyperv>
+    <hyperv mode='custom'>
       <relaxed state='on'/>
       <vapic state='on'/>
       <spinlocks state='on' retries='12287'/>
-- 
2.31.1




More information about the libvir-list mailing list