[PATCH 08/13] conf: Rename max_balloon to total_memory

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

 



The name of the variable was misleading. Rename it and it's setting
accessor before other fixes.
---
 src/conf/domain_conf.c     | 18 +++++++++---------
 src/conf/domain_conf.h     |  7 ++++---
 src/hyperv/hyperv_driver.c |  2 +-
 src/libvirt_private.syms   |  2 +-
 src/libxl/libxl_driver.c   |  4 ++--
 src/lxc/lxc_driver.c       |  2 +-
 src/lxc/lxc_native.c       |  4 ++--
 src/phyp/phyp_driver.c     |  2 +-
 src/qemu/qemu_command.c    |  4 ++--
 src/qemu/qemu_domain.c     |  2 +-
 src/qemu/qemu_driver.c     |  2 +-
 src/test/test_driver.c     |  2 +-
 src/uml/uml_driver.c       |  2 +-
 src/vbox/vbox_common.c     |  4 ++--
 src/vmx/vmx.c              |  2 +-
 src/vz/vz_sdk.c            |  2 +-
 src/xen/xm_internal.c      |  2 +-
 src/xenapi/xenapi_driver.c |  2 +-
 src/xenconfig/xen_common.c |  2 +-
 src/xenconfig/xen_sxpr.c   |  2 +-
 20 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ca60e60..a20ff2c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7706,27 +7706,27 @@ virDomainDefGetMemoryInitial(virDomainDefPtr def)
     if ((ret = virDomainNumaGetMemorySize(def->numa)) > 0) {
         return ret;
     } else {
-        ret = def->mem.max_balloon;
+        ret = def->mem.total_memory;
         for (i = 0; i < def->nmems; i++)
             ret -= def->mems[i]->size;
     }

-    return def->mem.max_balloon;
+    return def->mem.total_memory;
 }


 /**
- * virDomainDefSetMemoryInitial:
+ * virDomainDefSetMemoryTotal:
  * @def: domain definition
  * @size: size to set
  *
- * Sets the initial memory size in @def.
+ * Sets the total memory size in @def.
  */
 void
-virDomainDefSetMemoryInitial(virDomainDefPtr def,
-                             unsigned long long size)
+virDomainDefSetMemoryTotal(virDomainDefPtr def,
+                           unsigned long long size)
 {
-    def->mem.max_balloon = size;
+    def->mem.total_memory = size;
 }


@@ -7748,7 +7748,7 @@ virDomainDefGetMemoryActual(virDomainDefPtr def)
         for (i = 0; i < def->nmems; i++)
             ret += def->mems[i]->size;
     } else {
-        ret = def->mem.max_balloon;
+        ret = def->mem.total_memory;
     }

     return ret;
@@ -14763,7 +14763,7 @@ virDomainDefParseXML(xmlDocPtr xml,

     /* Extract domain memory */
     if (virDomainParseMemory("./memory[1]", NULL, ctxt,
-                             &def->mem.max_balloon, false, true) < 0)
+                             &def->mem.total_memory, false, true) < 0)
         goto error;

     if (virDomainParseMemory("./currentMemory[1]", NULL, ctxt,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a1221ba..74c29bd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2142,8 +2142,9 @@ typedef struct _virDomainMemtune virDomainMemtune;
 typedef virDomainMemtune *virDomainMemtunePtr;

 struct _virDomainMemtune {
-    unsigned long long max_balloon; /* in kibibytes, capped at ulong thanks
-                                       to virDomainGetMaxMemory */
+    /* total memory size including memory modules in kibibytes, this field
+     * should be accessed only via accessors */
+    unsigned long long total_memory;
     unsigned long long cur_balloon; /* in kibibytes, capped at ulong thanks
                                        to virDomainGetInfo */

@@ -2322,7 +2323,7 @@ struct _virDomainDef {
 };

 unsigned long long virDomainDefGetMemoryInitial(virDomainDefPtr def);
-void virDomainDefSetMemoryInitial(virDomainDefPtr def, unsigned long long size);
+void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
 unsigned long long virDomainDefGetMemoryActual(virDomainDefPtr def);
 bool virDomainDefHasMemoryHotplug(const virDomainDef *def);

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index b539541..1958bbe 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -870,7 +870,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     if (VIR_STRDUP(def->description, virtualSystemSettingData->data->Notes) < 0)
         goto cleanup;

-    virDomainDefSetMemoryInitial(def, memorySettingData->data->Limit * 1024); /* megabyte to kilobyte */
+    virDomainDefSetMemoryTotal(def, memorySettingData->data->Limit * 1024); /* megabyte to kilobyte */
     def->mem.cur_balloon = memorySettingData->data->VirtualQuantity * 1024; /* megabyte to kilobyte */

     def->vcpus = processorSettingData->data->VirtualQuantity;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1a92422..d31687d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -227,7 +227,7 @@ virDomainDefParseFile;
 virDomainDefParseNode;
 virDomainDefParseString;
 virDomainDefPostParse;
-virDomainDefSetMemoryInitial;
+virDomainDefSetMemoryTotal;
 virDomainDeleteConfig;
 virDomainDeviceAddressIsValid;
 virDomainDeviceAddressTypeToString;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 019f04f..5048957 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -553,7 +553,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
     vm->def->vcpus = d_info.vcpu_online;
     vm->def->maxvcpus = d_info.vcpu_max_id + 1;
     vm->def->mem.cur_balloon = d_info.current_memkb;
-    virDomainDefSetMemoryInitial(vm->def, d_info.max_memkb);
+    virDomainDefSetMemoryTotal(vm->def, d_info.max_memkb);

     ret = 0;

@@ -1498,7 +1498,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
         if (flags & VIR_DOMAIN_MEM_CONFIG) {
             /* Help clang 2.8 decipher the logic flow.  */
             sa_assert(persistentDef);
-            virDomainDefSetMemoryInitial(persistentDef, newmem);
+            virDomainDefSetMemoryTotal(persistentDef, newmem);
             if (persistentDef->mem.cur_balloon > newmem)
                 persistentDef->mem.cur_balloon = newmem;
             ret = virDomainSaveConfig(cfg->configDir, persistentDef);
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 71be9c7..a9f0005 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -734,7 +734,7 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
         }

         if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
-            virDomainDefSetMemoryInitial(persistentDef, newmem);
+            virDomainDefSetMemoryTotal(persistentDef, newmem);
             if (persistentDef->mem.cur_balloon > newmem)
                 persistentDef->mem.cur_balloon = newmem;
             if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 6faa701..2f95597 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -770,7 +770,7 @@ lxcSetMemTune(virDomainDefPtr def, virConfPtr properties)
         if (lxcConvertSize(value->str, &size) < 0)
             return -1;
         size = size / 1024;
-        virDomainDefSetMemoryInitial(def, size);
+        virDomainDefSetMemoryTotal(def, size);
         def->mem.hard_limit = virMemoryLimitTruncate(size);
     }

@@ -1010,7 +1010,7 @@ lxcParseConfigString(const char *config)
     }

     vmdef->id = -1;
-    virDomainDefSetMemoryInitial(vmdef, 64 * 1024);
+    virDomainDefSetMemoryTotal(vmdef, 64 * 1024);

     vmdef->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
     vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 54dec70..2912fc4 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3281,7 +3281,7 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
         goto err;
     }

-    virDomainDefSetMemoryInitial(&def, memory);
+    virDomainDefSetMemoryTotal(&def, memory);

     if ((def.mem.cur_balloon =
          phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) {
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e1f199c..3044b11 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -13010,7 +13010,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,

     def->id = -1;
     def->mem.cur_balloon = 64 * 1024;
-    virDomainDefSetMemoryInitial(def, def->mem.cur_balloon);
+    virDomainDefSetMemoryTotal(def, def->mem.cur_balloon);
     def->maxvcpus = 1;
     def->vcpus = 1;
     def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
@@ -13216,7 +13216,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
                                _("cannot parse memory level '%s'"), val);
                 goto error;
             }
-            virDomainDefSetMemoryInitial(def, mem * 1024);
+            virDomainDefSetMemoryTotal(def, mem * 1024);
             def->mem.cur_balloon = mem * 1024;
         } else if (STREQ(arg, "-smp")) {
             WANT_VALUE();
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a5e9b75..8f9b40c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3393,7 +3393,7 @@ qemuDomainAlignMemorySizes(virDomainDefPtr def)

     /* align initial memory size */
     mem = virDomainDefGetMemoryInitial(def);
-    virDomainDefSetMemoryInitial(def, VIR_ROUND_UP(mem, align));
+    virDomainDefSetMemoryTotal(def, VIR_ROUND_UP(mem, align));

     def->mem.max_memory = VIR_ROUND_UP(def->mem.max_memory, align);

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3c959f6..2387cf3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2357,7 +2357,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
                 goto endjob;
             }

-            virDomainDefSetMemoryInitial(persistentDef, newmem);
+            virDomainDefSetMemoryTotal(persistentDef, newmem);

             if (persistentDef->mem.cur_balloon > newmem)
                 persistentDef->mem.cur_balloon = newmem;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 213a9a1..18e8c95 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2256,7 +2256,7 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
         return -1;

     /* XXX validate not over host memory wrt to other domains */
-    virDomainDefSetMemoryInitial(privdom->def, memory);
+    virDomainDefSetMemoryTotal(privdom->def, memory);

     virDomainObjEndAPI(&privdom);
     return 0;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index c3c5fa7..2b61f73 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1828,7 +1828,7 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax)
         goto cleanup;
     }

-    virDomainDefSetMemoryInitial(vm->def, newmax);
+    virDomainDefSetMemoryTotal(vm->def, newmax);
     ret = 0;

  cleanup:
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 91a61f8..3e6ed7a 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -3898,7 +3898,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
      * reading and while dumping xml
      */
     /* def->mem.max_balloon = maxMemorySize * 1024; */
-    virDomainDefSetMemoryInitial(def, memorySize * 1024);
+    virDomainDefSetMemoryTotal(def, memorySize * 1024);

     gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
     def->maxvcpus = def->vcpus = CPUCount;
@@ -6051,7 +6051,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
          * the notation here seems to be inconsistent while
          * reading and while dumping xml
          */
-        virDomainDefSetMemoryInitial(def->dom, memorySize * 1024);
+        virDomainDefSetMemoryTotal(def->dom, memorySize * 1024);
         def->dom->os.type = VIR_DOMAIN_OSTYPE_HVM;
         def->dom->os.arch = virArchFromHost();
         gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index c6d97f8..7c3c10a 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1416,7 +1416,7 @@ virVMXParseConfig(virVMXContext *ctx,
         goto cleanup;
     }

-    virDomainDefSetMemoryInitial(def, memsize * 1024); /* Scale from megabytes to kilobytes */
+    virDomainDefSetMemoryTotal(def, memsize * 1024); /* Scale from megabytes to kilobytes */

     /* vmx:sched.mem.max -> def:mem.cur_balloon */
     if (virVMXGetConfigLong(conf, "sched.mem.max", &sched_mem_max, memsize,
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 58c77ab..7a2afd6 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1299,7 +1299,7 @@ prlsdkLoadDomain(vzConnPtr privconn,
     /* get RAM parameters */
     pret = PrlVmCfg_GetRamSize(sdkdom, &ram);
     prlsdkCheckRetGoto(pret, error);
-    virDomainDefSetMemoryInitial(def, ram << 10); /* RAM size obtained in Mbytes,
+    virDomainDefSetMemoryTotal(def, ram << 10); /* RAM size obtained in Mbytes,
                                                      convert to Kbytes */
     def->mem.cur_balloon = ram << 10;

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 07b9eb4..75f98b1 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -605,7 +605,7 @@ xenXMDomainSetMaxMemory(virConnectPtr conn,
     if (entry->def->mem.cur_balloon > memory)
         entry->def->mem.cur_balloon = memory;

-    virDomainDefSetMemoryInitial(entry->def, memory);
+    virDomainDefSetMemoryTotal(entry->def, memory);
     /* If this fails, should we try to undo our changes to the
      * in-memory representation of the config file. I say not!
      */
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 11f6e91..3045c5a 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1492,7 +1492,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
         VIR_FREE(val);
     }
     memory = xenapiDomainGetMaxMemory(dom);
-    virDomainDefSetMemoryInitial(defPtr, memory);
+    virDomainDefSetMemoryTotal(defPtr, memory);
     if (xen_vm_get_memory_dynamic_max(session, &dynamic_mem, vm)) {
         defPtr->mem.cur_balloon = (unsigned long) (dynamic_mem / 1024);
     } else {
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 0dfe60e..0890c73 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -316,7 +316,7 @@ xenParseMem(virConfPtr conf, virDomainDefPtr def)
         return -1;

     def->mem.cur_balloon *= 1024;
-    virDomainDefSetMemoryInitial(def, memory * 1024);
+    virDomainDefSetMemoryTotal(def, memory * 1024);

     return 0;
 }
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index 1d43ec1..033b0eb 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1154,7 +1154,7 @@ xenParseSxpr(const struct sexpr *root,
         }
     }

-    virDomainDefSetMemoryInitial(def, (sexpr_u64(root, "domain/maxmem") << 10));
+    virDomainDefSetMemoryTotal(def, (sexpr_u64(root, "domain/maxmem") << 10));
     def->mem.cur_balloon = (sexpr_u64(root, "domain/memory") << 10);

     if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
-- 
2.4.5

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