1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

openvz: Drop useless domain lookup

The lookup is just for check whether a domain we are about to add does
not already exists. Well, the virDomainObjListAdd() function does that
for us already so there's no need to duplicate the check.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-04-25 10:06:29 +02:00
parent 6957a606a5
commit 4803c855bb

View File

@ -1001,14 +1001,6 @@ openvzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
parse_flags)) == NULL)
goto cleanup;
vm = virDomainObjListFindByName(driver->domains, vmdef->name);
if (vm) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("Already an OPENVZ VM active with the id '%s'"),
vmdef->name);
virDomainObjEndAPI(&vm);
goto cleanup;
}
if (!(vm = virDomainObjListAdd(driver->domains, vmdef,
driver->xmlopt,
0, NULL)))
@ -1098,14 +1090,6 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
parse_flags)) == NULL)
goto cleanup;
vm = virDomainObjListFindByName(driver->domains, vmdef->name);
if (vm) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("Already an OPENVZ VM defined with the id '%s'"),
vmdef->name);
virDomainObjEndAPI(&vm);
goto cleanup;
}
if (!(vm = virDomainObjListAdd(driver->domains,
vmdef,
driver->xmlopt,