Multipath device's targets are not added to domain namespace/cgroup
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| libvirt |
Fix Released
|
Unknown
|
|||
| libvirt (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
| Jammy |
Fix Released
|
Medium
|
Unassigned | ||
| Noble |
Fix Released
|
Medium
|
Unassigned | ||
| Plucky |
Fix Released
|
Medium
|
Unassigned | ||
| Questing |
Fix Released
|
Undecided
|
Unassigned | ||
Bug Description
This is a bug in libvirt which has been fixed in upstream: https:/
> When using qemu-pr-helper with multipath devices, the target devices are not added to the domain's namespace as well as cgroups. As a result, the sg_persist calls from the guest VM fail.
And the fix will be available in the next release (v11.6.0), but needs to be backported to 22.04 and 24.04 as those are on 8.0.0 and 10.0.0 respectively.
I'm working on patch for 22.04 followed by 24.04
---
[ Impact ]
When using qemu-pr-helper with multipath devices, the target devices are not added to the domain's namespace as well as cgroups. As a result, the sg_persist calls from the guest VM fail. These are mostly used by clustered applications like Windows Cluster.
[ Test Plan ]
These steps help to reproduce the issue with the scsi_debug kernel module. We create a fake multipath device with 4 target disks, without the fix we can only see the device mapper device in qemu-pr-helper's mount namespace.
1. Get the scsi_debug kernel module and verify it is available.
sudo apt install linux-modules-
$ find /lib/modules/ -name "*scsi*" | grep debug
/lib/
2. Ensure multipath-tools in installed on the system and multipathd service is running.
sudo apt install multipath-tools
sudo systemctl status multipathd.service
3. Create a multipath device with 4 target disks using scsi_debug
sudo modprobe scsi_debug dev_size_mb=100 num_tgts=1 vpd_use_hostno=0 add_host=4 delay=20 max_luns=2 no_lun_0=1
$ sudo multipath -ll
mpatha (1Linux_
size=100M features='0' hwhandler='1 alua' wp=rw
|-+- policy=
| `- 2:0:0:1 sda 8:0 active ready running
|-+- policy=
| `- 5:0:0:1 sdd 8:48 active ready running
|-+- policy=
| `- 3:0:0:1 sdb 8:16 active ready running
`-+- policy=
`- 4:0:0:1 sdc 8:32 active ready running
Notice that the name is 1Linux_
We will use the following path of the multipath device mapper disk when creating the VM, this points to dm-0.
/dev/
$ ls -l /dev/disk/
… /dev/disk/
4. Create a new VM with reservations (starts qemu-pr-helper along with the qemu process for the VM). Use domain.xml from attachment: https:/
Install libvirt first:
sudo apt install libvirt-daemon libvirt-
sudo systemctl start libvirtd
Create the VM:
sudo virsh define --file domain.xml --validate
sudo virsh start libvirt-lp2117467
Verify it is in running state.
sudo virsh list --all
5. Find the mount namespace of the VM, enter the namespace and verify the disks are added there.
Find the PID of qemu-pr-helper or qemu-system-x86
$ pgrep qemu-pr-helper
734148
Enter the mount namespace of this process to verify all the target disks are present. In this example, we don't see the sda to sdd as libvirt is not patched.
$ sudo nsenter --target 734148 --mount bash
root@
disk dm-0 full hugepages mapper mqueue null ptmx pts random shm urandom zero
When the patched version is installed and VM is re-created, we should be able to see the target devices (sda to sdd) as well.
root@
block disk dm-0 full hugepages mapper mqueue null ptmx pts random sda sdb sdc sdd shm urandom zero
# notice the sda, sdb, sdc, and sdd got added after installing update.
[ Where problems could occur ]
The bugfix is quite isolated to one particular area, the code handling device mapper references, things like /dev/disk/
using the now correct names (in case there is a scenario where the old worked better).
Related branches
- git-ubuntu bot: Approve
- Andreas Hasenack: Approve
- Canonical Server Reporter: Pending requested
- Canonical Server: Pending requested
- Canonical Server packageset reviewers: Pending requested
- Canonical Server Core Reviewers: Pending requested
-
Diff: 106 lines (+81/-0)3 files modifieddebian/changelog (+10/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-2117467-virdevmapper-device-name-for-targets.patch (+70/-0)
- git-ubuntu bot: Approve
- Andreas Hasenack: Approve
- Canonical Server packageset reviewers: Pending requested
- Canonical Server Core Reviewers: Pending requested
- Canonical Server Reporter: Pending requested
- Canonical Server: Pending requested
-
Diff: 106 lines (+81/-0)3 files modifieddebian/changelog (+10/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-2117467-virdevmapper-device-name-for-targets.patch (+70/-0)
- git-ubuntu bot: Approve
- Andreas Hasenack: Approve
- Canonical Server: Pending requested
- Canonical Server Core Reviewers: Pending requested
- Canonical Server Reporter: Pending requested
- Canonical Server packageset reviewers: Pending requested
-
Diff: 106 lines (+81/-0)3 files modifieddebian/changelog (+10/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-2117467-virdevmapper-device-name-for-targets.patch (+70/-0)
| Changed in libvirt: | |
| status: | Unknown → Fix Released |
| Changed in libvirt (Ubuntu Plucky): | |
| assignee: | Lukas Märdian (slyon) → nobody |
| tags: | removed: server-todo |
| description: | updated |
| Changed in libvirt (Ubuntu Plucky): | |
| status: | Triaged → In Progress |
| Changed in libvirt (Ubuntu Jammy): | |
| status: | Triaged → In Progress |
| Changed in libvirt (Ubuntu Noble): | |
| status: | Triaged → In Progress |

Attaching patch for Jammy. I have used this change in my environment and it fixes the bug.