[libvirt] [PATCHv2 17/21] conf: Add argument to support use of the driver adjust callbacks

Peter Krempa pkrempa at redhat.com
Wed Mar 6 15:38:01 UTC 2013


This patch adds a argument to the virDomainXMLConfNew constructor to
pass the driver adjust callback pointers and fixes the fallout of this
change.
---
 src/conf/domain_conf.c           | 4 ++++
 src/conf/domain_conf.h           | 1 +
 src/esx/esx_driver.c             | 2 +-
 src/lxc/lxc_conf.c               | 2 +-
 src/openvz/openvz_conf.c         | 2 +-
 src/parallels/parallels_driver.c | 2 +-
 src/qemu/qemu_conf.c             | 1 +
 src/test/test_driver.c           | 2 +-
 src/uml/uml_driver.c             | 3 +--
 src/vbox/vbox_tmpl.c             | 2 +-
 src/vmware/vmware_driver.c       | 2 +-
 src/xen/xen_driver.c             | 2 +-
 tests/testutilslxc.c             | 2 +-
 tests/testutilsxen.c             | 2 +-
 tests/xml2vmxtest.c              | 2 +-
 15 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2bafdd2..0432483 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -777,6 +777,7 @@ VIR_ONCE_GLOBAL_INIT(virDomainXMLConf)
  */
 virDomainXMLConfPtr
 virDomainXMLConfNew(virDomainXMLPrivateDataCallbacksPtr priv,
+                    virDomainDefAdjustCallbacksPtr adjust,
                     virDomainXMLNamespacePtr xmlns)
 {
     virDomainXMLConfPtr xmlconf;
@@ -794,6 +795,9 @@ virDomainXMLConfNew(virDomainXMLPrivateDataCallbacksPtr priv,
         xmlconf->privateDataXMLParse = priv->parse;
     }

+    if (adjust)
+        xmlconf->adjust = *adjust;
+
     if (xmlns)
         xmlconf->ns = *xmlns;

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8dbad80..97cf4e2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1962,6 +1962,7 @@ struct _virDomainXMLPrivateDataCallbacks {

 virDomainXMLConfPtr
 virDomainXMLConfNew(virDomainXMLPrivateDataCallbacksPtr priv,
+                    virDomainDefAdjustCallbacksPtr adjust,
                     virDomainXMLNamespacePtr xmlns);

 virDomainXMLNamespace
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index fc8a3ae..2bff60e 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1100,7 +1100,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
         goto cleanup;
     }

-    if (!(priv->xmlconf = virDomainXMLConfNew(NULL, NULL)))
+    if (!(priv->xmlconf = virDomainXMLConfNew(NULL, NULL, NULL)))
         goto cleanup;

     conn->privateData = priv;
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index c723e77..4e2306d 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -159,7 +159,7 @@ error:
 virDomainXMLConfPtr
 lxcDomainXMLConfInit(void)
 {
-    return virDomainXMLConfNew(&virLXCDriverPrivateDataCallbacks, NULL);
+    return virDomainXMLConfNew(&virLXCDriverPrivateDataCallbacks, NULL, NULL);
 }

 int lxcLoadDriverConfig(virLXCDriverPtr driver)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 63663ab..4e8a7cd 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -178,7 +178,7 @@ static int openvzDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
 virDomainXMLConfPtr
 openvzDomainXMLConfInit(void)
 {
-    return virDomainXMLConfNew(NULL, NULL);
+    return virDomainXMLConfNew(NULL, NULL, NULL);
 }


diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 88f41f7..ffb86dc 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -929,7 +929,7 @@ parallelsOpenDefault(virConnectPtr conn)
     if (!(privconn->caps = parallelsBuildCapabilities()))
         goto error;

-    if (!(privconn->xmlconf = virDomainXMLConfNew(NULL, NULL)))
+    if (!(privconn->xmlconf = virDomainXMLConfNew(NULL, NULL, NULL)))
         goto error;

     if (!(privconn->domains = virDomainObjListNew()))
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 1beff6d..ef592cd 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -555,6 +555,7 @@ virDomainXMLConfPtr
 virQEMUDriverCreateXMLConf(void)
 {
     return virDomainXMLConfNew(&virQEMUDriverPrivateDataCallbacks,
+                               NULL,
                                &virQEMUDriverDomainXMLNamespace);
 }

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index f61cf90..5cb36d9 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -162,7 +162,7 @@ testBuildXMLConfig(void)
 {
     virDomainXMLPrivateDataCallbacks priv = { .alloc = testDomainObjPrivateAlloc,
                                               .free = testDomainObjPrivateFree };
-    return virDomainXMLConfNew(&priv, NULL);
+    return virDomainXMLConfNew(&priv, NULL, NULL);
 }


diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 595410b..8ac2ce7 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -505,8 +505,7 @@ umlStartup(bool privileged,
     if ((uml_driver->caps = umlCapsInit()) == NULL)
         goto out_of_memory;

-    if (!(uml_driver->xmlconf = virDomainXMLConfNew(&privcb,
-                                                    NULL)))
+    if (!(uml_driver->xmlconf = virDomainXMLConfNew(&privcb, NULL, NULL)))
         goto error;

    if ((uml_driver->inotifyFD = inotify_init()) < 0) {
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 7a47067..dd96e7b 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -854,7 +854,7 @@ static int vboxDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
 static virDomainXMLConfPtr
 vboxXMLConfInit(void)
 {
-    return virDomainXMLConfNew(NULL, NULL);
+    return virDomainXMLConfNew(NULL, NULL, NULL);
 }


diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 6d82532..c927b18 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -78,7 +78,7 @@ vmwareDomainXMLConfigInit(void)
     virDomainXMLPrivateDataCallbacks priv = { .alloc = vmwareDataAllocFunc,
                                               .free = vmwareDataFreeFunc };

-    return virDomainXMLConfNew(&priv, NULL);
+    return virDomainXMLConfNew(&priv, NULL, NULL);
 }

 static virDrvOpenStatus
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index fd20b73..2ef3609 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -401,7 +401,7 @@ xenUnifiedOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
         goto fail;
     }

-    if (!(priv->xmlconf = virDomainXMLConfNew(NULL, NULL)))
+    if (!(priv->xmlconf = virDomainXMLConfNew(NULL, NULL, NULL)))
         goto fail;

 #if WITH_XEN_INOTIFY
diff --git a/tests/testutilslxc.c b/tests/testutilslxc.c
index ea003c6..129db5c 100644
--- a/tests/testutilslxc.c
+++ b/tests/testutilslxc.c
@@ -18,7 +18,7 @@ static int testLXCDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
 virDomainXMLConfPtr
 testLXCXMLConfInit(void)
 {
-    return virDomainXMLConfNew(NULL, NULL);
+    return virDomainXMLConfNew(NULL, NULL, NULL);
 }


diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index 201ea2a..479eec3 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -18,7 +18,7 @@ static int testXenDefaultConsoleType(const char *ostype,
 virDomainXMLConfPtr
 testXenXMLConfInit(void)
 {
-    return virDomainXMLConfNew(NULL, NULL);
+    return virDomainXMLConfNew(NULL, NULL, NULL);
 }

 virCapsPtr testXenCapsInit(void) {
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 800fd2c..c606036 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -240,7 +240,7 @@ mymain(void)
         return EXIT_FAILURE;
     }

-    if (!(xmlconf = virDomainXMLConfNew(NULL, NULL)))
+    if (!(xmlconf = virDomainXMLConfNew(NULL, NULL, NULL)))
         return EXIT_FAILURE;

     ctx.opaque = NULL;
-- 
1.8.1.1




More information about the libvir-list mailing list