Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/storage-volumes-vm: Root volume disk device attachments (#366)
This should have a check for all corner cases around VM root volume attachments (coverage for canonical/lxd#14532): - security.protection.start allows one other VM to attach the machine's root disk, and can only be removed if the disk is not attached - security.shared allows unchecked attachments of root disks - VM attachments are correctly reported in used_by - hotplug of VM root attachments works (as this is the method reccomended by the docs to avoid UUID/LABEL conflicts) I ran into an interesting behavior of udev in Noble VMs while testing that slowed this down a bit. In order for udev to create a symlink for `SCSI_IDENT_SERIAL` (`/dev/disk/by-id/scsi-SQEMU_QEMU_HARDDISK_lxd_virtual--machine-vm5`), I had to hotplug the device in an `ubuntu:24.04` VM. Starting the VM from cold didn't create the link, and `ubuntu-minimal:24.04` VMs never created it at all. Without hotplug or in an `ubuntu-minimal:24.04`: ``` # udevadm info /dev/sdb ... S: disk/by-id/scsi-0QEMU_QEMU_HARDDISK_lxd_virtual--machine S: disk/by-path/pci-0000:02:00.0-scsi-0:0:1:1 S: disk/by-diskseq/10 E: DEVPATH=/devices/pci0000:00/0000:00:01.1/0000:02:00.0/virtio6/host0/target0:0:1/0:0:1:1/block/sdb E: DEVNAME=/dev/sdb ... E: ID_SERIAL=0QEMU_QEMU_HARDDISK_lxd_virtual--machine E: ID_SERIAL_SHORT=lxd_virtual--machine E: ID_SCSI_SERIAL=lxd_virtual--machine-v2 E: ID_BUS=scsi ... E: DEVLINKS=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_lxd_virtual--machine /dev/disk/by-path/pci-0000:02:00.0-scsi-0:0:1:1 /dev/disk/by-diskseq/10 ... ``` With hotplug: ``` # udevadm info /dev/sdb ... S: disk/by-id/scsi-SQEMU_QEMU_HARDDISK_lxd_virtual--machine-vm5 S: disk/by-path/pci-0000:02:00.0-scsi-0:0:1:1 S: disk/by-id/scsi-0QEMU_QEMU_HARDDISK_lxd_virtual--machine S: disk/by-diskseq/15 ... E: DEVPATH=/devices/pci0000:00/0000:00:01.1/0000:02:00.0/virtio6/host0/target0:0:1/0:0:1:1/block/sdb E: DEVNAME=/dev/sdb ... E: SCSI_IDENT_SERIAL=lxd_virtual--machine-vm5 E: SCSI_IDENT_LUN_VENDOR=lxd_virtual--machine ... E: ID_SERIAL=0QEMU_QEMU_HARDDISK_lxd_virtual--machine E: ID_SERIAL_SHORT=lxd_virtual--machine E: ID_SCSI_SERIAL=lxd_virtual--machine-vm5 ... E: DEVLINKS=/dev/disk/by-id/scsi-SQEMU_QEMU_HARDDISK_lxd_virtual--machine-vm5 /dev/disk/by-path/pci-0000:02:00.0-scsi-0:0:1:1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_lxd_virtual--machin> ... ``` I worked around it by using a shorter LXD device name so that the symlink name wouldn't be truncated; not sure if this is worth chasing further.
- Loading branch information