From c23bda400a41adf206eaa7a269644928fd84cfc1 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 28 Jan 2021 14:34:23 +0000 Subject: [PATCH] libvirt: Remove dead code The '_prepare_pci_devices_for_use' function is Xen-specific and should have been removed in change I73305e82da5d8da548961b801a8e75fb0e8c4cf1 ("libvirt: Drop support for Xen"). Remove it now. Change-Id: Ie7dc3247a0d6526224bed1af429234cc2403a70a Signed-off-by: Stephen Finucane --- nova/virt/libvirt/driver.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 17a90ef5602b..4ddedfa3357c 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -4316,38 +4316,6 @@ class LibvirtDriver(driver.ComputeDriver): instance=instance) os.unlink(config_disk_local_path) - def _prepare_pci_devices_for_use(self, pci_devices): - # kvm , qemu support managed mode - # In managed mode, the configured device will be automatically - # detached from the host OS drivers when the guest is started, - # and then re-attached when the guest shuts down. - if CONF.libvirt.virt_type != 'xen': - # we do manual detach only for xen - return - try: - for dev in pci_devices: - libvirt_dev_addr = dev['hypervisor_name'] - libvirt_dev = \ - self._host.device_lookup_by_name(libvirt_dev_addr) - # Note(yjiang5) Spelling for 'dettach' is correct, see - # http://libvirt.org/html/libvirt-libvirt.html. - libvirt_dev.dettach() - - # Note(yjiang5): A reset of one PCI device may impact other - # devices on the same bus, thus we need two separated loops - # to detach and then reset it. - for dev in pci_devices: - libvirt_dev_addr = dev['hypervisor_name'] - libvirt_dev = \ - self._host.device_lookup_by_name(libvirt_dev_addr) - libvirt_dev.reset() - - except libvirt.libvirtError as exc: - raise exception.PciDevicePrepareFailed(id=dev['id'], - instance_uuid= - dev['instance_uuid'], - reason=str(exc)) - def _detach_pci_devices(self, guest, pci_devs): try: for dev in pci_devs: