Browse Source

Merge "Add amulet test for pci-alias"

changes/50/535350/1
Zuul 1 year ago
parent
commit
8d7b98f48d
1 changed files with 44 additions and 0 deletions
  1. 44
    0
      tests/basic_deployment.py

+ 44
- 0
tests/basic_deployment.py View File

@@ -13,6 +13,7 @@
13 13
 # limitations under the License.
14 14
 
15 15
 import amulet
16
+import json
16 17
 
17 18
 from charmhelpers.contrib.openstack.amulet.deployment import (
18 19
     OpenStackAmuletDeployment
@@ -769,6 +770,49 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
769 770
             message = "api paste config error: {}".format(ret)
770 771
             amulet.raise_status(amulet.FAIL, msg=message)
771 772
 
773
+    def test_310_pci_alias_config(self):
774
+        """Verify the pci alias data is rendered properly."""
775
+        u.log.debug('Checking pci aliases in nova config')
776
+
777
+        os_release = self._get_openstack_release_string()
778
+        if CompareOpenStackReleases(os_release) < 'kilo':
779
+            u.log.info('Skipping test, {} < kilo'.format(os_release))
780
+            return
781
+
782
+        _pci_alias1 = {
783
+            "name": "IntelNIC",
784
+            "capability_type": "pci",
785
+            "product_id": "1111",
786
+            "vendor_id": "8086",
787
+            "device_type": "type-PF"}
788
+
789
+        if CompareOpenStackReleases(os_release) >= 'ocata':
790
+            section = "pci"
791
+            key_name = "alias"
792
+        else:
793
+            section = "DEFAULT"
794
+            key_name = "pci_alias"
795
+
796
+        unit = self.nova_cc_sentry
797
+        conf = '/etc/nova/nova.conf'
798
+        self.d.configure(
799
+            'nova-cloud-controller',
800
+            {'pci-alias': json.dumps(_pci_alias1, sort_keys=True)})
801
+        self.d.sentry.wait()
802
+        ret = u.validate_config_data(
803
+            unit,
804
+            conf,
805
+            section,
806
+            {key_name: ('{"capability_type": "pci", "device_type": "type-PF", '
807
+                        '"name": "IntelNIC", "product_id": "1111", '
808
+                        '"vendor_id": "8086"}')})
809
+        if ret:
810
+            message = "PCI Alias config error in section {}: {}".format(
811
+                section,
812
+                ret)
813
+            amulet.raise_status(amulet.FAIL, msg=message)
814
+        self.d.configure('nova-cloud-controller', {'pci-alias': ''})
815
+
772 816
     def test_400_image_instance_create(self):
773 817
         """Create an image/instance, verify they exist, and delete them."""
774 818
         u.log.debug('Checking nova instance creation...')

Loading…
Cancel
Save