Merge "RBD: Pass all monitor hosts in a single parameter"

This commit is contained in:
Zuul authored and Gerrit Code Review committed 2025-08-20 20:52:02 +00:00
commit 6069c1c320
3 files changed
+10 -8

No files matched your search

+1 -2
View File
@@ -50,8 +50,7 @@ class RBDConnectorMixin(object):
zip(
cls._sanitize_mon_hosts(monitor_ips),
monitor_ports)]
for monitor in monitors:
args += ['--mon_host', monitor]
args += ['--mon_host', (','.join(monitors))]
if conf:
args += ['--conf', conf]
@@ -30,8 +30,8 @@ class RBDConnectorTestMixin(object):
self.pool = 'fake_pool'
self.volume = 'fake_volume'
self.clustername = 'fake_ceph'
self.hosts = ['192.168.10.2']
self.ports = ['6789']
self.hosts = ['192.168.10.2', '192.168.10.3']
self.ports = ['6789', '6789']
self.keyring = "[client.cinder]\n key = test\n"
self.image_name = '%s/%s' % (self.pool, self.volume)
@@ -72,13 +72,15 @@ class TestRBDConnectorMixin(RBDConnectorTestMixin, base.TestCase):
def test_get_rbd_args(self):
res = self._conn._get_rbd_args(self.connection_properties, None)
expected = ['--id', self.user,
'--mon_host', self.hosts[0] + ':' + self.ports[0]]
'--mon_host', self.hosts[0] + ':' + self.ports[0] + ","
+ self.hosts[1] + ':' + self.ports[1]]
self.assertEqual(expected, res)
def test_get_rbd_args_with_conf(self):
res = self._conn._get_rbd_args(self.connection_properties,
mock.sentinel.conf_path)
expected = ['--id', self.user,
'--mon_host', self.hosts[0] + ':' + self.ports[0],
'--mon_host', self.hosts[0] + ':' + self.ports[0] + ","
+ self.hosts[1] + ':' + self.ports[1],
'--conf', mock.sentinel.conf_path]
self.assertEqual(expected, res)
@@ -339,8 +339,9 @@ class RBDConnectorTestCase(test_base_rbd.RBDConnectorTestMixin,
mock_execute.assert_called_once_with(
'rbd', 'unmap', '/dev/rbd0', '--id', 'fake_user', '--mon_host',
'192.168.10.2:6789', '--conf', mock.sentinel.conf,
root_helper=connector._root_helper, run_as_root=True)
'192.168.10.2:6789,192.168.10.3:6789', '--conf',
mock.sentinel.conf, root_helper=connector._root_helper,
run_as_root=True)
mock_delete.assert_called_once_with(mock.sentinel.conf)
@mock.patch.object(priv_rootwrap, 'execute', return_value=None)