static int
-hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
- unsigned int flags)
+hypervDomainSetMemoryProperty(virDomainPtr domain, unsigned long memory,
+ const char* propertyName)
{
int result = -1;
char uuid_string[VIR_UUID_STRING_BUFLEN];
Msvm_MemorySettingData *memsd = NULL;
g_autoptr(GHashTable) memResource = NULL;
- virCheckFlags(0, -1);
-
memory_str = g_strdup_printf("%lu", memory_mb);
virUUIDFormat(domain->uuid, uuid_string);
if (!memResource)
goto cleanup;
- if (hypervSetEmbeddedProperty(memResource, "VirtualQuantity", memory_str) < 0)
+ if (hypervSetEmbeddedProperty(memResource, propertyName, memory_str) < 0)
goto cleanup;
if (hypervSetEmbeddedProperty(memResource, "InstanceID", memsd->data->InstanceID) < 0)
}
+static int
+hypervDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
+{
+ return hypervDomainSetMemoryProperty(domain, memory, "Limit");
+}
+
+
+static int
+hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory, unsigned int flags)
+{
+ virCheckFlags(0, -1);
+ return hypervDomainSetMemoryProperty(domain, memory, "VirtualQuantity");
+}
+
+
static int
hypervDomainSetMemory(virDomainPtr domain, unsigned long memory)
{
.domainDestroyFlags = hypervDomainDestroyFlags, /* 0.9.5 */
.domainGetOSType = hypervDomainGetOSType, /* 0.9.5 */
.domainGetMaxMemory = hypervDomainGetMaxMemory, /* 6.10.0 */
+ .domainSetMaxMemory = hypervDomainSetMaxMemory, /* 6.10.0 */
.domainSetMemory = hypervDomainSetMemory, /* 3.6.0 */
.domainSetMemoryFlags = hypervDomainSetMemoryFlags, /* 3.6.0 */
.domainGetInfo = hypervDomainGetInfo, /* 0.9.5 */