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

Peter Krempa pkrempa at redhat.com
Mon Mar 11 15:06:32 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/libxl/libxl_driver.c         | 2 +-
 src/lxc/lxc_conf.c               | 2 +-
 src/openvz/openvz_conf.c         | 1 +
 src/openvz/openvz_driver.c       | 2 +-
 src/parallels/parallels_driver.c | 2 +-
 src/phyp/phyp_driver.c           | 2 +-
 src/qemu/qemu_conf.c             | 1 +
 src/security/virt-aa-helper.c    | 2 +-
 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 +-
 src/xenapi/xenapi_driver.c       | 2 +-
 tests/testutilsxen.c             | 2 +-
 tests/xml2vmxtest.c              | 2 +-
 19 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 39c1eed..ce65eac 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -781,6 +781,7 @@ VIR_ONCE_GLOBAL_INIT(virDomainXMLConf)
  */
 virDomainXMLConfPtr
 virDomainXMLConfNew(virDomainXMLPrivateDataCallbacksPtr priv,
+                    virDomainDefAdjustCallbacksPtr adjust,
                     virDomainXMLNamespacePtr xmlns)
 {
     virDomainXMLConfPtr xmlconf;
@@ -794,6 +795,9 @@ virDomainXMLConfNew(virDomainXMLPrivateDataCallbacksPtr priv,
     if (priv)
         xmlconf->privateData = *priv;

+    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 b9bfd31..ab66707 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1967,6 +1967,7 @@ struct _virDomainXMLPrivateDataCallbacks {

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

 virDomainXMLNamespacePtr
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/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index af1f9a9..090938c 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1240,7 +1240,7 @@ libxlStartup(bool privileged,
     }

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

     /* Load running domains first. */
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 f175655..e3e64e5 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -174,6 +174,7 @@ static int openvzDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
     return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ;
 }

+
 virCapsPtr openvzCapsInit(void)
 {
     virCapsPtr caps;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index d537185..a6f4c66 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1453,7 +1453,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
     if (!(driver->caps = openvzCapsInit()))
         goto cleanup;

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

     if (openvzLoadDomains(driver) < 0)
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/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index c35417b..6063256 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1204,7 +1204,7 @@ phypOpen(virConnectPtr conn,
         goto failure;
     }

-    if (!(phyp_driver->xmlconf = virDomainXMLConfNew(NULL, NULL)))
+    if (!(phyp_driver->xmlconf = virDomainXMLConfNew(NULL, NULL, NULL)))
         goto failure;

     conn->privateData = phyp_driver;
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/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index c1a3ec9..866eac3 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -711,7 +711,7 @@ get_definition(vahControl * ctl, const char *xmlStr)
         goto exit;
     }

-    if (!(ctl->xmlconf = virDomainXMLConfNew(NULL, NULL))) {
+    if (!(ctl->xmlconf = virDomainXMLConfNew(NULL, NULL, NULL))) {
         vah_error(ctl, 0, _("Failed to create XML config object"));
         goto exit;
     }
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c5fffb9..31ac116 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 3a8a98a..a6833fa 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/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index b368f48..941f3bd 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -169,7 +169,7 @@ xenapiOpen(virConnectPtr conn, virConnectAuthPtr auth,
         goto error;
     }

-    if (!(privP->xmlconf = virDomainXMLConfNew(NULL, NULL))) {
+    if (!(privP->xmlconf = virDomainXMLConfNew(NULL, NULL, NULL))) {
         xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
                                   _("Failed to create XML conf object"));
         goto error;
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.5




More information about the libvir-list mailing list