-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VM: Avoid QEMU device ID trimming #13596
Conversation
4dec742
to
fc279e5
Compare
@tomponline warning that this hashes the device names even if the protocol suffixes would just be partially trimmed, like in |
c25ce0c
to
0f43e45
Compare
0f43e45
to
c42186e
Compare
@tomponline this is ready again |
c42186e
to
90b35cb
Compare
…DMaxLength` Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
This includes the protocol on `nameSuffix` and defines the `lxd_` via `namePrefix` Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
…o `hashIfLonger` Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
This function shortens only the device name part of the qemu device ID, leaving the prefixes and suffixes. For example: `dev-lxd_{device_name_hash}-virtio-fs` Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
90b35cb
to
dd38231
Compare
@tomponline I couldn't test this with hotplugging because of the issue you are working on, it may be necessary to use |
Yep, we'll land the other hotplug fix first. Good idea. |
This fixes the duplicate ID problem on qemu when adding a div drive device.
The problem occurs because QEMU trimms down long device IDs to 64 characters internally and that may result in other references to that device mismatching the device ID or even duplicate IDs if a dir drive device ID is big enough that the suffix that differentiates the tags of the 9p entry and the virtiofs entry are removed in the trimming process.
As an example,
dev-lxd_{long_device_name}-virtio-fs
anddev-lxd_{long_device_name}-9p
would be used in separateqem.conf
entries for the same device named{long_device_name}
. This can generate duplicate IDs when both those ids get trimmed down todev-lxd_{trimmed_long_device_name}
, losing the protocol suffixes.This PR proposes hashing the device name when the device name is big enough that the QEMU ID has to be trimmed (but not in any other case). This results is device IDs like
dev-lxd_{device_name_hash}-virtio-fs