VMware: Config option for default adapter type
Currently vmdk volumes are created with lsiLogic adapter. The volume may not be recognized if the guest OS does not support lsiLogic. Adding config option 'vmware_adapter_type' to specify the default adapter type for new volumes. DocImpact Added new driver config option 'vmware_adapter_type' to specify the default adapter type for new volumes created by the VMware VMDK driver. Partial-bug: #1691285 Change-Id: I2b923af59d51a8b0c94ef4e111d20958d44182b0
This commit is contained in:
parent
30431abf2a
commit
fdd49d09a6
@ -71,6 +71,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
|
||||
SNAPSHOT_DESCRIPTION = 'test snapshot'
|
||||
IMAGE_ID = 'eb87f4b0-d625-47f8-bb45-71c43b486d3a'
|
||||
IMAGE_NAME = 'image-1'
|
||||
ADAPTER_TYPE = volumeops.VirtualDiskAdapterType.BUS_LOGIC
|
||||
|
||||
def setUp(self):
|
||||
super(VMwareVcVmdkDriverTestCase, self).setUp()
|
||||
@ -92,6 +93,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
|
||||
self._config.vmware_cluster_name = self.CLUSTERS
|
||||
self._config.vmware_host_version = self.DEFAULT_VC_VERSION
|
||||
self._config.vmware_connection_pool_size = self.POOL_SIZE
|
||||
self._config.vmware_adapter_type = self.ADAPTER_TYPE
|
||||
|
||||
self._db = mock.Mock()
|
||||
self._driver = vmdk.VMwareVcVmdkDriver(configuration=self._config,
|
||||
@ -2024,7 +2026,7 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
|
||||
volume['name'])
|
||||
exp_adapter_type = (
|
||||
create_params.get(vmdk.CREATE_PARAM_ADAPTER_TYPE) or
|
||||
'lsiLogic')
|
||||
self._driver.configuration.vmware_adapter_type)
|
||||
vops.create_backing.assert_called_once_with(
|
||||
exp_backing_name,
|
||||
volume['size'] * units.Mi,
|
||||
@ -2393,7 +2395,8 @@ class VMwareVcVmdkDriverTestCase(test.TestCase):
|
||||
src_dc, src_path, dest_path, dest_dc_ref=dest_dc)
|
||||
get_storage_profile_id.assert_called_once_with(volume)
|
||||
vops.attach_disk_to_backing.assert_called_once_with(
|
||||
backing, disk_device.capacityInKB, disk_type, 'lsiLogic',
|
||||
backing, disk_device.capacityInKB, disk_type,
|
||||
self._driver.configuration.vmware_adapter_type,
|
||||
profile_id, dest_path)
|
||||
vops.update_backing_disk_uuid.assert_called_once_with(backing,
|
||||
volume['id'])
|
||||
|
@ -128,6 +128,14 @@ vmdk_opts = [
|
||||
cfg.IntOpt('vmware_connection_pool_size',
|
||||
default=10,
|
||||
help='Maximum number of connections in http connection pool.'),
|
||||
cfg.StrOpt('vmware_adapter_type',
|
||||
choices=[volumeops.VirtualDiskAdapterType.LSI_LOGIC,
|
||||
volumeops.VirtualDiskAdapterType.BUS_LOGIC,
|
||||
volumeops.VirtualDiskAdapterType.LSI_LOGIC_SAS,
|
||||
volumeops.VirtualDiskAdapterType.PARA_VIRTUAL,
|
||||
volumeops.VirtualDiskAdapterType.IDE],
|
||||
default=volumeops.VirtualDiskAdapterType.LSI_LOGIC,
|
||||
help='Default adapter type to be used for attaching volumes.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -438,8 +446,8 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
|
||||
# create a backing with single disk
|
||||
disk_type = VMwareVcVmdkDriver._get_disk_type(volume)
|
||||
size_kb = volume['size'] * units.Mi
|
||||
adapter_type = create_params.get(CREATE_PARAM_ADAPTER_TYPE,
|
||||
'lsiLogic')
|
||||
adapter_type = create_params.get(
|
||||
CREATE_PARAM_ADAPTER_TYPE, self.configuration.vmware_adapter_type)
|
||||
backing = self.volumeops.create_backing(backing_name,
|
||||
size_kb,
|
||||
disk_type,
|
||||
@ -1151,7 +1159,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
|
||||
|
||||
# Get the disk type, adapter type and size of vmdk image
|
||||
image_disk_type = ImageDiskType.PREALLOCATED
|
||||
image_adapter_type = volumeops.VirtualDiskAdapterType.LSI_LOGIC
|
||||
image_adapter_type = self.configuration.vmware_adapter_type
|
||||
image_size_in_bytes = metadata['size']
|
||||
properties = metadata['properties']
|
||||
if properties:
|
||||
@ -1560,7 +1568,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
|
||||
backing,
|
||||
disk.capacityInKB,
|
||||
VMwareVcVmdkDriver._get_disk_type(volume),
|
||||
'lsiLogic',
|
||||
self.configuration.vmware_adapter_type,
|
||||
profile_id,
|
||||
dest_path.get_descriptor_ds_file_path())
|
||||
self.volumeops.update_backing_disk_uuid(backing, volume['id'])
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- Added config option ``vmware_adapter_type`` for the VMware VMDK
|
||||
driver to specify the default adapter type for volumes in vCenter
|
||||
server.
|
Loading…
Reference in New Issue
Block a user