diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ca178d90cd0964093a142b06129097c8cdb0dcd0..15114c66daca7e5bbbd1bc0abf31a8afa68210db 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8560,10 +8560,7 @@ qemuBuildShmemBackendStr(virLogManagerPtr logManager, { char *devstr = NULL; - if (!shmem->server.chr.data.nix.path && - virAsprintf(&shmem->server.chr.data.nix.path, - "/var/lib/libvirt/shmem-%s-sock", - shmem->name) < 0) + if (qemuDomainPrepareShmemChardev(shmem) < 0) return NULL; devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3f16dbee2e6aa77de33198355b1750637cd28fb6..177525b0ab81623938a25d498d8c97b3d8b9601f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6056,6 +6056,19 @@ qemuDomainPrepareChannel(virDomainChrDefPtr channel, } +int +qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem) +{ + if (!shmem->server.enabled || + shmem->server.chr.data.nix.path) + return 0; + + return virAsprintf(&shmem->server.chr.data.nix.path, + "/var/lib/libvirt/shmem-%s-sock", + shmem->name); +} + + /** * qemuDomainVcpuHotplugIsInOrder: * @def: domain definition diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a1404d037825be9b6dae75e6e7e02189acde4170..c2fab3ba35212de328774c6a6a585186f45e4ff2 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -722,6 +722,9 @@ int qemuDomainPrepareChannel(virDomainChrDefPtr chr, const char *domainChannelTargetDir) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem) + ATTRIBUTE_NONNULL(1); + bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def) ATTRIBUTE_NONNULL(1);