[PATCH 5/6] conf: Don't use virDomainLiveConfigHelperMethod in virDomainObjGetMetadata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Few arguments of the function are not necessary any more which leads to
some cleanups. The 'uri' argument had a stray ATTRIBUTE_UNUSED.
---
 src/bhyve/bhyve_driver.c |  9 +--------
 src/conf/domain_conf.c   | 10 ++--------
 src/conf/domain_conf.h   |  2 --
 src/lxc/lxc_driver.c     |  8 +-------
 src/qemu/qemu_driver.c   |  8 +-------
 src/test/test_driver.c   |  4 +---
 6 files changed, 6 insertions(+), 35 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 8036661..e9fd64f 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1131,9 +1131,7 @@ bhyveDomainGetMetadata(virDomainPtr dom,
                       const char *uri,
                       unsigned int flags)
 {
-    bhyveConnPtr privconn = dom->conn->privateData;
     virDomainObjPtr vm;
-    virCapsPtr caps = NULL;
     char *ret = NULL;

     if (!(vm = bhyveDomObjFromDomain(dom)))
@@ -1142,14 +1140,9 @@ bhyveDomainGetMetadata(virDomainPtr dom,
     if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

-    if (!(caps = bhyveDriverGetCapabilities(privconn)))
-        goto cleanup;
-
-    ret = virDomainObjGetMetadata(vm, type, uri, caps,
-                                  privconn->xmlopt, flags);
+    ret = virDomainObjGetMetadata(vm, type, uri, flags);

  cleanup:
-    virObjectUnref(caps);
     virObjectUnlock(vm);
     return ret;
 }
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1ae10ca..bbc9903 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24659,9 +24659,7 @@ virDomainDefFindDevice(virDomainDefPtr def,
 char *
 virDomainObjGetMetadata(virDomainObjPtr vm,
                         int type,
-                        const char *uri ATTRIBUTE_UNUSED,
-                        virCapsPtr caps,
-                        virDomainXMLOptionPtr xmlopt,
+                        const char *uri,
                         unsigned int flags)
 {
     virDomainDefPtr def;
@@ -24676,13 +24674,9 @@ virDomainObjGetMetadata(virDomainObjPtr vm,
         goto cleanup;
     }

-    if (virDomainLiveConfigHelperMethod(caps, xmlopt, vm, &flags, &def) < 0)
+    if (!(def = virDomainObjGetOneDef(vm, flags)))
         goto cleanup;

-    /* use correct domain definition according to flags */
-    if (flags & VIR_DOMAIN_AFFECT_LIVE)
-        def = vm->def;
-
     switch ((virDomainMetadataType) type) {
     case VIR_DOMAIN_METADATA_DESCRIPTION:
         if (VIR_STRDUP(ret, def->description) < 0)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e1990dc..91ebf83 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3044,8 +3044,6 @@ void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);
 char *virDomainObjGetMetadata(virDomainObjPtr vm,
                               int type,
                               const char *uri,
-                              virCapsPtr caps,
-                              virDomainXMLOptionPtr xmlopt,
                               unsigned int flags);

 int virDomainObjSetMetadata(virDomainObjPtr vm,
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 9c3d9f2..46af05d 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -5381,8 +5381,6 @@ lxcDomainGetMetadata(virDomainPtr dom,
                       const char *uri,
                       unsigned int flags)
 {
-    virLXCDriverPtr driver = dom->conn->privateData;
-    virCapsPtr caps = NULL;
     virDomainObjPtr vm;
     char *ret = NULL;

@@ -5392,14 +5390,10 @@ lxcDomainGetMetadata(virDomainPtr dom,
     if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

-    if (!(caps = virLXCDriverGetCapabilities(driver, false)))
-        goto cleanup;
-
-    ret = virDomainObjGetMetadata(vm, type, uri, caps, driver->xmlopt, flags);
+    ret = virDomainObjGetMetadata(vm, type, uri, flags);

  cleanup:
     virDomainObjEndAPI(&vm);
-    virObjectUnref(caps);
     return ret;
 }

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3274f7f..a550e08 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17576,8 +17576,6 @@ qemuDomainGetMetadata(virDomainPtr dom,
                       const char *uri,
                       unsigned int flags)
 {
-    virQEMUDriverPtr driver = dom->conn->privateData;
-    virCapsPtr caps = NULL;
     virDomainObjPtr vm;
     char *ret = NULL;

@@ -17587,14 +17585,10 @@ qemuDomainGetMetadata(virDomainPtr dom,
     if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

-    if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
-        goto cleanup;
-
-    ret = virDomainObjGetMetadata(vm, type, uri, caps, driver->xmlopt, flags);
+    ret = virDomainObjGetMetadata(vm, type, uri, flags);

  cleanup:
     virDomainObjEndAPI(&vm);
-    virObjectUnref(caps);
     return ret;
 }

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index baff085..4ed631b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2659,7 +2659,6 @@ static char *testDomainGetMetadata(virDomainPtr dom,
                                    const char *uri,
                                    unsigned int flags)
 {
-    testDriverPtr privconn = dom->conn->privateData;
     virDomainObjPtr privdom;
     char *ret;

@@ -2669,8 +2668,7 @@ static char *testDomainGetMetadata(virDomainPtr dom,
     if (!(privdom = testDomObjFromDomain(dom)))
         return NULL;

-    ret = virDomainObjGetMetadata(privdom, type, uri, privconn->caps,
-                                  privconn->xmlopt, flags);
+    ret = virDomainObjGetMetadata(privdom, type, uri, flags);

     virDomainObjEndAPI(&privdom);
     return ret;
-- 
2.9.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]