render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
Daniel P. Berrange 11755d
From 79c38961565eb2d352f101cbd6806314894614cb Mon Sep 17 00:00:00 2001
2daa92
From: Cole Robinson <crobinso@redhat.com>
Daniel P. Berrange 11755d
Date: Fri, 30 Aug 2013 12:41:30 -0400
Daniel P. Berrange 11755d
Subject: [PATCH 2/8] domain_conf: Add default memballoon in PostParse
Daniel P. Berrange 11755d
 callbacks
2daa92
2daa92
This should be a no-op change for now.
2daa92
---
Daniel P. Berrange 11755d
 src/conf/domain_conf.c | 13 -------------
Daniel P. Berrange 11755d
 src/qemu/qemu_domain.c | 10 ++++++++++
Daniel P. Berrange 11755d
 src/xen/xen_driver.c   |  9 +++++++++
Daniel P. Berrange 11755d
 3 files changed, 19 insertions(+), 13 deletions(-)
2daa92
Daniel P. Berrange 11755d
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
Daniel P. Berrange 11755d
index f8fbf79..fafbb89 100644
Daniel P. Berrange 11755d
--- a/src/conf/domain_conf.c
Daniel P. Berrange 11755d
+++ b/src/conf/domain_conf.c
Daniel P. Berrange 11755d
@@ -12184,19 +12184,6 @@ virDomainDefParseXML(xmlDocPtr xml,
Daniel P. Berrange 11755d
 
Daniel P. Berrange 11755d
         def->memballoon = memballoon;
Daniel P. Berrange 11755d
         VIR_FREE(nodes);
Daniel P. Berrange 11755d
-    } else {
Daniel P. Berrange 11755d
-        if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
Daniel P. Berrange 11755d
-            def->virtType == VIR_DOMAIN_VIRT_QEMU ||
Daniel P. Berrange 11755d
-            def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
Daniel P. Berrange 11755d
-            def->virtType == VIR_DOMAIN_VIRT_KVM) {
Daniel P. Berrange 11755d
-            virDomainMemballoonDefPtr memballoon;
Daniel P. Berrange 11755d
-            if (VIR_ALLOC(memballoon) < 0)
Daniel P. Berrange 11755d
-                goto error;
Daniel P. Berrange 11755d
-            memballoon->model = def->virtType == VIR_DOMAIN_VIRT_XEN ?
Daniel P. Berrange 11755d
-                VIR_DOMAIN_MEMBALLOON_MODEL_XEN :
Daniel P. Berrange 11755d
-                VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
Daniel P. Berrange 11755d
-            def->memballoon = memballoon;
Daniel P. Berrange 11755d
-        }
Daniel P. Berrange 11755d
     }
Daniel P. Berrange 11755d
 
Daniel P. Berrange 11755d
     /* Parse the RNG device */
2daa92
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
Daniel P. Berrange 11755d
index 7f4d17d..9260301 100644
2daa92
--- a/src/qemu/qemu_domain.c
2daa92
+++ b/src/qemu/qemu_domain.c
Daniel P. Berrange 11755d
@@ -784,6 +784,16 @@ qemuDomainDefPostParse(virDomainDefPtr def,
2daa92
         return -1;
Daniel P. Berrange 11755d
         }
Daniel P. Berrange 11755d
     }
Daniel P. Berrange 11755d
+
2daa92
+    if (!def->memballoon) {
2daa92
+        virDomainMemballoonDefPtr memballoon;
2daa92
+        if (VIR_ALLOC(memballoon) < 0)
2daa92
+            return -1;
2daa92
+
2daa92
+        memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
2daa92
+        def->memballoon = memballoon;
2daa92
+    }
2daa92
+
2daa92
     return 0;
2daa92
 }
2daa92
 
2daa92
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
Daniel P. Berrange 11755d
index cb64de6..6cb4f4f 100644
2daa92
--- a/src/xen/xen_driver.c
2daa92
+++ b/src/xen/xen_driver.c
Daniel P. Berrange 11755d
@@ -340,6 +340,15 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
2daa92
         STRNEQ(def->os.type, "hvm"))
2daa92
         dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
2daa92
 
2daa92
+    if (!def->memballoon) {
2daa92
+        virDomainMemballoonDefPtr memballoon;
2daa92
+        if (VIR_ALLOC(memballoon) < 0)
2daa92
+            return -1;
2daa92
+
2daa92
+        memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_XEN;
2daa92
+        def->memballoon = memballoon;
2daa92
+    }
2daa92
+
2daa92
     return 0;
2daa92
 }
2daa92
 
Daniel P. Berrange 11755d
-- 
Daniel P. Berrange 11755d
1.8.3.1
Daniel P. Berrange 11755d