[libvirt] [PATCH 24/27] Add API for issuing 'host_net_remove' monitor command

Mark McLoughlin markmc at redhat.com
Mon Sep 28 13:23:08 UTC 2009


On Thu, 2009-09-24 at 16:00 +0100, Daniel P. Berrange wrote:
> * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new
>   qemuMonitorRemoveHostNetwork() command for removing host
>   networks
> * src/qemu/qemu_driver.c: Convert NIC hotplug methods over
>   to use qemuMonitorRemoveHostNetwork()
> ---
>  src/qemu/qemu_driver.c       |   65 ++++++++++-------------------------------
>  src/qemu/qemu_monitor_text.c |   32 ++++++++++++++++++++
>  src/qemu/qemu_monitor_text.h |    4 ++
>  3 files changed, 52 insertions(+), 49 deletions(-)
> 
...
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 5bff427..0675bf5 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -1695,3 +1695,35 @@ cleanup:
>      VIR_FREE(reply);
>      return ret;
>  }
> +
> +
> +int qemuMonitorRemoveHostNetwork(const virDomainObjPtr vm,
> +                                 int vlan,
> +                                 const char *netname)
> +{
> +    char *cmd;
> +    char *reply = NULL;
> +    int ret = -1;
> +
> +    if (virAsprintf(&cmd, "host_net_remove %d %s", vlan, netname) < 0) {
> +        virReportOOMError(NULL);
> +        return -1;
> +    }
> +
> +    if (qemudMonitorCommand(vm, cmd, &reply) < 0) {
> +        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
> +                         _("failed to close fd in qemu with '%s'"), cmd);
> +        goto cleanup;
> +    }

Wrong error

> +
> +    DEBUG("%s: host_net_add reply: %s", vm->def->name, reply);

Wrong debug

Otherwise fine, ACK

Cheers,
Mark.




More information about the libvir-list mailing list