1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

qemu: pass virDomainObjPtr to qemuBuildCommandLine

Extract the required data inside a function instead of passing it
all as arguments.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2017-10-11 12:44:30 +02:00
parent 8c85b1ed4a
commit e54d4d5e98
3 changed files with 16 additions and 32 deletions

View File

@ -9972,26 +9972,28 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
virCommandPtr
qemuBuildCommandLine(virQEMUDriverPtr driver,
virLogManagerPtr logManager,
virDomainDefPtr def,
virDomainChrSourceDefPtr monitor_chr,
bool monitor_json,
virQEMUCapsPtr qemuCaps,
virDomainObjPtr vm,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virNetDevVPortProfileOp vmop,
bool standalone,
bool enableFips,
virBitmapPtr nodeset,
size_t *nnicindexes,
int **nicindexes,
const char *domainLibDir,
bool chardevStdioLogd)
int **nicindexes)
{
size_t i;
char uuid[VIR_UUID_STRING_BUFLEN];
virCommandPtr cmd = NULL;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
unsigned int bootHostdevNet = 0;
qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainDefPtr def = vm->def;
virDomainChrSourceDefPtr monitor_chr = priv->monConfig;
bool monitor_json = priv->monJSON;
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
virBitmapPtr nodeset = priv->autoNodeset;
const char *domainLibDir = priv->libDir;
bool chardevStdioLogd = priv->chardevStdioLogd;
VIR_DEBUG("driver=%p def=%p mon=%p json=%d "
"qemuCaps=%p migrateURI=%s snapshot=%p vmop=%d",

View File

@ -45,21 +45,14 @@ VIR_ENUM_DECL(qemuVideo)
virCommandPtr qemuBuildCommandLine(virQEMUDriverPtr driver,
virLogManagerPtr logManager,
virDomainDefPtr def,
virDomainChrSourceDefPtr monitor_chr,
bool monitor_json,
virQEMUCapsPtr qemuCaps,
virDomainObjPtr vm,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virNetDevVPortProfileOp vmop,
bool standalone,
bool enableFips,
virBitmapPtr nodeset,
size_t *nnicindexes,
int **nicindexes,
const char *domainLibDir,
bool chardevStdioLogd)
ATTRIBUTE_NONNULL(15);
int **nicindexes);
/* Generate the object properties for a secret */

View File

@ -5650,16 +5650,12 @@ qemuProcessLaunch(virConnectPtr conn,
VIR_DEBUG("Building emulator command line");
if (!(cmd = qemuBuildCommandLine(driver,
qemuDomainLogContextGetManager(logCtxt),
vm->def, priv->monConfig,
priv->monJSON, priv->qemuCaps,
vm,
incoming ? incoming->launchURI : NULL,
snapshot, vmop,
false,
qemuCheckFips(),
priv->autoNodeset,
&nnicindexes, &nicindexes,
priv->libDir,
priv->chardevStdioLogd)))
&nnicindexes, &nicindexes)))
goto cleanup;
if (incoming && incoming->fd != -1)
@ -6086,7 +6082,6 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
bool standalone,
unsigned int flags)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virCommandPtr cmd = NULL;
virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD |
@ -6106,20 +6101,14 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
VIR_DEBUG("Building emulator command line");
cmd = qemuBuildCommandLine(driver,
NULL,
vm->def,
priv->monConfig,
priv->monJSON,
priv->qemuCaps,
vm,
migrateURI,
NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
standalone,
enableFips,
priv->autoNodeset,
NULL,
NULL,
priv->libDir,
priv->chardevStdioLogd);
NULL);
cleanup:
return cmd;