[libvirt] [PATCH 14/14] Add support for network device detach

Daniel Veillard veillard at redhat.com
Mon Jul 20 14:50:30 UTC 2009


On Mon, Jul 20, 2009 at 02:23:20PM +0100, Mark McLoughlin wrote:
> On Mon, 2009-07-20 at 15:05 +0200, Daniel Veillard wrote:
> > On Mon, Jul 20, 2009 at 12:51:24PM +0100, Mark McLoughlin wrote:
> > > qemu network devices are hot-unplugged in two stages - first the PCI NIC
> > > is removed using 'pci_del <pci_addr>' and then the backend is removed
> > > using 'host_net_remove <vlan> <name>'.
> > > 
> > > In order to perform these operations we need to have retained the
> > > PCI address, backend name and vlan number.
> > [...]
> > > +    DEBUG("%s: pci_del reply: %s", vm->def->name,  reply);
> > > +
> > > +    /* If the command fails due to a wrong PCI address qemu prints
> > > +     * 'invalid pci address'; nothing is printed on success */
> > > +    if (strstr(reply, "Invalid pci address")) {
> > > +        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
> > > +                         _("failed to detach network device: invalid PCI address %s: %s"),
> > > +                         detach->pci_addr, reply);
> > > +        goto cleanup;
> > > +    }
> > 
> >   Hum, is that the only possible source of error ? Seems trying to
> > detect failure and then possibly 'invalid pci address' as a reason
> > would be more reliable.
> 
> Looking at the code, I think the only other possible error currently is
> "empty slot". I'll address that in a follow up patch.
> 
> The current monitor protocol sucks because we don't actually have an
> error indication. For this command, we could probably say that any
> response indicates an error but you can be sure some future version of
> qemu would then add a success message :-)

  Argh, okay ... :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list