24-Jun-16 17:32, Nikolay Shirokovskiy пишет:
We need it to prepare the calls for ACL checks otherwise ACL
checking
script will fail.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_driver.c | 85 ++++++++++++++++++++++++++++++++----------------------
1 file changed, 50 insertions(+), 35 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 9c93db1..12abe82 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1850,48 +1850,63 @@ vzConnectUnregisterCloseCallback(virConnectPtr conn,
virConnectCloseFunc cb)
return ret;
}
-static int vzDomainSetMemoryFlagsImpl(virDomainPtr domain, unsigned long memory,
- unsigned int flags, bool useflags)
-{
- virDomainObjPtr dom = NULL;
- int ret = -1;
- bool job = false;
-
- virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
- VIR_DOMAIN_AFFECT_CONFIG, -1);
-
- if (!(dom = vzDomObjFromDomainRef(domain)))
- return -1;
-
- if (useflags && vzCheckConfigUpdateFlags(dom, &flags) < 0)
- goto cleanup;
-
- if (vzDomainObjBeginJob(dom) < 0)
- goto cleanup;
- job = true;
-
- if (!vzDomainObjIsExist(dom))
- goto cleanup;
-
- ret = prlsdkSetMemsize(dom, memory >> 10);
-
- cleanup:
-
- if (job)
- vzDomainObjEndJob(dom);
- virDomainObjEndAPI(&dom);
- return ret;
-}
-
static int vzDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
unsigned int flags)
{
- return vzDomainSetMemoryFlagsImpl(domain, memory, flags, true);
+ virDomainObjPtr dom = NULL;
+ int ret = -1;
+ bool job = false;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+ if (!(dom = vzDomObjFromDomainRef(domain)))
+ return -1;
+
+ if (vzCheckConfigUpdateFlags(dom, &flags) < 0)
+ goto cleanup;
+
+ if (vzDomainObjBeginJob(dom) < 0)
+ goto cleanup;
+ job = true;
+
+ if (!vzDomainObjIsExist(dom))
+ goto cleanup;
+
Now it's vzEnsureDomainExists
+ ret = prlsdkSetMemsize(dom, memory >> 10);
+
+ cleanup:
+
+ if (job)
+ vzDomainObjEndJob(dom);
+ virDomainObjEndAPI(&dom);
+ return ret;
}
static int vzDomainSetMemory(virDomainPtr domain, unsigned long memory)
{
- return vzDomainSetMemoryFlagsImpl(domain, memory, 0, false);
+ virDomainObjPtr dom = NULL;
+ int ret = -1;
+ bool job = false;
+
+ if (!(dom = vzDomObjFromDomainRef(domain)))
+ return -1;
+
+ if (vzDomainObjBeginJob(dom) < 0)
+ goto cleanup;
+ job = true;
+
+ if (!vzDomainObjIsExist(dom))
+ goto cleanup;
+
same
+ ret = prlsdkSetMemsize(dom, memory >> 10);
+
+ cleanup:
+
+ if (job)
+ vzDomainObjEndJob(dom);
+ virDomainObjEndAPI(&dom);
+ return ret;
}
static virDomainSnapshotObjPtr
Otherwise ACK