[libvirt PATCH 03/10] virDomainMemballoonDef: Change type of model to virDomainMemballoonModel

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c         | 4 +++-
 src/conf/domain_conf.h         | 2 +-
 src/libxl/libxl_conf.c         | 8 +++-----
 src/qemu/qemu_domain_address.c | 2 +-
 src/qemu/qemu_monitor.c        | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 371a9dead7..5ce7a09848 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13913,6 +13913,7 @@ virDomainMemballoonDefParseXML(virDomainXMLOption *xmlopt,
     g_autofree char *model = NULL;
     g_autofree char *freepage_reporting = NULL;
     g_autofree char *deflate = NULL;
+    int model_value;
 
     def = g_new0(virDomainMemballoonDef, 1);
 
@@ -13923,11 +13924,12 @@ virDomainMemballoonDefParseXML(virDomainXMLOption *xmlopt,
         goto error;
     }
 
-    if ((def->model = virDomainMemballoonModelTypeFromString(model)) < 0) {
+    if ((model_value = virDomainMemballoonModelTypeFromString(model)) < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown memory balloon model '%s'"), model);
         goto error;
     }
+    def->model = model_value;
 
     if ((deflate = virXMLPropString(node, "autodeflate"))) {
         int value;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a694b434c6..d9c0cb21d2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1924,7 +1924,7 @@ typedef enum {
 } virDomainMemballoonModel;
 
 struct _virDomainMemballoonDef {
-    int model;
+    virDomainMemballoonModel model;
     virDomainDeviceInfo info;
     int period; /* seconds between collections */
     virTristateSwitch autodeflate;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 3ccb00ec35..4de2158bea 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -740,9 +740,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
 
     /* only the 'xen' balloon device model is supported */
     if (def->memballoon) {
-        int model = def->memballoon->model;
-
-        switch ((virDomainMemballoonModel)model) {
+        switch (def->memballoon->model) {
         case VIR_DOMAIN_MEMBALLOON_MODEL_XEN:
             break;
         case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
@@ -750,7 +748,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
         case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unsupported balloon device model '%s'"),
-                           virDomainMemballoonModelTypeToString(model));
+                           virDomainMemballoonModelTypeToString(def->memballoon->model));
             return -1;
         case VIR_DOMAIN_MEMBALLOON_MODEL_NONE:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -759,7 +757,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
             return -1;
         case VIR_DOMAIN_MEMBALLOON_MODEL_LAST:
         default:
-            virReportEnumRangeError(virDomainMemballoonModel, model);
+            virReportEnumRangeError(virDomainMemballoonModel, def->memballoon->model);
             return -1;
         }
     }
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index e66efb3d1f..6c789615bd 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -882,7 +882,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
     }
 
     case VIR_DOMAIN_DEVICE_MEMBALLOON:
-        switch ((virDomainMemballoonModel) dev->data.memballoon->model) {
+        switch (dev->data.memballoon->model) {
         case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL:
             /* Transitional devices only work in conventional PCI slots */
             return pciFlags;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 23161a0088..6d72b2aab0 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1030,7 +1030,7 @@ qemuMonitorInitBalloonObjectPath(qemuMonitor *mon,
 
     switch (balloon->info.type) {
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
-        switch ((virDomainMemballoonModel) balloon->model) {
+        switch (balloon->model) {
             case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
                 name = "virtio-balloon-pci";
                 break;
-- 
2.26.3




[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