[libvirt] [PATCH 11/14] Remove the network backend if NIC hotplug fails

Daniel Veillard veillard at redhat.com
Mon Jul 20 12:56:03 UTC 2009


On Mon, Jul 20, 2009 at 12:51:21PM +0100, Mark McLoughlin wrote:
> If we fail to pci_add a NIC, we should remove the network backend and
> leave things the way we found them. To do that, we pre-allocate a
> host_net_remove monitor command and issue that if the pci_add fails.
> If the remove fails, we just log a warning.
> 
> We can only do this if we have a name for the network backend and
> we know the vlan number its associated with.
> 
> * src/qemu_driver.c: host_net_remove the network backend if the
>   pci_add fails
[...]
>      if (qemuBuildNicStr(conn, net,
> -                        "pci_add pci_addr=auto ", ' ', net->vlan, &cmd) < 0) {
> -        /* FIXME: try and remove the backend again */
> -        return -1;
> -    }
> +                        "pci_add pci_addr=auto ", ' ', net->vlan, &cmd) < 0)
> +        goto try_remove;

  okay this answer my previous question,
>      if (qemudMonitorCommand(vm, cmd, &reply) < 0) {
> -        /* FIXME: try and remove the backend again */
>          qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
>                           _("failed to add NIC with '%s'"), cmd);
>          VIR_FREE(cmd);
> -        return -1;
> +        goto try_remove;
>      }

  idem, maybe patch 10 and 11  don't need to be separated

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