Skip to content
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

Handle mdev devices in libvirt 7.7+ #59

Draft
wants to merge 6 commits into
base: stackhpc/wallaby
Choose a base branch
from

Conversation

jovial
Copy link

@jovial jovial commented Nov 8, 2023

This change hasn't landed upstream yet: https://review.opendev.org/c/openstack/nova/+/866158. There is a fairly long relation chain.

SeanMooney and others added 6 commits November 8, 2023 09:51
Remove _update_port_pci_binding_profile and replace its usage with
_get_pci_device_profile.

changes from yoga are due to a partial backport of
are due to a partial backport of
I9a1532e9a98f89db69b9ae3b41b06318a43519b3
which is required to resolve conflict due to the lack
of the remote managed ports feature in xena

specificaly _get_port_pci_slot was refactored to
_get_port_pci_dev

Change-Id: I34dae6fdb746205f0baa4997e69eec55634bec4d
(cherry picked from commit 8d2776f)
(cherry picked from commit 683cbd0)
(cherry picked from commit e7c2e55)
(cherry picked from commit 04086b9ce44ae5e54d4469d7040ecc159b6ebcb1)
Today Nova updates the mac_address of a direct-physical port to reflect
the MAC address of the physical device the port is bound to. But this
can only be done before the port is bound. However during migration Nova
does not update the MAC when the port is bound to a different physical
device on the destination host.

This patch extends the libvirt virt driver to provide the MAC address of
the PF in the pci_info returned to the resource tracker. This
information will be then persisted in the extra_info field of the
PciDevice object.

Then the port update logic during migration, resize, live
migration, evacuation and unshelve is also extended to record the MAC of
physical device in the port binding profile according to the device on
the destination host.

The related neutron change Ib0638f5db69cb92daf6932890cb89e83cf84f295
uses this info from the binding profile to update the mac_address field
of the port when the binding is activated.

Closes-Bug: #1942329

Change-Id: Iad5e70b43a65c076134e1874cb8e75d1ba214fde
(cherry picked from commit cd03bbc)
(cherry picked from commit 8133770)
(cherry picked from commit a340630)
(cherry picked from commit 434391b75c05adf292b752c07fb420816a92b0a9)
The existing generic restart_compute_service() call in the nova test
base class is not appropriate for the libvirt functional test that needs
to reconfigure the libvirt connection as it is not aware of the libvirt
specific mocking needed when a compute service is started.

So this patch adds a specific restart_compute_service() call
to nova.tests.functional.libvirt.base.ServersTestBase. This will be used
by a later patch testing [pci]device_spec reconfiguration scenarios.

This change showed that some of the existing libvirt functional test
used the incomplete restart_compute_service from the base class. Others
used local mocking to inject new pci config to the restart. I moved all
these to the new function and removed the local mocking.

Conflicts:
    nova/tests/functional/libvirt/base.py
    nova/tests/functional/libvirt/test_vgpu.py

Conflicts are due to not backporting the removal of double mocking
and the lack of generic mdev feature added in xena.

Change-Id: Ic717dc42ac6b6cace59d344acaf12f9d1ee35564
(cherry picked from commit 57c253a)
(cherry picked from commit f98858a)
(cherry picked from commit afc55c5)
(cherry picked from commit bcc52de5ac8c7e9d8fb733496ec1654c0d01a6f6)
This change adds functional test for operations on servers with VDPA
devices that are expected to work but currently blocked due to lack
of testing or qemu bugs.

cold-migrate, resize, evacuate,and shelve are enabled
and tested by this patch

Conflicts:
    nova/compute/api.py

The conflict was trivial related to the removal of the decorators

Closes-Bug: #1970467
Change-Id: I6e220cf3231670d156632e075fcf7701df744773
(cherry picked from commit 95f96ed)
(cherry picked from commit 0419393)
(cherry picked from commit c3092e3)
(cherry picked from commit 13f75c0d1afb43d8ea5f7305c5688fbce2298b83)
Due to a new mdev naming, we can't parse it.

Backport-only for Wallaby:
* Note on wallaby we do not have a seperate
  fixtures module so this patch is adapted
  to the old fakelibvirt location
* due to Ibccbb93352f93dba7e15e1f77be9ee0fc466fee0
  missing, we need to change the config option to
  be enabled_vgpu_types and we also need to directly
  add the assert_mdev_usage() helper method.

Change-Id: I0f785178b132dfef668829558dea9f7e674abadb
Related-Bug: #1951656
(cherry picked from commit 1852019)
(cherry picked from commit 857df72)
(cherry picked from commit a820ab50076e4ca0655e8d7a4ffc4d480c12335b)
(cherry picked from commit 726c0217ef8140a949510b0a0bbbe6e82704cd40)
(cherry picked from commit 5c852c3326c8c89cbb8c37fbc1e8baf45efcba8d)
Libvirt 7.7 changed the mdev device naming to include the parent PCI
device when listing node devices. The domain, however, will still only
see the UUID and not see the parent PCI device. Changing the parsing to
simply drop the PCI identifier is not enough as the device cannot be
found when attempting to lookup the new ID.

Modify the Libvirt Driver's _get_mediated_device_information to tolerate
different formats of the mdev name. This first uses the legacy behavior
by trying to lookup the device name that is passed in (typically
mdev_<uuid> format) and if that is not found, iterates the list of mdev
node devices until the right UUID is found and selects that one.

Note that the lookup of the mdev device by UUID are needed in order
to keep the ability to recreate assigned mediated devices on a reboot of
the compute node.

Additionally, the libvirt utils parsing method mdev_name2uuid, has
been updated to tolerate both mdev_<uuid> and mdev_<uuid>_<pciid>
formats.

Closes-Bug: 1951656

Change-Id: Ifed0fa16053228990a6a8df8d4c666521db7e329
(cherry picked from commit a28b907)
(cherry picked from commit 98d8c9e)
(cherry picked from commit db8061a56095f364bee4760a58f4416cb36e026e)
(cherry picked from commit 3f423dacd34edf9c8d628cc0acd0d2a1f3a211db)
(cherry picked from commit 4a0581ab4468cf19196bcd2081c7c02df62b9116)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants