[PATCH 10/12] qemu_driver: cleanup qemuConnectDomainXMLToNative

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

 



Use qemuProcessCreateCmd instead duplicating required steps from
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 42 ++----------------------------------------
 1 file changed, 2 insertions(+), 40 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1862c60..017b518 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6949,17 +6949,12 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
                                           unsigned int flags)
 {
     virQEMUDriverPtr driver = conn->privateData;
-    virDomainChrSourceDef monConfig;
-    virQEMUCapsPtr qemuCaps = NULL;
     virDomainObjPtr vm = NULL;
-    bool monitor_json = false;
     virCommandPtr cmd = NULL;
     char *ret = NULL;
     size_t i;
     virQEMUDriverConfigPtr cfg;
     virCapsPtr caps = NULL;
-    char *domainLibDir = NULL;
-    char *domainChannelTargetDir = NULL;
 
     virCheckFlags(0, NULL);
 
@@ -6985,17 +6980,6 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
                                             VIR_DOMAIN_DEF_PARSE_ABI_UPDATE)))
         goto cleanup;
 
-    if (qemuProcessStartValidate(driver, vm, qemuCaps, false, false,
-                                 VIR_QEMU_PROCESS_START_COLD |
-                                 VIR_QEMU_PROCESS_START_PRETEND) < 0)
-        goto cleanup;
-
-    /* Generate per-domain paths because we don't have the domain object */
-    if (qemuDomainSetPrivatePaths(&domainLibDir, &domainChannelTargetDir,
-                                  cfg->libDir, cfg->channelTargetDir,
-                                  vm->def->name, -1) < 0)
-        goto cleanup;
-
     /* Since we're just exporting args, we can't do bridge/network/direct
      * setups, since libvirt will normally create TAP/macvtap devices
      * directly. We convert those configs into generic 'ethernet'
@@ -7084,17 +7068,6 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
         net->mac = mac;
     }
 
-    monitor_json = virQEMUCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
-
-    if (qemuProcessPrepareMonitorChr(&monConfig, vm->def->name) < 0)
-        goto cleanup;
-
-    if (qemuAssignDeviceAliases(vm->def, qemuCaps) < 0)
-        goto cleanup;
-
-    if (qemuDomainAssignAddresses(vm->def, qemuCaps, NULL) < 0)
-        goto cleanup;
-
     /* do fake auto-alloc of graphics ports, if such config is used */
     for (i = 0; i < vm->def->ngraphics; ++i) {
         virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
@@ -7107,28 +7080,17 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
         }
     }
 
-    if (!(cmd = qemuBuildCommandLine(conn, driver, NULL, vm->def,
-                                     &monConfig, monitor_json, qemuCaps,
-                                     NULL, NULL,
-                                     VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
-                                     &buildCommandLineCallbacks,
-                                     true,
-                                     qemuCheckFips(),
-                                     NULL, NULL, NULL,
-                                     domainLibDir,
-                                     domainChannelTargetDir)))
+    if (!(cmd = qemuProcessCreateCmd(conn, driver, vm, NULL, false, true,
+                                     VIR_QEMU_PROCESS_START_COLD)))
         goto cleanup;
 
     ret = virCommandToString(cmd);
 
  cleanup:
-    virObjectUnref(qemuCaps);
     virCommandFree(cmd);
     virObjectUnref(vm);
     virObjectUnref(caps);
     virObjectUnref(cfg);
-    VIR_FREE(domainLibDir);
-    VIR_FREE(domainChannelTargetDir);
     return ret;
 }
 
-- 
2.7.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]