]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: simplify addition of USB controller in qemuParseCommandLine
authorLaine Stump <laine@laine.org>
Tue, 10 May 2016 16:07:54 +0000 (12:07 -0400)
committerLaine Stump <laine@laine.org>
Mon, 23 May 2016 19:26:57 +0000 (15:26 -0400)
virDomainDefAddUSBController() does everything that the multiple lines
of code were doing.

src/qemu/qemu_parse_command.c

index fb8d3d8045b89515f7eb8bb24e0749791da9bebd..4fafdf266ac6bbeb43af2f29f9c48042fd832fde 100644 (file)
@@ -2371,14 +2371,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)