hyper-v rbd volume support

Ceph 16 (Pacific) will support attaching RBD images to Windows
hosts as well as Hyper-V VMs [1].

This patch updates the Hyper-V driver so that it may be able to
consume RBD volumes.

We're also updating the os-win requirement to 5.4.0. It should've
been bumped by [2], vms won't spawn without it. Note this introduces no
new or unmet direct or in-direct version dependencies and so is included
as part of this change.

[1] https://github.com/ceph/ceph/pull/33750
[2] Ibe6aff4edeb32208bc9865e9216a7432caddab2b

Implements: blueprint hyperv-rbd

Change-Id: I9ad90817648ca12f80a6b53f6ba728df15cbafab
This commit is contained in:
Lucian Petrut 2020-11-20 14:31:19 +02:00 committed by Lee Yarwood
parent 95fbbce8b2
commit f0eeba5c8c
6 changed files with 40 additions and 3 deletions

View File

@ -64,7 +64,7 @@ os-resource-classes==0.4.0
os-service-types==1.7.0
os-traits==2.5.0
os-vif==1.14.0
os-win==5.1.0
os-win==5.4.0
os-xenapi==0.3.4
osc-lib==1.10.0
oslo.cache==1.26.0

View File

@ -599,3 +599,28 @@ class SMBFSVolumeDriverTestCase(test_base.HyperVBaseTestCase):
mock_set_qos_specs.assert_called_once_with(
mock.sentinel.disk_path,
fake_total_iops_sec)
class RBDVolumeDriver(test_base.HyperVBaseTestCase):
def test_get_vol_driver(self):
self._volumeops = volumeops.VolumeOps()
self._volumeops._volutils = mock.MagicMock()
self._volumeops._vmutils = mock.Mock()
connection_info = get_fake_connection_info()
connection_info['driver_volume_type'] = 'rbd'
drv = self._volumeops._get_volume_driver(connection_info)
# Not much to test here. The Hyper-V driver volume attach code
# is mostly generic and all the RBD related plumbing is handled
# by os-brick.
#
# We'll just ensure that the RBD driver can be retrieved and that it
# has the right fields.
self.assertTrue(drv._is_block_dev)
self.assertEqual('rbd', drv._protocol)
# Hyper-V requires a virtual SCSI disk so we'll ask for a
# local attach.
self.assertEqual(dict(do_local_attach=True),
drv._extra_connector_args)

View File

@ -90,3 +90,4 @@ IOPS_BASE_SIZE = 8 * units.Ki
STORAGE_PROTOCOL_ISCSI = 'iscsi'
STORAGE_PROTOCOL_FC = 'fibre_channel'
STORAGE_PROTOCOL_SMBFS = 'smbfs'
STORAGE_PROTOCOL_RBD = 'rbd'

View File

@ -46,7 +46,8 @@ class VolumeOps(object):
self.volume_drivers = {
constants.STORAGE_PROTOCOL_SMBFS: SMBFSVolumeDriver(),
constants.STORAGE_PROTOCOL_ISCSI: ISCSIVolumeDriver(),
constants.STORAGE_PROTOCOL_FC: FCVolumeDriver()}
constants.STORAGE_PROTOCOL_FC: FCVolumeDriver(),
constants.STORAGE_PROTOCOL_RBD: RBDVolumeDriver()}
def _get_volume_driver(self, connection_info):
driver_type = connection_info.get('driver_volume_type')
@ -369,3 +370,9 @@ class SMBFSVolumeDriver(BaseVolumeDriver):
class FCVolumeDriver(BaseVolumeDriver):
_is_block_dev = True
_protocol = constants.STORAGE_PROTOCOL_FC
class RBDVolumeDriver(BaseVolumeDriver):
_is_block_dev = True
_protocol = constants.STORAGE_PROTOCOL_RBD
_extra_connector_args = dict(do_local_attach=True)

View File

@ -0,0 +1,4 @@
features:
- |
The Hyper-V driver can now attach Cinder RBD volumes. The minimum
requirements are Ceph 16 (Pacific) and Windows Server 2016.

View File

@ -55,7 +55,7 @@ os-brick>=4.2.0 # Apache-2.0
os-resource-classes>=0.4.0 # Apache-2.0
os-traits>=2.5.0 # Apache-2.0
os-vif>=1.14.0 # Apache-2.0
os-win>=5.1.0 # Apache-2.0
os-win>=5.4.0 # Apache-2.0
castellan>=0.16.0 # Apache-2.0
microversion-parse>=0.2.1 # Apache-2.0
os-xenapi>=0.3.4 # Apache-2.0