self.mox.VerifyAll()
+ @common_mocks
+ def test_retype(self):
+ context = {}
+ diff = {'encryption': {},
+ 'extra_specs': {}}
+ fake_volume = {'name': 'testvolume',
+ 'host': 'currenthost'}
+ fake_type = 'high-IOPS'
+
+ # no support for migration
+ host = {'host': 'anotherhost'}
+ self.assertFalse(self.driver.retype(context, fake_volume,
+ fake_type, diff, host))
+ host = {'host': 'currenthost'}
+
+ # no support for changing encryption
+ diff['encryption'] = {'non-empty': 'non-empty'}
+ self.assertFalse(self.driver.retype(context, fake_volume,
+ fake_type, diff, host))
+ diff['encryption'] = {}
+
+ # no support for changing extra_specs
+ diff['extra_specs'] = {'non-empty': 'non-empty'}
+ self.assertFalse(self.driver.retype(context, fake_volume,
+ fake_type, diff, host))
+ diff['extra_specs'] = {}
+
+ self.assertTrue(self.driver.retype(context, fake_volume,
+ fake_type, diff, host))
+
def test_rbd_volume_proxy_init(self):
mock_driver = mock.Mock(name='driver')
mock_driver._connect_to_rados.return_value = (None, None)
raise exception.SnapshotIsBusy(snapshot_name=snap_name)
volume.remove_snap(snap_name)
+ def retype(self, context, volume, new_type, diff, host):
+ """Retypes a volume, allows QoS change only."""
+ LOG.debug('Retype volume request %(vol)s to be %(type)s '
+ '(host: %(host)s), diff %(diff)s.',
+ {
+ 'vol': volume['name'],
+ 'type': new_type,
+ 'host': host,
+ 'diff': diff
+ })
+
+ if volume['host'] != host['host']:
+ LOG.error(_LE('Retype with host migration not supported'))
+ return False
+
+ if diff['encryption']:
+ LOG.error(_LE('Retype of encryption type not supported'))
+ return False
+
+ if diff['extra_specs']:
+ LOG.error(_LE('Retype of extra_specs not supported'))
+ return False
+
+ return True
+
def ensure_export(self, context, volume):
"""Synchronously recreates an export for a logical volume."""
pass