]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
qemu: Be less aggressive when dropping channel source paths
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Jan 2024 13:40:11 +0000 (14:40 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Jan 2024 07:44:32 +0000 (08:44 +0100)
In v9.7.0-rc1~130 I've shortened the path that's generated for
<channel/> source. With that, I had to adjust regex that matches
all versions of paths we have ever generated so that we can drop
them (see comment around qemuDomainChrDefDropDefaultPath()). But
as it is usually the case with regexes - they are write only. And
while I attempted to make one portion of the path optional
("/target/") I accidentally made regex accept more, which
resulted in libvirt dropping the user provided path and
generating our own instead.

Fixes: d3759d3674ab9453e5fb5a27ab6c28b8ff8d5569
Resolves: https://issues.redhat.com/browse/RHEL-20807
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/channel-unix-source-path.x86_64-latest.args
tests/qemuxml2argvdata/channel-unix-source-path.xml
tests/qemuxml2xmloutdata/channel-unix-source-path-active.x86_64-latest.xml
tests/qemuxml2xmloutdata/channel-unix-source-path-inactive.x86_64-latest.xml

index 003fe7c71b608a99cbe1014ee1cbbe31397ffb84..3a00fb689e169f6236f61b5a95bcbb6d2bffde55 100644 (file)
@@ -5447,7 +5447,7 @@ qemuDomainChrMatchDefaultPath(const char *prefix,
     virBufferEscapeRegex(&buf, "^%s", prefix);
     if (infix)
         virBufferEscapeRegex(&buf, "%s", infix);
-    virBufferAddLit(&buf, "/(target/)?([^/]+\\.)|(domain-[^/]+/)|([0-9]+-[^/]+/)");
+    virBufferAddLit(&buf, "/(target/)?(([^/]+\\.)|(domain-[^/]+/)|([0-9]+-[^/]+/))");
     virBufferEscapeRegex(&buf, "%s$", target);
 
     regexp = virBufferContentAndReset(&buf);
index 821a508a40d7847032036a3e4c1c2a539421e394..845236d2861ba103605d1781c17a874ed8ccf406 100644 (file)
@@ -40,6 +40,14 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":5,"chardev":"charchannel4","id":"channel4","name":"org.qemu.guest_agent.4"}' \
 -chardev socket,id=charchannel5,fd=1729,server=on,wait=off \
 -device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":6,"chardev":"charchannel5","id":"channel5","name":"org.qemu.guest_agent.5"}' \
+-chardev socket,id=charchannel6,fd=1729,server=on,wait=off \
+-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":7,"chardev":"charchannel6","id":"channel6","name":"org.qemu.guest_agent.6"}' \
+-chardev socket,id=charchannel7,fd=1729,server=on,wait=off \
+-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":8,"chardev":"charchannel7","id":"channel7","name":"org.qemu.guest_agent.7"}' \
+-chardev socket,id=charchannel8,fd=1729,server=on,wait=off \
+-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":9,"chardev":"charchannel8","id":"channel8","name":"org.qemu.guest_agent.8"}' \
+-chardev socket,id=charchannel9,fd=1729,server=on,wait=off \
+-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":10,"chardev":"charchannel9","id":"channel9","name":"org.qemu.guest_agent.9"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index df548d88e72778cc471a8dc6925abbb37ed6547b..265971eb94f738fa674fdedbe955aca697a96403 100644 (file)
       <source mode='bind' path='/var/run/libvirt/qemu/channel/1-QEMUGuest1/org.qemu.guest_agent.5'/>
       <target type='virtio' name='org.qemu.guest_agent.5'/>
     </channel>
+    <channel type="unix">
+      <source mode="bind" path="/1-QEMUGuest1/org.qemu.guest_agent.6"/>
+      <target type="virtio" name="org.qemu.guest_agent.6" state="connected"/>
+    </channel>
+    <channel type="unix">
+      <source mode="bind" path="/tmp/1-QEMUGuest1/org.qemu.guest_agent.7"/>
+      <target type="virtio" name="org.qemu.guest_agent.7" state="connected"/>
+    </channel>
+    <channel type="unix">
+      <source mode="bind" path="/tmp/libvirt/qemu/channel/1-QEMUGuest1/org.qemu.guest_agent.8"/>
+      <target type="virtio" name="org.qemu.guest_agent.8" state="connected"/>
+    </channel>
+    <channel type="unix">
+      <source mode="bind" path="/tmp/org.qemu.guest_agent.9"/>
+      <target type="virtio" name="org.qemu.guest_agent.9" state="connected"/>
+    </channel>
     <memballoon model='none'/>
   </devices>
 </domain>
index 022ad7025a05cbd1481a8e0213c4eddd1bc6f17f..12a981438c0fb5a962186bc24a1130e25abcb7a7 100644 (file)
       <target type='virtio' name='org.qemu.guest_agent.5'/>
       <address type='virtio-serial' controller='0' bus='0' port='6'/>
     </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/1-QEMUGuest1/org.qemu.guest_agent.6'/>
+      <target type='virtio' name='org.qemu.guest_agent.6'/>
+      <address type='virtio-serial' controller='0' bus='0' port='7'/>
+    </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/tmp/1-QEMUGuest1/org.qemu.guest_agent.7'/>
+      <target type='virtio' name='org.qemu.guest_agent.7'/>
+      <address type='virtio-serial' controller='0' bus='0' port='8'/>
+    </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/tmp/libvirt/qemu/channel/1-QEMUGuest1/org.qemu.guest_agent.8'/>
+      <target type='virtio' name='org.qemu.guest_agent.8'/>
+      <address type='virtio-serial' controller='0' bus='0' port='9'/>
+    </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/tmp/org.qemu.guest_agent.9'/>
+      <target type='virtio' name='org.qemu.guest_agent.9'/>
+      <address type='virtio-serial' controller='0' bus='0' port='10'/>
+    </channel>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <audio id='1' type='none'/>
index 3b013e9f8709fcd9f099c80b5f99859b732e5134..2315a572e45bbc5310711d3d9e864fc5fa96911b 100644 (file)
       <target type='virtio' name='org.qemu.guest_agent.5'/>
       <address type='virtio-serial' controller='0' bus='0' port='6'/>
     </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/1-QEMUGuest1/org.qemu.guest_agent.6'/>
+      <target type='virtio' name='org.qemu.guest_agent.6'/>
+      <address type='virtio-serial' controller='0' bus='0' port='7'/>
+    </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/tmp/1-QEMUGuest1/org.qemu.guest_agent.7'/>
+      <target type='virtio' name='org.qemu.guest_agent.7'/>
+      <address type='virtio-serial' controller='0' bus='0' port='8'/>
+    </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/tmp/libvirt/qemu/channel/1-QEMUGuest1/org.qemu.guest_agent.8'/>
+      <target type='virtio' name='org.qemu.guest_agent.8'/>
+      <address type='virtio-serial' controller='0' bus='0' port='9'/>
+    </channel>
+    <channel type='unix'>
+      <source mode='bind' path='/tmp/org.qemu.guest_agent.9'/>
+      <target type='virtio' name='org.qemu.guest_agent.9'/>
+      <address type='virtio-serial' controller='0' bus='0' port='10'/>
+    </channel>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <audio id='1' type='none'/>