Closed hamistao closed 1 month ago
@tomponline I did not fix this in #13596 because:
@hamistao is this confirmed as a bug? If so please can you add the Bug label to the issue.
@tomponline still to be confirmed after some recent changes that have altered the scope of this problem by improving device ID generation, but is still probably a bug
Indeed the duplication happens with PCI and GPU passthrough devices only. After some tests with Testflinger, I concluded that the device ID does not affect the device information as seen from inside the insatance and is just a reference for LXD and QEMU. This PR fixes this.
Required information
Issue description
This is related to #13596. If a QEMU device name is too long, QEMU will trim it down to 64 characters. For LXD, this means that two devices named "{long_name}1" and "{longname}2" may end up with the same QEMU device ID `dev-lxd{trimmed_long_name}`, which will result in the VM failing to start.
Steps to reproduce
LONG_DEVICE_NAME="device-with-very-long-name-for-long-qemu-property-handling-test"
mkdir -p $HOME/device-test && mkdir -p $HOME/device-test && lxc init ubuntu:n vm --vm
lxc config device add v2 "${LONG_DEVICE_NAME}1" pci address=01:00.0 # Requires having an available PCI device.
lxc config device add v2 "${LONG_DEVICE_NAME}2" pci address=02:00.0
lxc start vm