From 793b3e0ae9a7540f317b5bc19cf577c6217ebc83 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Mon, 4 Feb 2019 15:05:06 -0600 Subject: [PATCH] Fix horizon imports related to stein novaclient The pike novaclient contains wrs extensions were being imported by horizon during startup. Those imports fail with a stein novaclient, and so the horizon code will no longer import those files. When Horizon is moved to Stein (story 2004765) this change will end up being removed. Story: 2004751 Task: 29356 Change-Id: Ia51e8b592c58eab0df09bf9b345cbae9dbf0a319 Signed-off-by: Al Bailey --- ...1-Remove-WRS-imports-from-novaclient.patch | 70 +++++++++++++++++++ .../centos/python-django-horizon.spec | 3 + 2 files changed, 73 insertions(+) create mode 100644 openstack/python-horizon/centos/files/0001-Remove-WRS-imports-from-novaclient.patch diff --git a/openstack/python-horizon/centos/files/0001-Remove-WRS-imports-from-novaclient.patch b/openstack/python-horizon/centos/files/0001-Remove-WRS-imports-from-novaclient.patch new file mode 100644 index 00000000..ac15f269 --- /dev/null +++ b/openstack/python-horizon/centos/files/0001-Remove-WRS-imports-from-novaclient.patch @@ -0,0 +1,70 @@ +diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py +index 39a7684..e6798e9 100755 +--- a/openstack_dashboard/api/nova.py ++++ b/openstack_dashboard/api/nova.py +@@ -38,10 +38,6 @@ from novaclient.v2 import instance_action as nova_instance_action + from novaclient.v2 import list_extensions as nova_list_extensions + from novaclient.v2 import servers as nova_servers + +-# Todo (ediardo): move all wrs* and func wrappers into stx-gui +-from novaclient.v2 import wrs_pci +-from novaclient.v2 import wrs_providernets +- + from horizon import exceptions + from horizon import exceptions as horizon_exceptions + from horizon.utils import functions as utils +@@ -1123,54 +1119,6 @@ def requires_keypair(): + return features.get('requires_keypair', False) + + +-# WRS: Nova extension for provider network. +-@profiler.trace +-def provider_network_get(request, providernet_id): +- return wrs_providernets.ProviderNetsManager(novaclient(request)).get( +- providernet_id) +- +- +-# WRS: Nova extension for device usage +-@profiler.trace +-class DeviceUsage(base.APIResourceWrapper): +- """Wrapper for Inventory Device Usage""" +- _attrs = ['device_name', 'device_id', 'vendor_id', 'class_id', +- 'pci_vfs_configured', 'pci_vfs_used', +- 'pci_pfs_configured', 'pci_pfs_used'] +- +- +-@profiler.trace +-def get_device_usage_list(request): +- usages = wrs_pci.PciDevicesManager(novaclient(request)).list() +- return [DeviceUsage(n) for n in usages] +- +- +-@profiler.trace +-def get_device_usage(request, device_id): +- if device_id is None: +- raise nova_exceptions.ResourceNotFound +- +- usage = wrs_pci.PciDevicesManager(novaclient(request)).list( +- device=device_id) +- return DeviceUsage(usage[0]) +- +- +-# WRS: Nova extension for detail device usage +-@profiler.trace +-class DetailUsage(base.APIResourceWrapper): +- """Wrapper for Inventory Device Usage""" +- _attrs = ['host', +- 'pci_vfs_configured', 'pci_vfs_used', +- 'pci_pfs_configured', 'pci_pfs_used'] +- +- +-@profiler.trace +-def get_detail_usage(request, device_id): +- usages = wrs_pci.PciDevicesManager(novaclient(request)).get( +- device_id) +- return [DetailUsage(n) for n in usages] +- +- + def can_set_quotas(): + features = getattr(settings, 'OPENSTACK_HYPERVISOR_FEATURES', {}) + return features.get('enable_quotas', True) diff --git a/openstack/python-horizon/centos/python-django-horizon.spec b/openstack/python-horizon/centos/python-django-horizon.spec index 02407a8a..56acd9aa 100755 --- a/openstack/python-horizon/centos/python-django-horizon.spec +++ b/openstack/python-horizon/centos/python-django-horizon.spec @@ -30,6 +30,8 @@ Source12: horizon-region-exclusions.csv Source13: guni_config.py Source14: horizon-assets-compress +Patch1: 0001-Remove-WRS-imports-from-novaclient.patch + # # BuildArch needs to be located below patches in the spec file. Don't ask! # @@ -247,6 +249,7 @@ Customization module for OpenStack Dashboard to provide a branded logo. %prep %autosetup -n horizon-%{upstream_version} -S git +# autosetup automatically applies the patches # STX remove troublesome files introduced by tox rm -f openstack_dashboard/test/.secret_key_store