05.11.2015 13:13, Nikolay Shirokovskiy пишет:
Implement functions for vz containers only. vz VMs memory
managment thru libvirt yet to be designed.
[snip]
static virHypervisorDriver vzDriver = {
.name = "vz",
.connectOpen = vzConnectOpen, /* 0.10.0 */
@@ -1499,6 +1577,9 @@ static virHypervisorDriver vzDriver = {
.domainBlockStatsFlags = vzDomainBlockStatsFlags, /* 1.2.17 */
.domainInterfaceStats = vzDomainInterfaceStats, /* 1.2.17 */
.domainMemoryStats = vzDomainMemoryStats, /* 1.2.17 */
+ .domainSetMemoryFlags = vzDomainSetMemoryFlags, /* 1.2.21 */
+ .domainSetMemory = vzDomainSetMemory, /* 1.2.21 */
+ .domainSetMaxMemory = vzDomainSetMaxMemory, /* 1.2.21 */
1.2.21 is out. There should be 1.2.22. Otherwise ACK.
};
static virConnectDriver vzConnectDriver = {
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 89c9e89..2d0f688 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -4036,3 +4036,26 @@ prlsdkGetMemoryStats(virDomainObjPtr dom,
return ret;
}
+
+int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize)
+{
+ int ret = -1;
+ vzDomObjPtr privdom = dom->privateData;
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
+ PRL_RESULT pret;
+
+ job = PrlVm_BeginEdit(privdom->sdkdom);
+ if (PRL_FAILED(waitJob(job)))
+ goto out;
+
+ pret = PrlVmCfg_SetRamSize(privdom->sdkdom, memsize);
+ prlsdkCheckRetGoto(pret, out);
+
+ job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
+ if (PRL_FAILED(waitJob(job)))
+ goto out;
+
+ ret = 0;
+ out:
+ return ret;
+}
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index ebe4591..88fef4a 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -76,3 +76,4 @@ int
prlsdkGetVcpuStats(virDomainObjPtr dom, int idx, unsigned long long *time);
int
prlsdkGetMemoryStats(virDomainObjPtr dom, virDomainMemoryStatPtr stats, unsigned int
nr_stats);
+int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);