Merge "Nautilus no longer supports creating directory backed OSDs"
This commit is contained in:
commit
ee5de74d0a
@ -929,11 +929,13 @@ def is_osd_disk(dev):
|
||||
def start_osds(devices):
|
||||
# Scan for ceph block devices
|
||||
rescan_osd_devices()
|
||||
if cmp_pkgrevno('ceph', "0.56.6") >= 0:
|
||||
# Use ceph-disk activate for directory based OSD's
|
||||
for dev_or_path in devices:
|
||||
if os.path.exists(dev_or_path) and os.path.isdir(dev_or_path):
|
||||
subprocess.check_call(['ceph-disk', 'activate', dev_or_path])
|
||||
if (cmp_pkgrevno('ceph', '0.56.6') >= 0 and
|
||||
cmp_pkgrevno('ceph', '14.2.0') < 0):
|
||||
# Use ceph-disk activate for directory based OSD's
|
||||
for dev_or_path in devices:
|
||||
if os.path.exists(dev_or_path) and os.path.isdir(dev_or_path):
|
||||
subprocess.check_call(
|
||||
['ceph-disk', 'activate', dev_or_path])
|
||||
|
||||
|
||||
def udevadm_settle():
|
||||
@ -955,7 +957,8 @@ _client_admin_keyring = '/etc/ceph/ceph.client.admin.keyring'
|
||||
|
||||
|
||||
def is_bootstrapped():
|
||||
return os.path.exists(_client_admin_keyring)
|
||||
return os.path.exists(
|
||||
'/var/lib/ceph/mon/ceph-{}/done'.format(socket.gethostname()))
|
||||
|
||||
|
||||
def wait_for_bootstrap():
|
||||
@ -1459,6 +1462,10 @@ def osdize(dev, osd_format, osd_journal, ignore_errors=False, encrypt=False,
|
||||
ignore_errors, encrypt,
|
||||
bluestore, key_manager)
|
||||
else:
|
||||
if cmp_pkgrevno('ceph', '14.0.0') >= 0:
|
||||
log("Directory backed OSDs can not be created on Nautilus",
|
||||
level=WARNING)
|
||||
return
|
||||
osdize_dir(dev, encrypt, bluestore)
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ class CephTestCase(unittest.TestCase):
|
||||
_exists,
|
||||
_call,
|
||||
_pkgrevno):
|
||||
_pkgrevno.return_value = True
|
||||
_pkgrevno.side_effect = [1, -1]
|
||||
_isdir.return_value = False
|
||||
utils.start_osds(['/dev/sdb'])
|
||||
_isdir.assert_called_once_with('/dev/sdb')
|
||||
@ -194,6 +194,7 @@ class CephTestCase(unittest.TestCase):
|
||||
db.get.assert_called_with('osd-devices', [])
|
||||
db.set.assert_called_with('osd-devices', [])
|
||||
|
||||
@patch.object(utils, 'cmp_pkgrevno')
|
||||
@patch.object(utils, 'kv')
|
||||
@patch.object(utils.subprocess, 'check_call')
|
||||
@patch.object(utils.os.path, 'exists')
|
||||
@ -203,9 +204,11 @@ class CephTestCase(unittest.TestCase):
|
||||
@patch.object(utils, 'chownr')
|
||||
@patch.object(utils, 'ceph_user')
|
||||
def test_osdize_dir(self, _ceph_user, _chown, _mkdir,
|
||||
_cmp, _mounted, _exists, _call, _kv):
|
||||
_cmp, _mounted, _exists, _call, _kv,
|
||||
_cmp_pkgrevno):
|
||||
"""Test that the dev osd is initialized correctly"""
|
||||
db = MagicMock()
|
||||
_cmp_pkgrevno.side_effect = [-1, 1, 1, 1, 1]
|
||||
_kv.return_value = db
|
||||
db.get.return_value = []
|
||||
_ceph_user.return_value = "ceph"
|
||||
@ -220,6 +223,31 @@ class CephTestCase(unittest.TestCase):
|
||||
db.get.assert_called_with('osd-devices', [])
|
||||
db.set.assert_called_with('osd-devices', ['/srv/osd'])
|
||||
|
||||
@patch.object(utils, 'cmp_pkgrevno')
|
||||
@patch.object(utils, 'kv')
|
||||
@patch.object(utils.subprocess, 'check_call')
|
||||
@patch.object(utils.os.path, 'exists')
|
||||
@patch.object(utils, 'is_device_mounted')
|
||||
@patch.object(utils, 'cmp_pkgrevno')
|
||||
@patch.object(utils, 'mkdir')
|
||||
@patch.object(utils, 'chownr')
|
||||
@patch.object(utils, 'ceph_user')
|
||||
def test_osdize_dir_nautilus(self, _ceph_user, _chown, _mkdir,
|
||||
_cmp, _mounted, _exists, _call, _kv,
|
||||
_cmp_pkgrevno):
|
||||
"""Test that the dev osd is initialized correctly"""
|
||||
db = MagicMock()
|
||||
_cmp_pkgrevno.side_effect = [1]
|
||||
_kv.return_value = db
|
||||
db.get.return_value = []
|
||||
_ceph_user.return_value = "ceph"
|
||||
_mounted.return_value = False
|
||||
_exists.return_value = False
|
||||
_cmp.return_value = True
|
||||
utils.osdize('/srv/osd', osd_format='xfs', osd_journal=None,
|
||||
bluestore=False)
|
||||
_call.assert_not_called()
|
||||
|
||||
@patch.object(utils.subprocess, 'check_output')
|
||||
def test_get_osd_weight(self, output):
|
||||
"""It gives an OSD's weight"""
|
||||
|
Loading…
Reference in New Issue
Block a user