[libvirt] [PATCH 1/4] qemu: simplify addition of USB controller in qemuParseCommandLine

Cole Robinson crobinso at redhat.com
Sat May 14 14:52:31 UTC 2016


On 05/11/2016 10:58 AM, Laine Stump wrote:
> virDomainDefAddUSBController() does everything that the multiple lines
> of code were doing.
> ---
>  src/qemu/qemu_parse_command.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
> index 7ce90f9..23b0159 100644
> --- a/src/qemu/qemu_parse_command.c
> +++ b/src/qemu/qemu_parse_command.c
> @@ -2350,14 +2350,8 @@ qemuParseCommandLine(virCapsPtr caps,
>              WANT_VALUE();
>              /* ignore, generted on the fly */
>          } else if (STREQ(arg, "-usb")) {
> -            virDomainControllerDefPtr ctldef;
> -            ctldef = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB);
> -            if (!ctldef)
> +            if (virDomainDefAddUSBController(def, -1, -1) < 0)
>                  goto error;
> -            if (virDomainControllerInsert(def, ctldef) < 0) {
> -                virDomainControllerDefFree(ctldef);
> -                goto error;
> -            }
>          } else if (STREQ(arg, "-pidfile")) {
>              WANT_VALUE();
>              if (pidfile)
> 

ACK, and could be pushed independent of the other patches

- Cole




More information about the libvir-list mailing list