Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_driver.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index de06443..a131aa1 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -723,8 +723,7 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned
int flags)
vzConnPtr privconn = conn->privateData;
virDomainPtr retdom = NULL;
virDomainDefPtr def;
- virDomainObjPtr olddom = NULL;
- virDomainObjPtr newdom = NULL;
+ virDomainObjPtr dom = NULL;
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
vzDriverPtr driver = privconn->driver;
@@ -737,8 +736,8 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned
int flags)
parse_flags)) == NULL)
goto cleanup;
- olddom = virDomainObjListFindByUUID(driver->domains, def->uuid);
- if (olddom == NULL) {
+ dom = virDomainObjListFindByUUID(driver->domains, def->uuid);
+ if (dom == NULL) {
virResetLastError();
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
if (prlsdkCreateVm(driver, def))
@@ -753,12 +752,12 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned
int flags)
goto cleanup;
}
- if (!(newdom = prlsdkAddDomainByUUID(driver, def->uuid)))
+ if (!(dom = prlsdkAddDomainByUUID(driver, def->uuid)))
goto cleanup;
} else {
int state, reason;
- state = virDomainObjGetState(olddom, &reason);
+ state = virDomainObjGetState(dom, &reason);
if (state == VIR_DOMAIN_SHUTOFF &&
reason == VIR_DOMAIN_SHUTOFF_SAVED) {
@@ -772,17 +771,17 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned
int flags)
* So forbid this operation, if config is changed. If it's
* not changed - just do nothing. */
- if (!virDomainDefCheckABIStability(olddom->def, def)) {
+ if (!virDomainDefCheckABIStability(dom->def, def)) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("Can't change domain configuration "
"in managed save state"));
goto cleanup;
}
} else {
- if (prlsdkApplyConfig(driver, olddom, def))
+ if (prlsdkApplyConfig(driver, dom, def))
goto cleanup;
- if (prlsdkUpdateDomain(driver, olddom))
+ if (prlsdkUpdateDomain(driver, dom))
goto cleanup;
}
}
@@ -792,10 +791,8 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned
int flags)
retdom->id = def->id;
cleanup:
- if (olddom)
- virObjectUnlock(olddom);
- if (newdom)
- virObjectUnlock(newdom);
+ if (dom)
+ virObjectUnlock(dom);
virDomainDefFree(def);
return retdom;
}
--
1.8.3.1