render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
2daa92
From a9d7a8a2f604f30f4769cdfe62a36aba28ce7368 Mon Sep 17 00:00:00 2001
2daa92
From: Cole Robinson <crobinso@redhat.com>
2daa92
Date: Fri, 16 Aug 2013 20:33:23 -0400
2daa92
Subject: [PATCH] domain_conf: Add default memballon in PostParse callbacks
2daa92
2daa92
This should be a no-op change for now.
2daa92
---
2daa92
 src/qemu/qemu_domain.c | 9 +++++++++
2daa92
 src/xen/xen_driver.c   | 9 +++++++++
2daa92
 2 files changed, 18 insertions(+)
2daa92
2daa92
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
2daa92
index 648121a..dc7ab3e 100644
2daa92
--- a/src/qemu/qemu_domain.c
2daa92
+++ b/src/qemu/qemu_domain.c
2daa92
@@ -755,6 +755,15 @@ qemuDomainDefPostParse(virDomainDefPtr def,
2daa92
             VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0)
2daa92
         return -1;
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_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
2daa92
index 4ae38d3..780230f 100644
2daa92
--- a/src/xen/xen_driver.c
2daa92
+++ b/src/xen/xen_driver.c
2daa92
@@ -330,6 +330,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