[04/12] domain: Add virDomainDefAddImplicitDevices

Message ID e44416743ce20c8e63d881959660a7ed38b49584.1452224621.git.crobinso@redhat.com
State Superseded
Headers show

Commit Message

Cole Robinson Jan. 8, 2016, 3:49 a.m.
It's just a combination of AddImplicitControllers, and AddConsoleCompat.
Every caller that wants ImplicitControllers also wants the ConsoleCompat
AFAICT, so lump them together. We also need it for future patches.
---
 src/conf/domain_conf.c   | 19 ++++++++++++++-----
 src/conf/domain_conf.h   |  2 +-
 src/libvirt_private.syms |  2 +-
 src/qemu/qemu_command.c  |  2 +-
 src/qemu/qemu_driver.c   |  6 +++---
 src/vmx/vmx.c            |  2 +-
 src/vz/vz_sdk.c          |  2 +-
 7 files changed, 22 insertions(+), 13 deletions(-)

-- 
2.5.0

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

Patch

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5b9dab9..61dc650 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3842,9 +3842,6 @@  virDomainDefPostParseInternal(virDomainDefPtr def,
     if (virDomainDefPostParseMemory(def, parseFlags) < 0)
         return -1;
 
-    if (virDomainDefAddConsoleCompat(def) < 0)
-        return -1;
-
     if (virDomainDefRejectDuplicateControllers(def) < 0)
         return -1;
 
@@ -3854,7 +3851,7 @@  virDomainDefPostParseInternal(virDomainDefPtr def,
     if (virDomainDefPostParseTimer(def) < 0)
         return -1;
 
-    if (virDomainDefAddImplicitControllers(def) < 0)
+    if (virDomainDefAddImplicitDevices(def) < 0)
         return -1;
 
     /* clean up possibly duplicated metadata entries */
@@ -18216,7 +18213,7 @@  virDomainDefMaybeAddSmartcardController(virDomainDefPtr def)
  * in the XML. This is for compat with existing apps which will
  * not know/care about <controller> info in the XML
  */
-int
+static int
 virDomainDefAddImplicitControllers(virDomainDefPtr def)
 {
     if (virDomainDefAddDiskControllersForType(def,
@@ -18251,6 +18248,18 @@  virDomainDefAddImplicitControllers(virDomainDefPtr def)
     return 0;
 }
 
+int
+virDomainDefAddImplicitDevices(virDomainDefPtr def)
+{
+    if (virDomainDefAddConsoleCompat(def) < 0)
+        return -1;
+
+    if (virDomainDefAddImplicitControllers(def) < 0)
+        return -1;
+
+    return 0;
+}
+
 virDomainIOThreadIDDefPtr
 virDomainIOThreadIDFind(virDomainDefPtr def,
                         unsigned int iothread_id)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ae6d546..4a91f24 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2718,7 +2718,7 @@  virDomainObjPtr virDomainObjParseFile(const char *filename,
 bool virDomainDefCheckABIStability(virDomainDefPtr src,
                                    virDomainDefPtr dst);
 
-int virDomainDefAddImplicitControllers(virDomainDefPtr def);
+int virDomainDefAddImplicitDevices(virDomainDefPtr def);
 
 virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(virDomainDefPtr def,
                                                   unsigned int iothread_id);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1e51dcf..0f2f66c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -197,7 +197,7 @@  virDomainControllerRemove;
 virDomainControllerTypeToString;
 virDomainCpuPlacementModeTypeFromString;
 virDomainCpuPlacementModeTypeToString;
-virDomainDefAddImplicitControllers;
+virDomainDefAddImplicitDevices;
 virDomainDefCheckABIStability;
 virDomainDefCheckDuplicateDiskInfo;
 virDomainDefCheckUnsupportedMemoryHotplug;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 66ca111..2ea87cc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -13862,7 +13862,7 @@  qemuParseCommandLine(virCapsPtr qemuCaps,
 
     VIR_FREE(nics);
 
-    if (virDomainDefAddImplicitControllers(def) < 0)
+    if (virDomainDefAddImplicitDevices(def) < 0)
         goto error;
 
     if (virDomainDefPostParse(def, qemuCaps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1161aa0..51c6950 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8074,7 +8074,7 @@  qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
         /* vmdef has the pointer. Generic codes for vmdef will do all jobs */
         dev->data.disk = NULL;
         if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO)
-            if (virDomainDefAddImplicitControllers(vmdef) < 0)
+            if (virDomainDefAddImplicitDevices(vmdef) < 0)
                 return -1;
         if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
             return -1;
@@ -8099,7 +8099,7 @@  qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
         if (virDomainHostdevInsert(vmdef, hostdev))
             return -1;
         dev->data.hostdev = NULL;
-        if (virDomainDefAddImplicitControllers(vmdef) < 0)
+        if (virDomainDefAddImplicitDevices(vmdef) < 0)
             return -1;
         if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
             return -1;
@@ -8141,7 +8141,7 @@  qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
         if (qemuDomainChrInsert(vmdef, dev->data.chr) < 0)
             return -1;
         dev->data.chr = NULL;
-        if (virDomainDefAddImplicitControllers(vmdef) < 0)
+        if (virDomainDefAddImplicitDevices(vmdef) < 0)
             return -1;
         if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
             return -1;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 568b2c7..e641571 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1689,7 +1689,7 @@  virVMXParseConfig(virVMXContext *ctx,
     }
 
     /* def:controllers */
-    if (virDomainDefAddImplicitControllers(def) < 0) {
+    if (virDomainDefAddImplicitDevices(def) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers"));
         goto cleanup;
     }
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index b78c413..f691713 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1350,7 +1350,7 @@  prlsdkLoadDomain(vzConnPtr privconn,
     if (prlsdkGetDomainState(sdkdom, &domainState) < 0)
         goto error;
 
-    if (virDomainDefAddImplicitControllers(def) < 0)
+    if (virDomainDefAddImplicitDevices(def) < 0)
         goto error;
 
     if (def->ngraphics > 0) {