From b81fe4dbe451fe4125f0e67f14f9e67bb266db4c Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 28 Mar 2019 10:08:53 -0700 Subject: [PATCH] Add image type capability flags and trait conversions This makes the base virt driver define capability flags for each of the glance-defined image types. It also adds a capability-to-trait mapping for each, causing any driver that supports a given image type to expose the corresponding trait. Related to blueprint request-filter-image-types Change-Id: Id2912a46dddee3d63ce373e4d280fad79d0128a8 --- lower-constraints.txt | 2 +- nova/virt/driver.py | 26 +++++++++++++++++++++++++- nova/virt/powervm/driver.py | 12 ++++++++++++ requirements.txt | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 166c9e7cf3..61c5d40848 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -68,7 +68,7 @@ os-brick==2.6.1 os-client-config==1.29.0 os-resource-classes==0.1.0 os-service-types==1.2.0 -os-traits==0.8.0 +os-traits==0.12.0 os-vif==1.14.0 os-win==3.0.0 os-xenapi==0.3.3 diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 3ffeeb742d..12b6123c62 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -109,7 +109,19 @@ CAPABILITY_TRAITS_MAP = { "supports_extend_volume": os_traits.COMPUTE_VOLUME_EXTEND, "supports_multiattach": os_traits.COMPUTE_VOLUME_MULTI_ATTACH, # Added in os-traits 0.8.0. - "supports_trusted_certs": os_traits.COMPUTE_TRUSTED_CERTS + "supports_trusted_certs": os_traits.COMPUTE_TRUSTED_CERTS, + + # Image type support flags, added in os-traits 0.12.0 + "supports_image_type_aki": os_traits.COMPUTE_IMAGE_TYPE_AKI, + "supports_image_type_ami": os_traits.COMPUTE_IMAGE_TYPE_AMI, + "supports_image_type_ari": os_traits.COMPUTE_IMAGE_TYPE_ARI, + "supports_image_type_iso": os_traits.COMPUTE_IMAGE_TYPE_ISO, + "supports_image_type_qcow2": os_traits.COMPUTE_IMAGE_TYPE_QCOW2, + "supports_image_type_raw": os_traits.COMPUTE_IMAGE_TYPE_RAW, + "supports_image_type_vdi": os_traits.COMPUTE_IMAGE_TYPE_VDI, + "supports_image_type_vhd": os_traits.COMPUTE_IMAGE_TYPE_VHD, + "supports_image_type_vhdx": os_traits.COMPUTE_IMAGE_TYPE_VHDX, + "supports_image_type_vmdk": os_traits.COMPUTE_IMAGE_TYPE_VMDK, } @@ -158,6 +170,18 @@ class ComputeDriver(object): "supports_extend_volume": False, "supports_multiattach": False, "supports_trusted_certs": False, + + # Image type support flags + "supports_image_type_aki": False, + "supports_image_type_ami": False, + "supports_image_type_ari": False, + "supports_image_type_iso": False, + "supports_image_type_qcow2": False, + "supports_image_type_raw": False, + "supports_image_type_vdi": False, + "supports_image_type_vhd": False, + "supports_image_type_vhdx": False, + "supports_image_type_vmdk": False, } # Indicates if this driver will rebalance nodes among compute service diff --git a/nova/virt/powervm/driver.py b/nova/virt/powervm/driver.py index 1400d61fc0..9d3e9feb4c 100644 --- a/nova/virt/powervm/driver.py +++ b/nova/virt/powervm/driver.py @@ -77,6 +77,18 @@ class PowerVMDriver(driver.ComputeDriver): 'supports_extend_volume': True, 'supports_multiattach': False, 'supports_trusted_certs': False, + + # Supported image types + "supports_image_type_aki": False, + "supports_image_type_ami": False, + "supports_image_type_ari": False, + "supports_image_type_iso": False, + "supports_image_type_qcow2": False, + "supports_image_type_raw": True, + "supports_image_type_vdi": False, + "supports_image_type_vhd": False, + "supports_image_type_vhdx": False, + "supports_image_type_vmdk": False, } super(PowerVMDriver, self).__init__(virtapi) diff --git a/requirements.txt b/requirements.txt index 32951a8fe0..05425994a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -56,7 +56,7 @@ psutil>=3.2.2 # BSD oslo.versionedobjects>=1.33.3 # Apache-2.0 os-brick>=2.6.1 # Apache-2.0 os-resource-classes>=0.1.0 # Apache-2.0 -os-traits>=0.8.0 # Apache-2.0 +os-traits>=0.12.0 # Apache-2.0 os-vif>=1.14.0 # Apache-2.0 os-win>=3.0.0 # Apache-2.0 castellan>=0.16.0 # Apache-2.0