diff options
author | Lucian Petrut <lpetrut@cloudbasesolutions.com> | 2020-11-20 14:31:19 +0200 |
---|---|---|
committer | Lee Yarwood <lyarwood@redhat.com> | 2021-03-02 12:58:11 +0000 |
commit | f0eeba5c8c63cf78b2433df05cae90c0d9f28785 (patch) | |
tree | 69d4c1d330fdc404e0ac3c06add52ae1199df5a0 | |
parent | 95fbbce8b286cf27445ff14dcf643ede6e4d2a31 (diff) | |
download | nova-f0eeba5c8c63cf78b2433df05cae90c0d9f28785.tar.gz |
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
-rw-r--r-- | lower-constraints.txt | 2 | ||||
-rw-r--r-- | nova/tests/unit/virt/hyperv/test_volumeops.py | 25 | ||||
-rw-r--r-- | nova/virt/hyperv/constants.py | 1 | ||||
-rw-r--r-- | nova/virt/hyperv/volumeops.py | 9 | ||||
-rw-r--r-- | releasenotes/notes/rbd-hyperv-support-672a34b1d87e68eb.yaml | 4 | ||||
-rw-r--r-- | requirements.txt | 2 |
6 files changed, 40 insertions, 3 deletions
diff --git a/lower-constraints.txt b/lower-constraints.txt index b1d7d73b2d..5743295b53 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -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 diff --git a/nova/tests/unit/virt/hyperv/test_volumeops.py b/nova/tests/unit/virt/hyperv/test_volumeops.py index 630ee2d600..da7262085d 100644 --- a/nova/tests/unit/virt/hyperv/test_volumeops.py +++ b/nova/tests/unit/virt/hyperv/test_volumeops.py @@ -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) diff --git a/nova/virt/hyperv/constants.py b/nova/virt/hyperv/constants.py index 7873e1fc8a..851dd7076d 100644 --- a/nova/virt/hyperv/constants.py +++ b/nova/virt/hyperv/constants.py @@ -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' diff --git a/nova/virt/hyperv/volumeops.py b/nova/virt/hyperv/volumeops.py index d81d34ae9f..da5b40f375 100644 --- a/nova/virt/hyperv/volumeops.py +++ b/nova/virt/hyperv/volumeops.py @@ -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) diff --git a/releasenotes/notes/rbd-hyperv-support-672a34b1d87e68eb.yaml b/releasenotes/notes/rbd-hyperv-support-672a34b1d87e68eb.yaml new file mode 100644 index 0000000000..7917500f3e --- /dev/null +++ b/releasenotes/notes/rbd-hyperv-support-672a34b1d87e68eb.yaml @@ -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. diff --git a/requirements.txt b/requirements.txt index 655075042c..4d943060f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 |