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(a)redhat.com>
---
src/uml/uml_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 9cee541..af94f63 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1670,7 +1670,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,
@@ -1715,7 +1715,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);
--
2.0.5