[PATCH 5/9] Use virDomainObjGetDefs in lxcDomainGetMemoryParameters

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

 



Instead of virDomainLiveConfigHelperMethod.
---
 src/lxc/lxc_driver.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index c39b4b4..00b4df2 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -941,9 +941,9 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
 {
     virCapsPtr caps = NULL;
     virDomainDefPtr persistentDef = NULL;
+    virDomainDefPtr def = NULL;
     virDomainObjPtr vm = NULL;
     virLXCDomainObjPrivatePtr priv = NULL;
-    virLXCDriverPtr driver = dom->conn->privateData;
     unsigned long long val;
     int ret = -1;
     size_t i;
@@ -960,13 +960,13 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
 
     priv = vm->privateData;
 
-    if (virDomainGetMemoryParametersEnsureACL(dom->conn, vm->def) < 0 ||
-        !(caps = virLXCDriverGetCapabilities(driver, false)) ||
-        virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
-                                        vm, &flags, &persistentDef) < 0)
+    if (virDomainGetMemoryParametersEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    if (flags & VIR_DOMAIN_AFFECT_LIVE &&
+    if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
+        goto cleanup;
+
+    if (def &&
         !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
         virReportError(VIR_ERR_OPERATION_INVALID,
                        "%s", _("cgroup memory controller is not mounted"));
@@ -986,7 +986,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
 
         switch (i) {
         case 0: /* fill memory hard limit here */
-            if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+            if (persistentDef) {
                 val = persistentDef->mem.hard_limit;
             } else if (virCgroupGetMemoryHardLimit(priv->cgroup, &val) < 0) {
                 goto cleanup;
@@ -996,7 +996,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
                 goto cleanup;
             break;
         case 1: /* fill memory soft limit here */
-            if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+            if (persistentDef) {
                 val = persistentDef->mem.soft_limit;
             } else if (virCgroupGetMemorySoftLimit(priv->cgroup, &val) < 0) {
                 goto cleanup;
@@ -1006,7 +1006,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
                 goto cleanup;
             break;
         case 2: /* fill swap hard limit here */
-            if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+            if (persistentDef) {
                 val = persistentDef->mem.swap_hard_limit;
             } else if (virCgroupGetMemSwapHardLimit(priv->cgroup, &val) < 0) {
                 goto cleanup;
-- 
2.7.3

--
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]