]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
uml: s/virDomainObjListFindByID/virDomainObjListFindByUUID/
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 24 Apr 2015 07:34:10 +0000 (09:34 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 24 Apr 2015 11:26:09 +0000 (13:26 +0200)
ListFindByID() still requires to step through items in the hash table
(in the worst case scenario through all of them), lock each one and
compare whether we've found what we're looking for. This is suboptimal
as locking a domain object means we need to wait for the current API
running over the object to finish.

Unfortunately, we can't drop the function completely because we have
this public API virDomainLookupByID which we can't drop.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/uml/uml_driver.c

index 60f8eb5c6dcade57bdc977ed9e48fe317bca5cb4..f09e79b1f367cdb390ed0e9645d437fbb5ba13e5 100644 (file)
@@ -1659,7 +1659,7 @@ static int umlDomainShutdownFlags(virDomainPtr dom,
     virCheckFlags(0, -1);
 
     umlDriverLock(driver);
-    vm = virDomainObjListFindByID(driver->domains, dom->id);
+    vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     umlDriverUnlock(driver);
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -1704,7 +1704,7 @@ umlDomainDestroyFlags(virDomainPtr dom,
     virCheckFlags(0, -1);
 
     umlDriverLock(driver);
-    vm = virDomainObjListFindByID(driver->domains, dom->id);
+    vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
                        _("no domain with matching id %d"), dom->id);