[RFC PATCH 1/6] conf: Reintroduce virDomainDef::hpt_resizing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We're going to introduce a second HPT-related setting soon,
at which point using a single location to store everything is
no longer going to cut it.

This mostly, but not completely, reverts 3dd1eb3b2650.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/conf/domain_conf.c  | 21 ++++++++++++++-------
 src/conf/domain_conf.h  |  1 +
 src/qemu/qemu_command.c |  7 ++++---
 src/qemu/qemu_domain.c  |  2 +-
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2253098090..355e497002 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19489,9 +19489,12 @@ virDomainDefParseXML(xmlDocPtr xml,
                                    tmp);
                     goto error;
                 }
-                def->features[val] = value;
+                def->hpt_resizing = (virDomainHPTResizing) value;
                 VIR_FREE(tmp);
             }
+
+            if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE)
+                def->features[val] = VIR_TRISTATE_SWITCH_ON;
             break;
 
         /* coverity[dead_error_begin] */
@@ -21621,13 +21624,16 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
             break;
 
         case VIR_DOMAIN_FEATURE_HPT:
-            if (src->features[i] != dst->features[i]) {
+            if (src->features[i] != dst->features[i] ||
+                src->hpt_resizing != dst->hpt_resizing) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("State of feature '%s' differs: "
-                                 "source: '%s=%s', destination: '%s=%s'"),
+                                 "source: '%s,%s=%s', destination: '%s,%s=%s'"),
                                featureName,
-                               "resizing", virDomainHPTResizingTypeToString(src->features[i]),
-                               "resizing", virDomainHPTResizingTypeToString(dst->features[i]));
+                               virTristateSwitchTypeToString(src->features[i]),
+                               "resizing", virDomainHPTResizingTypeToString(src->hpt_resizing),
+                               virTristateSwitchTypeToString(dst->features[i]),
+                               "resizing", virDomainHPTResizingTypeToString(dst->hpt_resizing));
                 return false;
             }
             break;
@@ -27202,11 +27208,12 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                 break;
 
             case VIR_DOMAIN_FEATURE_HPT:
-                if (def->features[i] == VIR_DOMAIN_HPT_RESIZING_NONE)
+                if (def->features[i] != VIR_TRISTATE_SWITCH_ON ||
+                    def->hpt_resizing == VIR_DOMAIN_HPT_RESIZING_NONE)
                     break;
 
                 virBufferAsprintf(buf, "<hpt resizing='%s'/>\n",
-                                  virDomainHPTResizingTypeToString(def->features[i]));
+                                  virDomainHPTResizingTypeToString(def->hpt_resizing));
                 break;
 
             /* coverity[dead_error_begin] */
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 37356df42d..cb0945b6c0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2376,6 +2376,7 @@ struct _virDomainDef {
     int kvm_features[VIR_DOMAIN_KVM_LAST];
     unsigned int hyperv_spinlocks;
     virGICVersion gic_version;
+    virDomainHPTResizing hpt_resizing;
     char *hyperv_vendor_id;
     int apic_eoi;
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index cb397c7558..ddbde54a8c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7172,17 +7172,18 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
         }
     }
 
-    if (def->features[VIR_DOMAIN_FEATURE_HPT] != VIR_DOMAIN_HPT_RESIZING_NONE) {
+    if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) {
         const char *str;
 
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT)) {
+        if (def->hpt_resizing != VIR_DOMAIN_HPT_RESIZING_NONE &&
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("HTP resizing is not supported by this "
                              "QEMU binary"));
             goto cleanup;
         }
 
-        str = virDomainHPTResizingTypeToString(def->features[VIR_DOMAIN_FEATURE_HPT]);
+        str = virDomainHPTResizingTypeToString(def->hpt_resizing);
         if (!str) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Invalid setting for HPT resizing"));
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ee676a2789..4bf57b74b6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3623,7 +3623,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def)
             break;
 
         case VIR_DOMAIN_FEATURE_HPT:
-            if (def->features[i] != VIR_DOMAIN_HPT_RESIZING_NONE &&
+            if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
                 !qemuDomainIsPSeries(def)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("The '%s' feature is not supported for "
-- 
2.17.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux