[nova][dev] Reattaching mediated devices to instance coming back from suspended state

Gustavo Faganello Santos gustavofaganello.santos at windriver.com
Fri Oct 15 15:23:07 UTC 2021

On 14/10/2021 16:02, melanie witt wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> On Thu Oct 14 2021 11:37:43 GMT-0700 (Pacific Daylight Time), Gustavo
> Faganello Santos <gustavofaganello.santos at windriver.com> wrote:
>> Hello, everyone!
>> I'm working on a solution for Nova to reattach previously used mediated
>> devices (vGPU instances, in my case) to VMs coming back from suspension,
>> which seems to have been left on hold in the past [1] because of an old
>> libvirt limitation, and I'm having a bit of a hard time doing so, since
>> I'm not too familiar with the repo.
>> I have tried creating a function that does the opposite of the mdev
>> detach function, but the get_all_devices method seems to return an empty
>> list when looking for mdevs at the moment of resuming the VM. Looking at
>> the instance's XML file, I noticed that the mdev property remains while
>> the VM is suspended, but it disappears AFTER the whole resume function
>> is executed. I'm failing to understand why the mdev list returns empty,
>> even though the mdev property exists in the instance's XML, and also why
>> the mdev is removed from the XML after the resume function is executed.
>> With that in mind, does anyone know if there's been any attempt to solve
>> this issue since it was left on hold? If not, is there anything I should
>> know while I attempt to do so?
> I'm not sure whether this will be helpful but there is similar (or
> adjacent?) work currently in progress to handle the case of recreating
> mediated devices after a compute host reboot [2][3]. The launchpad bug
> contains some info on workarounds for this case and the proposed patch
> pulls allocation information from the placement service to recreate the
> mdevs.

Thank you for your reply!

I'm aware of that work, but I'm afraid that it unfortunately does not
relate too much to what I'm going for.

> -melanie
> [2] https://bugs.launchpad.net/nova/+bug/1900800
> [3] https://review.opendev.org/c/openstack/nova/+/810220
>> Thanks in advance.
>> Gustavo
>> [1]
>> https://opendev.org/openstack/nova/src/branch/master/nova/virt/libvirt/driver.py#L8007

More information about the openstack-discuss mailing list