Description of problem: this issue is remained the mediated device (mdev) after deleting the instance that allocated vGPU According to them, mdev is remained when checking the CLI `mdevctl list` after shelving the instance but it is deallocated when checking the CLI `nvidia-smi vgpu` I'm very wondering that why mdev is remained after deleting/shelving the instance that allocated vGPU Do we need to manually delete mdev if deleting/shelving the instance that allocated vGPU? They do delete the instance using the CLI `nova force-delete` to immediately delete the instance because they are using soft-delete due to their company policy Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: vGPU was't deleted automatically when deleting the instance that allocated vGPU Expected results: vGPU is deleted automatically when deleting the instance that allocated vGPU Additional info:
(In reply to Chorong Park from comment #0) > Expected results: > vGPU is deleted automatically when deleting the instance that allocated vGPU No, FWIW, this isn't an expected result. When creating an instance, Nova verifies whether there are mdevs that are not used by other instances, and if so, uses one of them for the new instance [1] If there are no existing created mdevs that are not used by some guests, then Nova will directly ask sysfs to create one mdev [2] When deleting an instance, then we just remove the guest so the mdev that was created is no longer used. [1] https://github.com/openstack/nova/blob/58be0ca8b8204bce6cbb6747d46ca595c5843a30/nova/virt/libvirt/driver.py#L8449-L8455 [2] https://github.com/openstack/nova/blob/58be0ca8b8204bce6cbb6747d46ca595c5843a30/nova/virt/libvirt/driver.py#L8343-L8372 and https://github.com/openstack/nova/blob/58be0ca8b8204bce6cbb6747d46ca595c5843a30/nova/privsep/libvirt.py#L195-L203