[libvirt] [PATCH] don't raise a missing network as an internal error

https://bugzilla.redhat.com/show_bug.cgi?id=509189 When defining a domain referencing a missing network the erro should not be raised as an internal error. Patch by Paolo Bonzini looks fine to me, 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/

On Tue, Jul 07, 2009 at 04:06:03PM +0200, Daniel Veillard wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=509189
When defining a domain referencing a missing network the erro should not be raised as an internal error. Patch by Paolo Bonzini looks fine to me,
ACK, though I get the feeling you could probably remove the qemudReportError call there completely. IIRC, virNetworkLookupByName should have already raised a suitable error message which we probably don't need to override. Daniel
diff --git a/src/qemu_conf.c b/src/qemu_conf.c index 9ca60b9..11eacb3 100644 --- a/src/qemu_conf.c +++ b/src/qemu_conf.c @@ -716,8 +716,8 @@ qemudNetworkIfaceConnect(virConnectPtr conn, virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name); if (!network) { - qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("Network '%s' not found"), + qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, + _("Network '%s' not defined"), net->data.network.name); goto error; }
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- |: 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 Tue, Jul 07, 2009 at 03:16:43PM +0100, Daniel P. Berrange wrote:
On Tue, Jul 07, 2009 at 04:06:03PM +0200, Daniel Veillard wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=509189
When defining a domain referencing a missing network the erro should not be raised as an internal error. Patch by Paolo Bonzini looks fine to me,
ACK, though I get the feeling you could probably remove the qemudReportError call there completely. IIRC, virNetworkLookupByName should have already raised a suitable error message which we probably don't need to override.
Agreed, removing the two lines we get: [root@paphio ~]# virsh create /tmp/bug.xml error: Failed to create domain from /tmp/bug.xml error: Network not found: no network with matching name instead of [root@paphio ~]# virsh create /tmp/bug.xml error: Failed to create domain from /tmp/bug.xml error: Network not found: Network 'defaut' not defined so the error is the one reported by the lookup and it should be that way, it's missing the name being looked at though, but it's something which need to be fixed more globally, as it shows up in a number of places as a grep will report: paphio:~/libvirt -> grep "with matching name" src/*.c src/network_driver.c: "%s", _("no network with matching name")); src/node_device.c: "%s", _("no node device with matching name")); src/node_device.c: "%s", _("no node device with matching name")); src/node_device.c: "%s", _("no node device with matching name")); src/node_device.c: "%s", _("no node device with matching name")); src/qemu_driver.c: _("no domain with matching name '%s'"), name); src/qemu_driver.c: _("no domain with matching name '%s'"), dname); src/storage_driver.c: "%s", _("no pool with matching name")); src/storage_driver.c: "%s", _("no storage vol with matching name")); src/storage_driver.c: "%s", _("no storage pool with matching name")); src/storage_driver.c: "%s", _("no storage vol with matching name")); src/storage_driver.c: "%s", _("no storage vol with matching name")); src/storage_driver.c: "%s", _("no storage vol with matching name")); src/storage_driver.c: "%s", _("no storage vol with matching name")); src/storage_driver.c: "%s", _("no storage vol with matching name")); I'm sure there is a number of places where we could add a name there, but it's better left as a separate patch, So commited just removing the two lines for now, 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 (2)
-
Daniel P. Berrange
-
Daniel Veillard