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
This commit is contained in:
Dan Smith 2019-03-28 10:08:53 -07:00
parent a991980863
commit b81fe4dbe4
4 changed files with 39 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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