[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] repeat lookup by name in LookupByID



On Wed, Jul 16, 2008 at 08:10:21PM +0100, Daniel P. Berrange wrote:
> 
> Yes, the documentation is wrong - all inactive VMs have an ID
> of -1, and thus lookup-by-ID is nonsensical for inactive VMs. 
> 
> If any application did make use of this change which falls back to
> lookup-by-name, then it would only ever work with OpenVZ and not
> any of the other libvirt drivers, which isn't useful behaviour.
[...]
> >   Then the virLookupById description must be updated, I'm not against it,
> > but we need to be coherent.
> 
> Indeed, the docs need to be clarified.

  okay, what about
   * Try to find a domain based on the hypervisor ID number
   * Note that this won't work for inactive domains which have an ID of -1,
   * in that case a lookup based on the Name or UUId need to be done instead.

and then revert that specific part of the patch, as attached. Also 
I would make a 'make rebuild' in the doc directory and push the doc update

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libxen/src/libvirt.c,v
retrieving revision 1.148
diff -u -p -p -r1.148 libvirt.c
--- src/libvirt.c	10 Jul 2008 15:29:39 -0000	1.148
+++ src/libvirt.c	16 Jul 2008 19:50:28 -0000
@@ -1253,6 +1253,8 @@ virDomainCreateLinux(virConnectPtr conn,
  * @id: the domain ID number
  *
  * Try to find a domain based on the hypervisor ID number
+ * Note that this won't work for inactive domains which have an ID of -1,
+ * in that case a lookup based on the Name or UUId need to be done instead.
  *
  * Returns a new domain object or NULL in case of failure.  If the
  * domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.
Index: src/openvz_driver.c
===================================================================
RCS file: /data/cvs/libxen/src/openvz_driver.c,v
retrieving revision 1.30
diff -u -p -p -r1.30 openvz_driver.c
--- src/openvz_driver.c	16 Jul 2008 15:27:00 -0000	1.30
+++ src/openvz_driver.c	16 Jul 2008 19:50:28 -0000
@@ -202,15 +202,6 @@ static virDomainPtr openvzDomainLookupBy
 
     vm = openvzFindVMByID(driver, id);
 
-    if (!vm) { /*try to find by name*/
-        char name[OPENVZ_NAME_MAX];
-        if (snprintf(name, OPENVZ_NAME_MAX, "%d",id) >= OPENVZ_NAME_MAX) {
-            openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("Too long domain name"));
-            return NULL;
-        }
-        vm = openvzFindVMByName(driver, name);
-    }
-
     if (!vm) {
         openvzError(conn, VIR_ERR_NO_DOMAIN, NULL);
         return NULL;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]