[libvirt] [PATCH] xen: fix domain lookup after define

Defining a xen domain will succeed, but report error because we weren't properly passing the domain's name to the post-define lookup. Attached patch fixes this, and also adds a debug statement to show the sexpr we create from the passed xml. Thanks, Cole diff --git a/src/xend_internal.c b/src/xend_internal.c index 2a687c3..124ee8b 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -4270,7 +4270,6 @@ xenDaemonDomainMigratePerform (virDomainPtr domain, virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) { int ret; char *sexpr; - char *name = NULL; virDomainPtr dom; xenUnifiedPrivatePtr priv; virDomainDefPtr def; @@ -4292,15 +4291,17 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) { goto error; } + DEBUG("Defining w/ sexpr: \n%s", sexpr); + ret = xend_op(conn, "", "op", "new", "config", sexpr, NULL); VIR_FREE(sexpr); if (ret != 0) { virXendError(conn, VIR_ERR_XEN_CALL, - _("Failed to create inactive domain %s\n"), name); + _("Failed to create inactive domain %s\n"), def->name); goto error; } - dom = virDomainLookupByName(conn, name); + dom = virDomainLookupByName(conn, def->name); if (dom == NULL) { goto error; }

On Wed, Aug 27, 2008 at 08:57:24PM -0400, Cole Robinson wrote:
Defining a xen domain will succeed, but report error because we weren't properly passing the domain's name to the post-define lookup.
ACK, this was a mistake during the conversion to new APIs
Attached patch fixes this, and also adds a debug statement to show the sexpr we create from the passed xml.
Good idea - there's been a number of BZ tickets where it would have been useful to ask the user to get this with LIBVIRT_DEBUG=1
Daniel -- |: Red Hat, Engineering, London -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 :|

On Thu, Aug 28, 2008 at 10:19:01AM +0100, Daniel P. Berrange wrote:
On Wed, Aug 27, 2008 at 08:57:24PM -0400, Cole Robinson wrote:
Defining a xen domain will succeed, but report error because we weren't properly passing the domain's name to the post-define lookup.
ACK, this was a mistake during the conversion to new APIs
Attached patch fixes this, and also adds a debug statement to show the sexpr we create from the passed xml.
Good idea - there's been a number of BZ tickets where it would have been useful to ask the user to get this with LIBVIRT_DEBUG=1
Agreed, looks fine to me, +1 ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Cole Robinson
-
Daniel P. Berrange
-
Daniel Veillard