qemu: Split shmem preparation as it's supposed to be

Since the introduction of shmem, there was a split of preparation code
from the formatting code from qemuBuildCommandLine() into
qemuProcessPrepareDomain().  Let's fix shmem in this regard, so that
we can slowly get to a cleaner codebase.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2017-07-21 13:47:05 +02:00
parent 19581afd77
commit 848378c64c
2 changed files with 10 additions and 25 deletions

View File

@ -8879,28 +8879,6 @@ qemuBuildShmemDevStr(virDomainDefPtr def,
return virBufferContentAndReset(&buf);
}
static char *
qemuBuildShmemBackendChrStr(virLogManagerPtr logManager,
virCommandPtr cmd,
virQEMUDriverConfigPtr cfg,
virDomainDefPtr def,
virDomainShmemDefPtr shmem,
virQEMUCapsPtr qemuCaps,
bool chardevStdioLogd)
{
char *devstr = NULL;
if (qemuDomainPrepareShmemChardev(shmem) < 0)
return NULL;
devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&shmem->server.chr,
shmem->info.alias, qemuCaps, true,
chardevStdioLogd);
return devstr;
}
virJSONValuePtr
qemuBuildShmemBackendMemProps(virDomainShmemDefPtr shmem)
@ -9010,9 +8988,11 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
VIR_FREE(devstr);
if (shmem->server.enabled) {
if (!(devstr = qemuBuildShmemBackendChrStr(logManager, cmd, cfg, def,
shmem, qemuCaps,
chardevStdioLogd)))
devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&shmem->server.chr,
shmem->info.alias, qemuCaps, true,
chardevStdioLogd);
if (!devstr)
return -1;
virCommandAddArgList(cmd, "-chardev", devstr, NULL);

View File

@ -5325,6 +5325,11 @@ qemuProcessPrepareDomain(virConnectPtr conn,
if (qemuProcessUpdateGuestCPU(vm->def, priv->qemuCaps, caps, flags) < 0)
goto cleanup;
for (i = 0; i < vm->def->nshmems; i++) {
if (qemuDomainPrepareShmemChardev(vm->def->shmems[i]) < 0)
goto cleanup;
}
ret = 0;
cleanup:
virObjectUnref(caps);