Add support for rbd user
Read the rbd_user from the [powervm] section in the conf file. Use the rbd_user when creating an rbd object. This user id will be used when trying to connect to the rbd cluster. Change-Id: I4548eff8afa85e63a8ca40d819298dccffe63e26
This commit is contained in:
parent
7bbdf98ee0
commit
7add56d035
|
@ -124,7 +124,11 @@ vol_adapter_opts = [
|
|||
help="The iSCSI transport iface to use to connect to target in "
|
||||
"case offload support is desired. Do not confuse the "
|
||||
"iscsi_iface parameter to be provided here with the "
|
||||
"actual transport name.")
|
||||
"actual transport name."),
|
||||
cfg.StrOpt('rbd_user',
|
||||
default='',
|
||||
help="Refer to this user when connecting and authenticating "
|
||||
"with the Ceph RBD server.")
|
||||
]
|
||||
|
||||
# NPIV Options. Only applicable if the 'fc_attach_strategy' is set to 'npiv'.
|
||||
|
|
|
@ -91,12 +91,13 @@ class TestRBDVolumeAdapter(test_vol.TestVolumeAdapter):
|
|||
mock_udid_to_map.return_value = mock.Mock()
|
||||
mock_add_map.return_value = None
|
||||
|
||||
# Set user
|
||||
v_drv.CONF.powervm.rbd_user = 'tester'
|
||||
# Invoke
|
||||
self.vol_drv.connect_volume(mock_slot_mgr)
|
||||
|
||||
# Validate
|
||||
mock_rbd_bld_ref.assert_called_once_with(
|
||||
self.adpt, 'pool/image', tag='a_vol_id')
|
||||
self.adpt, 'pool/image', tag='a_vol_id', user='tester')
|
||||
self.assertEqual(1, mock_build_map.call_count)
|
||||
self.assertEqual(1, mock_udid_to_map.call_count)
|
||||
|
||||
|
@ -129,7 +130,7 @@ class TestRBDVolumeAdapter(test_vol.TestVolumeAdapter):
|
|||
|
||||
# Validate
|
||||
mock_rbd_bld_ref.assert_called_once_with(
|
||||
self.adpt, 'pool/image', tag='a_vol_id')
|
||||
self.adpt, 'pool/image', tag='a_vol_id', user='')
|
||||
self.assertEqual(0, mock_build_map.call_count)
|
||||
|
||||
@mock.patch('pypowervm.entities.Entry.uuid',
|
||||
|
|
|
@ -88,7 +88,8 @@ class RBDVolumeAdapter(v_driver.PowerVMVolumeAdapter):
|
|||
def _connect_volume(self, slot_mgr):
|
||||
name = self.connection_info["data"]["name"]
|
||||
volid = self.connection_info["data"]["volume_id"]
|
||||
rbd = pvm_stg.RBD.bld_ref(self.adapter, name, tag=volid)
|
||||
user = CONF.powervm.rbd_user
|
||||
rbd = pvm_stg.RBD.bld_ref(self.adapter, name, tag=volid, user=user)
|
||||
|
||||
def add_func(vios_w):
|
||||
# If the vios doesn't match, just return
|
||||
|
|
Loading…
Reference in New Issue