virNetDevVPortProfileOp vmop,
bool standalone,
size_t *nnicindexes,
- int **nicindexes)
+ int **nicindexes,
+ unsigned int flags)
{
virDomainDefPtr def = vm->def;
int ret = -1;
slirpfdName)))
goto cleanup;
- if (!(host = virQEMUBuildNetdevCommandlineFromJSON(hostnetprops)))
+ if (!(host = virQEMUBuildNetdevCommandlineFromJSON(hostnetprops,
+ (flags & QEMU_BUILD_COMMANDLINE_VALIDATE_KEEP_JSON))))
goto cleanup;
virCommandAddArgList(cmd, "-netdev", host, NULL);
bool standalone,
size_t *nnicindexes,
int **nicindexes,
- unsigned int *bootHostdevNet)
+ unsigned int *bootHostdevNet,
+ unsigned int flags)
{
size_t i;
int last_good_net = -1;
if (qemuBuildInterfaceCommandLine(driver, vm, logManager, secManager, cmd, net,
qemuCaps, bootNet, vmop,
standalone, nnicindexes,
- nicindexes) < 0)
+ nicindexes, flags) < 0)
goto error;
last_good_net = i;
virQEMUDriverConfigPtr cfg,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps,
- bool chardevStdioLogd)
+ bool chardevStdioLogd,
+ unsigned int flags)
{
size_t i;
unsigned int cdevflags = QEMU_BUILD_CHARDEV_TCP_NOWAIT |
if (!(netdevprops = qemuBuildChannelGuestfwdNetdevProps(channel)))
return -1;
- if (!(netdevstr = virQEMUBuildNetdevCommandlineFromJSON(netdevprops)))
+ if (!(netdevstr = virQEMUBuildNetdevCommandlineFromJSON(netdevprops,
+ (flags & QEMU_BUILD_COMMANDLINE_VALIDATE_KEEP_JSON))))
return -1;
virCommandAddArgList(cmd, "-netdev", netdevstr, NULL);
bool standalone,
bool enableFips,
size_t *nnicindexes,
- int **nicindexes)
+ int **nicindexes,
+ unsigned int flags)
{
size_t i;
char uuid[VIR_UUID_STRING_BUFLEN];
bool chardevStdioLogd = priv->chardevStdioLogd;
VIR_DEBUG("driver=%p def=%p mon=%p "
- "qemuCaps=%p migrateURI=%s snapshot=%p vmop=%d",
+ "qemuCaps=%p migrateURI=%s snapshot=%p vmop=%d flags=0x%x",
driver, def, priv->monConfig,
- qemuCaps, migrateURI, snapshot, vmop);
+ qemuCaps, migrateURI, snapshot, vmop, flags);
if (qemuBuildCommandLineValidate(driver, def) < 0)
return NULL;
if (qemuBuildNetCommandLine(driver, vm, logManager, secManager, cmd,
qemuCaps, vmop, standalone,
- nnicindexes, nicindexes, &bootHostdevNet) < 0)
+ nnicindexes, nicindexes, &bootHostdevNet, flags) < 0)
return NULL;
if (qemuBuildSmartcardCommandLine(logManager, secManager, cmd, cfg, def, qemuCaps,
return NULL;
if (qemuBuildChannelsCommandLine(logManager, secManager, cmd, cfg, def, qemuCaps,
- chardevStdioLogd) < 0)
+ chardevStdioLogd, flags) < 0)
return NULL;
if (qemuBuildConsoleCommandLine(logManager, secManager, cmd, cfg, def, qemuCaps,
VIR_ENUM_DECL(qemuVideo);
VIR_ENUM_DECL(qemuSoundCodec);
+typedef enum {
+ QEMU_BUILD_COMMANDLINE_VALIDATE_KEEP_JSON = 1 << 0,
+} qemuBuildCommandLineFlags;
+
virCommandPtr qemuBuildCommandLine(virQEMUDriverPtr driver,
virLogManagerPtr logManager,
virSecurityManagerPtr secManager,
bool standalone,
bool enableFips,
size_t *nnicindexes,
- int **nicindexes);
+ int **nicindexes,
+ unsigned int flags);
/* Generate the object properties for pr-manager */
virJSONValuePtr qemuBuildPRManagerInfoProps(virStorageSourcePtr src);
}
if (!(cmd = qemuProcessCreatePretendCmd(driver, vm, NULL,
- qemuCheckFips(), true,
+ qemuCheckFips(), true, false,
VIR_QEMU_PROCESS_START_COLD)))
goto cleanup;
snapshot, vmop,
false,
qemuCheckFips(),
- &nnicindexes, &nicindexes)))
+ &nnicindexes, &nicindexes, 0)))
goto cleanup;
if (incoming && incoming->fd != -1)
const char *migrateURI,
bool enableFips,
bool standalone,
+ bool jsonPropsValidation,
unsigned int flags)
{
+ unsigned int buildflags = 0;
+
virCheckFlags(VIR_QEMU_PROCESS_START_COLD |
VIR_QEMU_PROCESS_START_PAUSED |
VIR_QEMU_PROCESS_START_AUTODESTROY, NULL);
if (standalone)
flags |= VIR_QEMU_PROCESS_START_STANDALONE;
+ if (jsonPropsValidation)
+ buildflags = QEMU_BUILD_COMMANDLINE_VALIDATE_KEEP_JSON;
+
if (qemuProcessInit(driver, vm, NULL, QEMU_ASYNC_JOB_NONE,
!!migrateURI, flags) < 0)
return NULL;
standalone,
enableFips,
NULL,
- NULL);
+ NULL,
+ buildflags);
}
const char *migrateURI,
bool enableFips,
bool standalone,
+ bool jsonPropsValidation,
unsigned int flags);
int qemuProcessInit(virQEMUDriverPtr driver,
/**
* virQEMUBuildNetdevCommandlineFromJSON:
* @props: JSON properties describing a netdev
+ * @rawjson: don't transform to commandline args, but just stringify json
*
* Converts @props into arguments for -netdev including all the quirks and
* differences between the monitor and command line syntax.
+ *
+ * @rawjson is meant for testing of the schema in the xml2argvtest
*/
char *
-virQEMUBuildNetdevCommandlineFromJSON(virJSONValuePtr props)
+virQEMUBuildNetdevCommandlineFromJSON(virJSONValuePtr props,
+ bool rawjson)
{
const char *type = virJSONValueObjectGetString(props, "type");
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+ if (rawjson)
+ return virJSONValueToString(props, false);
+
virBufferAsprintf(&buf, "%s,", type);
if (virQEMUBuildCommandLineJSON(props, &buf, "type", true,
virQEMUBuildCommandLineJSONArrayFormatFunc array);
char *
-virQEMUBuildNetdevCommandlineFromJSON(virJSONValuePtr props);
+virQEMUBuildNetdevCommandlineFromJSON(virJSONValuePtr props,
+ bool rawjson);
int virQEMUBuildObjectCommandlineFromJSON(virBufferPtr buf,
virJSONValuePtr objprops);
virDomainObjPtr vm,
const char *migrateURI,
struct testQemuInfo *info,
- unsigned int flags)
+ unsigned int flags,
+ bool jsonPropsValidation)
{
size_t i;
return qemuProcessCreatePretendCmd(drv, vm, migrateURI,
(flags & FLAG_FIPS), false,
+ jsonPropsValidation,
VIR_QEMU_PROCESS_START_COLD);
}
virResetLastError();
if (!(cmd = testCompareXMLToArgvCreateArgs(&driver, vm, migrateURI, info,
- flags))) {
+ flags, false))) {
if (flags & FLAG_EXPECT_FAILURE)
goto ok;
goto cleanup;