[Libvir] Can't connect to lxc driver

Hi Dan, I updated today to the latest CVS and can no longer connect to the lxc driver. I've tracked it down to this check in doRemoteOpen() in remote_internal.c: if (( #ifdef HAVE_XMLURI_QUERY_RAW uri->query_raw = #else uri->query = #endif qparam_get_query (vars)) == NULL) goto failed; Looking at the recent VirBuffer changes, it looks like they changed the behavior of qparam_get_query. With the old VirBuffer, qparam_get_query returned a non-NULL result because virBufferNew allocated space. The new VirBuffer doesn't allocate space until something is added and hence this function returns NULL if nothing is ever put in the buffer. I'm not familiar enough with the intended behavior to know what the fix should be here. Thanks! -- Best Regards, Dave Leskovec IBM Linux Technology Center Open Virtualization

On Wed, Apr 30, 2008 at 05:22:22PM -0700, Dave Leskovec wrote:
Hi Dan,
I updated today to the latest CVS and can no longer connect to the lxc driver. I've tracked it down to this check in doRemoteOpen() in remote_internal.c:
if (( #ifdef HAVE_XMLURI_QUERY_RAW uri->query_raw = #else uri->query = #endif qparam_get_query (vars)) == NULL) goto failed;
Looking at the recent VirBuffer changes, it looks like they changed the behavior of qparam_get_query. With the old VirBuffer, qparam_get_query returned a non-NULL result because virBufferNew allocated space. The new VirBuffer doesn't allocate space until something is added and hence this function returns NULL if nothing is ever put in the buffer. I'm not familiar enough with the intended behavior to know what the fix should be here.
So two things - with the old code it was impossible for qparam_get_query to return NULL, so the NULL check was redundant. Aside from that, it looks like it is valid for uri->query to be set to NULL anway to indicate that no variables are set. So I'd suggest you try just removing the NULL check & goto failed. If that doesn't work, then modify get_query to return "", if the buffer is NULL. Regards, Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Thanks! Removing the if == NULL goto fail works. Patch is attached. Daniel P. Berrange wrote:
On Wed, Apr 30, 2008 at 05:22:22PM -0700, Dave Leskovec wrote:
Hi Dan,
I updated today to the latest CVS and can no longer connect to the lxc driver. I've tracked it down to this check in doRemoteOpen() in remote_internal.c:
if (( #ifdef HAVE_XMLURI_QUERY_RAW uri->query_raw = #else uri->query = #endif qparam_get_query (vars)) == NULL) goto failed;
Looking at the recent VirBuffer changes, it looks like they changed the behavior of qparam_get_query. With the old VirBuffer, qparam_get_query returned a non-NULL result because virBufferNew allocated space. The new VirBuffer doesn't allocate space until something is added and hence this function returns NULL if nothing is ever put in the buffer. I'm not familiar enough with the intended behavior to know what the fix should be here.
So two things - with the old code it was impossible for qparam_get_query to return NULL, so the NULL check was redundant. Aside from that, it looks like it is valid for uri->query to be set to NULL anway to indicate that no variables are set. So I'd suggest you try just removing the NULL check & goto failed. If that doesn't work, then modify get_query to return "", if the buffer is NULL.
Regards, Dan.
-- Best Regards, Dave Leskovec IBM Linux Technology Center Open Virtualization

On Wed, Apr 30, 2008 at 11:13:18PM -0700, Dave Leskovec wrote:
Thanks! Removing the if == NULL goto fail works. Patch is attached.
Ok. comitted this. Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Dave Leskovec