From 362b705c16b9088c234012e929fb3c2213a57e56 Mon Sep 17 00:00:00 2001 From: Matt Rabe Date: Thu, 23 Aug 2018 15:55:41 -0400 Subject: [PATCH] Support secure_boot extra_spec in _format_flavor This change enables the nova-powervm driver to accept the 'powervm:secure_boot' extra_spec and pass it down to pypowervm to build the LPAR wrapper with. Change-Id: I080065795778adee86c6cb37bcbf700a440d73b9 --- lower-constraints.txt | 2 +- nova_powervm/tests/virt/powervm/test_vm.py | 9 ++++++++- nova_powervm/virt/powervm/vm.py | 2 ++ requirements.txt | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index dda97285..e049d4bf 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -120,7 +120,7 @@ PyNaCl==1.2.1 pyOpenSSL==17.5.0 pyparsing==2.2.0 pyperclip==1.6.0 -pypowervm==1.1.16 +pypowervm==1.1.18 pyroute2==0.4.21 pytest==3.4.2 python-barbicanclient==4.5.2 diff --git a/nova_powervm/tests/virt/powervm/test_vm.py b/nova_powervm/tests/virt/powervm/test_vm.py index bac9838c..22af0af0 100644 --- a/nova_powervm/tests/virt/powervm/test_vm.py +++ b/nova_powervm/tests/virt/powervm/test_vm.py @@ -232,11 +232,18 @@ class TestVMBuilder(test.NoDBTestCase): self.assertRaises(exception.ValidationError, self.lpar_b._format_flavor, instance) + # Test secure boot set + flavor.extra_specs = {'powervm:secure_boot': '2'} + test_attrs = dict(lpar_attrs, secure_boot='2') + self.assertEqual(self.lpar_b._format_flavor(instance), test_attrs) + + # Prep for unsupported host tests + self.lpar_b.host_w.get_capability.return_value = False + # Test PPT ratio not set when rebuilding to non-supported host flavor.extra_specs = {'powervm:ppt_ratio': '1:4096'} instance.task_state = task_states.REBUILD_SPAWNING test_attrs = dict(lpar_attrs) - self.lpar_b.host_w.get_capability.return_value = False self.assertEqual(self.lpar_b._format_flavor(instance), test_attrs) self.lpar_b.host_w.get_capability.assert_called_once_with( 'physical_page_table_ratio_capable') diff --git a/nova_powervm/virt/powervm/vm.py b/nova_powervm/virt/powervm/vm.py index f5b09125..1a3d351b 100644 --- a/nova_powervm/virt/powervm/vm.py +++ b/nova_powervm/virt/powervm/vm.py @@ -161,6 +161,7 @@ class VMBuilder(object): _PVM_SRR_CAPABILITY = 'powervm:srr_capability' _PVM_PPT_RATIO = 'powervm:ppt_ratio' _PVM_ENFORCE_AFFINITY_CHECK = 'powervm:enforce_affinity_check' + _PVM_SECURE_BOOT = 'powervm:secure_boot' # Map of PowerVM extra specs to the lpar builder attributes. # '' is used for attributes that are not implemented yet. @@ -180,6 +181,7 @@ class VMBuilder(object): 'powervm:enable_lpar_metric': lpar_bldr.ENABLE_LPAR_METRIC, _PVM_PPT_RATIO: lpar_bldr.PPT_RATIO, _PVM_ENFORCE_AFFINITY_CHECK: lpar_bldr.ENFORCE_AFFINITY_CHECK, + _PVM_SECURE_BOOT: lpar_bldr.SECURE_BOOT, _PVM_UNCAPPED: None, _PVM_DED_SHAR_MODE: None, _PVM_PROC_COMPAT: None, diff --git a/requirements.txt b/requirements.txt index bed24f1c..7bdcfca3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ oslo.config>=5.2.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.utils>=3.37.0 # Apache-2.0 -pypowervm>=1.1.16 # Apache-2.0 +pypowervm>=1.1.18 # Apache-2.0 python-swiftclient>=3.2.0 # Apache-2.0 taskflow>=2.16.0 # Apache-2.0 setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL