]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
openvz: Drop useless domain lookup
authorMichal Privoznik <mprivozn@redhat.com>
Sat, 25 Apr 2015 08:06:29 +0000 (10:06 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 27 Apr 2015 09:26:37 +0000 (11:26 +0200)
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>
src/openvz/openvz_driver.c

index 10d94ff8b6fcd511128d1e7933f83e7b4cbf5b67..d1a327c00a52240ae11ec1fd2f22de8eb6156219 100644 (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,