[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Fix network hotplug to use device_add in QEMU



On Fri, Apr 16, 2010 at 11:53:52AM +0100, Daniel P. Berrange wrote:
> The initial boot of VMs uses -device for NICs where available. The
> corresponding monitor command is device_add, but the network hotplug
> code was still using device_del by mistake.

  Err it looks to me that the code is still using the old PCI add
instead of device_add but not device_del or I'm mistaken.

> * src/qemu/qemu_driver.c: Use device_add for NIC hotplug where
>   available
> ---
>  src/qemu/qemu_driver.c |   28 ++++++++++++++++++++--------
>  1 files changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 5c15c1d..9e0a353 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -7210,17 +7210,29 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn,
>          close(tapfd);
>      tapfd = -1;
>  
> -    if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))
> -        goto try_remove;
> +    if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
> +        if (!(nicstr = qemuBuildNicDevStr(net, vlan)))
> +            goto try_remove;
> +    } else {
> +        if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))
> +            goto try_remove;
> +    }
>  
>      qemuDomainObjEnterMonitorWithDriver(driver, vm);
> -    if (qemuMonitorAddPCINetwork(priv->mon, nicstr,
> -                                 &guestAddr) < 0) {
> -        qemuDomainObjExitMonitorWithDriver(driver, vm);
> -        goto try_remove;
> +    if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
> +        if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
> +            qemuDomainObjExitMonitorWithDriver(driver, vm);
> +            goto try_remove;
> +        }
> +    } else {
> +        if (qemuMonitorAddPCINetwork(priv->mon, nicstr,
> +                                     &guestAddr) < 0) {
> +            qemuDomainObjExitMonitorWithDriver(driver, vm);
> +            goto try_remove;
> +        }
> +        net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
> +        memcpy(&net->info.addr.pci, &guestAddr, sizeof(guestAddr));
>      }
> -    net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
> -    memcpy(&net->info.addr.pci, &guestAddr, sizeof(guestAddr));
>      qemuDomainObjExitMonitorWithDriver(driver, vm);
>  
>      ret = 0;

  But patch looks fine to me !

ACK,

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/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]