Add attribute 'name' to class RBDVolume.
If we create backup for volume in-use, volume driver will clone a temporary volume, and create a snapshot based on the temporary volume, then create backup for the snapshot. So, the src_name passed to method _rbd_diff_transfer should be the name of the temporary volume instead of the original volume's name. In order to get this name, we need add self.name to class os_brick.initiator.linuxrbd. RBDVolume, that's because ceph provides rbd.so to cinder, but we can't get volume name from rbd.Image directly. Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info> Change-Id: Ic2732e985b75ae710da3814c2d5b2253ced74534 Closes-Bug: #1663504
This commit is contained in:
parent
10a5e3f5d5
commit
ccafe98b97
@ -110,6 +110,11 @@ class RBDVolume(object):
|
||||
client.disconnect()
|
||||
raise
|
||||
|
||||
# Ceph provides rbd.so to cinder, but we can't
|
||||
# get volume name from rbd.Image, so, we record
|
||||
# name here, so other modules can easily get
|
||||
# volume name.
|
||||
self.name = name
|
||||
self.client = client
|
||||
|
||||
def close(self):
|
||||
|
@ -156,3 +156,10 @@ class RBDVolumeIOWrapperTestCase(base.TestCase):
|
||||
linuxrbd.RBDImageMetadata(rbd_volume, 'pool', 'user', None))
|
||||
rbd_handle.close()
|
||||
self.assertEqual(1, rbd_disconnect.call_count)
|
||||
|
||||
|
||||
class RBDVolumeTestCase(base.TestCase):
|
||||
def test_name_attribute(self):
|
||||
mock_client = mock.Mock()
|
||||
rbd_volume = linuxrbd.RBDVolume(mock_client, 'volume')
|
||||
self.assertEqual('volume', rbd_volume.name)
|
||||
|
Loading…
Reference in New Issue
Block a user