提交 08600de3 编写于 作者: J Jiri Denemark

qemu: Don't generate migration URI in qemuBuildCommandLine

Make callers of qemuBuildCommandLine responsible for providing the URI
which should be passed as a parameter for -incoming.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 71483641
......@@ -9088,7 +9088,7 @@ qemuBuildTPMCommandLine(virDomainDefPtr def,
return 0;
}
static int
int
qemuBuildIncomingCheckProtocol(virQEMUCapsPtr qemuCaps,
const char *migrateFrom)
{
......@@ -9113,7 +9113,7 @@ qemuBuildIncomingCheckProtocol(virQEMUCapsPtr qemuCaps,
}
static char *
char *
qemuBuildIncomingURI(const char *migrateFrom,
int migrateFd)
{
......@@ -9146,8 +9146,7 @@ qemuBuildCommandLine(virConnectPtr conn,
virDomainChrSourceDefPtr monitor_chr,
bool monitor_json,
virQEMUCapsPtr qemuCaps,
const char *migrateFrom,
int migrateFd,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virNetDevVPortProfileOp vmop,
qemuBuildCommandLineCallbacksPtr callbacks,
......@@ -9208,10 +9207,9 @@ qemuBuildCommandLine(virConnectPtr conn,
int bootCD = 0, bootFloppy = 0, bootDisk = 0;
VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d "
"qemuCaps=%p migrateFrom=%s migrateFD=%d "
"snapshot=%p vmop=%d",
"qemuCaps=%p migrateURI=%s snapshot=%p vmop=%d",
conn, driver, def, monitor_chr, monitor_json,
qemuCaps, migrateFrom, migrateFd, snapshot, vmop);
qemuCaps, migrateURI, snapshot, vmop);
virUUIDFormat(def->uuid, uuid);
......@@ -9290,7 +9288,7 @@ qemuBuildCommandLine(virConnectPtr conn,
goto error;
if (qemuBuildCpuArgStr(driver, def, emulator, qemuCaps,
hostarch, &cpu, &hasHwVirt, !!migrateFrom) < 0)
hostarch, &cpu, &hasHwVirt, !!migrateURI) < 0)
goto error;
if (cpu) {
......@@ -9305,7 +9303,7 @@ qemuBuildCommandLine(virConnectPtr conn,
if (qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps) < 0)
goto error;
if (!migrateFrom && !snapshot &&
if (!migrateURI && !snapshot &&
qemuDomainAlignMemorySizes(def) < 0)
goto error;
......@@ -10975,22 +10973,8 @@ qemuBuildCommandLine(virConnectPtr conn,
}
}
if (migrateFrom) {
char *migrateURI;
if (qemuBuildIncomingCheckProtocol(qemuCaps, migrateFrom) < 0)
goto error;
if (STREQ(migrateFrom, "stdio") ||
STRPREFIX(migrateFrom, "fd"))
virCommandPassFD(cmd, migrateFd, 0);
migrateURI = qemuBuildIncomingURI(migrateFrom, migrateFd);
if (!migrateURI)
goto error;
if (migrateURI)
virCommandAddArgList(cmd, "-incoming", migrateURI, NULL);
VIR_FREE(migrateURI);
}
/* QEMU changed its default behavior to not include the virtio balloon
* device. Explicitly request it to ensure it will be present.
......
......@@ -78,8 +78,7 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
virDomainChrSourceDefPtr monitor_chr,
bool monitor_json,
virQEMUCapsPtr qemuCaps,
const char *migrateFrom,
int migrateFd,
const char *migrateURI,
virDomainSnapshotObjPtr current_snapshot,
virNetDevVPortProfileOp vmop,
qemuBuildCommandLineCallbacksPtr callbacks,
......@@ -320,4 +319,10 @@ bool qemuCheckCCWS390AddressSupport(virDomainDefPtr def,
virDomainDeviceInfo info,
virQEMUCapsPtr qemuCaps,
const char *devicename);
int qemuBuildIncomingCheckProtocol(virQEMUCapsPtr qemuCaps,
const char *migrateFrom);
char *qemuBuildIncomingURI(const char *migrateFrom,
int migrateFd);
#endif /* __QEMU_COMMAND_H__*/
......@@ -7268,7 +7268,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
if (!(cmd = qemuBuildCommandLine(conn, driver, def,
&monConfig, monitor_json, qemuCaps,
NULL, -1, NULL,
NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
&buildCommandLineCallbacks,
true,
......
......@@ -4185,6 +4185,7 @@ int qemuProcessStart(virConnectPtr conn,
size_t nnicindexes = 0;
int *nicindexes = NULL;
char *tmppath = NULL;
char *migrateURI = NULL;
VIR_DEBUG("vm=%p name=%s id=%d asyncJob=%d migrateFrom=%s stdin_fd=%d "
"stdin_path=%s snapshot=%p vmop=%d flags=0x%x",
......@@ -4512,16 +4513,26 @@ int qemuProcessStart(virConnectPtr conn,
goto error;
}
if (migrateFrom) {
if (qemuBuildIncomingCheckProtocol(priv->qemuCaps, migrateFrom) < 0)
goto error;
if (!(migrateURI = qemuBuildIncomingURI(migrateFrom, stdin_fd)))
goto error;
}
VIR_DEBUG("Building emulator command line");
if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
priv->monJSON, priv->qemuCaps,
migrateFrom, stdin_fd, snapshot, vmop,
migrateURI, snapshot, vmop,
&buildCommandLineCallbacks, false,
qemuCheckFips(),
priv->autoNodeset,
&nnicindexes, &nicindexes)))
goto error;
if (migrateFrom && stdin_fd != -1)
virCommandPassFD(cmd, stdin_fd, 0);
/*
* Create all per-domain directories in order to make sure domain
......@@ -4907,6 +4918,7 @@ int qemuProcessStart(virConnectPtr conn,
VIR_FREE(nicindexes);
VIR_FREE(nodeset);
VIR_FREE(tmppath);
VIR_FREE(migrateURI);
return ret;
error:
......
......@@ -249,8 +249,7 @@ typedef enum {
static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdline,
virQEMUCapsPtr extraFlags,
const char *migrateFrom,
int migrateFd,
const char *migrateURI,
virQemuXML2ArgvTestFlags flags)
{
char *actualargv = NULL;
......@@ -341,7 +340,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(cmd = qemuBuildCommandLine(conn, &driver, vmdef, &monitor_chr,
(flags & FLAG_JSON), extraFlags,
migrateFrom, migrateFd, NULL,
migrateURI, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
&testCallbacks, false,
(flags & FLAG_FIPS),
......@@ -408,6 +407,12 @@ testCompareXMLToArgvHelper(const void *data)
char *xml = NULL;
char *args = NULL;
unsigned int flags = info->flags;
char *migrateURI = NULL;
if (info->migrateFrom &&
!(migrateURI = qemuBuildIncomingURI(info->migrateFrom,
info->migrateFd)))
goto cleanup;
if (virAsprintf(&xml, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
abs_srcdir, info->name) < 0 ||
......@@ -427,10 +432,10 @@ testCompareXMLToArgvHelper(const void *data)
goto cleanup;
result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
info->migrateFrom, info->migrateFd,
flags);
migrateURI, flags);
cleanup:
VIR_FREE(migrateURI);
VIR_FREE(xml);
VIR_FREE(args);
return result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册