[libvirt] [PATCH] 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> --- src/openvz/openvz_driver.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 10d94ff..d1a327c 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -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, -- 2.0.5

On Mon, Apr 27, 2015 at 11:26:23AM +0200, Michal Privoznik wrote:
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 | 16 ---------------- 1 file changed, 16 deletions(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Mon, Apr 27, 2015 at 11:26:23AM +0200, Michal Privoznik wrote:
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 | 16 ---------------- 1 file changed, 16 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 10d94ff..d1a327c 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -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,
ACK. -- Guido
participants (3)
-
Daniel P. Berrange
-
Guido Günther
-
Michal Privoznik