Re: [PATCH v2] Generate unique socket file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

---
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@xxxxxxxxxx>

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux