On Tue, Jul 25, 2017 at 09:33:50AM -0500, Scott Garfinkle wrote:
It's possible to have more than one unnamed virtio-serial unix
channel.
We need to generate a unique name for each channel. Currently, we use
".../unknown.sock" for all of them. Better practice would be to specify
an explicit target path name; however, in the absence of that, we need
uniqueness in the names we generate internally.
Before the changes we'd get /var/lib/libvirt/qemu/channel/target/unknown.sock
for each instance of
<channel type='unix'>
<source mode='bind'/>
<target type='virtio'/>
</channel>
Now, we get vioser-00-00-01.sock, vioser-00-00-02.sock, etc.
Changes from v1: new socket name
Signed-off-by: Scott Garfinkle <seg(a)us.ibm.com>
---
src/qemu/qemu_domain.c | 24 +++++++++++++++-------
.../qemuxml2argv-channel-virtio-unix.args | 2 +-
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 78e75f1..7a9958d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7178,18 +7178,28 @@ int
qemuDomainPrepareChannel(virDomainChrDefPtr channel,
const char *domainChannelTargetDir)
{
- if (channel->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
- channel->source->type == VIR_DOMAIN_CHR_TYPE_UNIX &&
- !channel->source->data.nix.path) {
+ if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO ||
+ channel->source->type != VIR_DOMAIN_CHR_TYPE_UNIX ||
+ channel->source->data.nix.path)
+ return 0;
+
Apart from the indentation right here, it looks fine. I'll fix this up
and push it in a while.
Reviewed-by: Martin Kletzander <mkletzan(a)redhat.com>