summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>2017-08-25 01:16:46 +0300
committerDmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>2017-09-25 21:07:42 +0300
commitef820f07d19b71096e55beafa6ef3770995b2344 (patch)
treef714191cd0fa41fa44387c63d7679bfdb6e02a3d
parent6f93bdeae73940734ac485713393c7ebd3f26eb4 (diff)
handle wal and db similarly to filestore journal
ceph-disk uses the same logic for partitioning if wal and db are put on devices separate from the data device: it will use sgdisk to find the next available partition to put wal or db to. This is no different from the filestore partitioning behavior so we can just reuse this logic here fs-type option is filestore-specific so let's filter it out if bluestore is used. osd_format is a file system format for FileStore so this becomes irrelevant. also, rename least_used_journal finding function to a more generic name to handle "utility" devices (journals, WALs, db-devices etc.) Partial-Bug: #1710474 Change-Id: I483ee9dae4ce69c71ae06359d0fb96aaa1c56cbc
Notes
Notes (review): Code-Review+2: Chris MacNaughton <chris.macnaughton@canonical.com> Workflow+1: Chris MacNaughton <chris.macnaughton@canonical.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 25 Sep 2017 18:33:33 +0000 Reviewed-on: https://review.openstack.org/497686 Project: openstack/charms.ceph Branch: refs/heads/master
-rw-r--r--ceph/utils.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/ceph/utils.py b/ceph/utils.py
index 19192de..0fd3e80 100644
--- a/ceph/utils.py
+++ b/ceph/utils.py
@@ -1355,8 +1355,17 @@ def get_partitions(dev):
1355 return [] 1355 return []
1356 1356
1357 1357
1358def find_least_used_journal(journal_devices): 1358def find_least_used_utility_device(utility_devices):
1359 usages = map(lambda a: (len(get_partitions(a)), a), journal_devices) 1359 """
1360 Find a utility device which has the smallest number of partitions
1361 among other devices in the supplied list.
1362
1363 :utility_devices: A list of devices to be used for filestore journal
1364 or bluestore wal or db.
1365 :return: string device name
1366 """
1367
1368 usages = map(lambda a: (len(get_partitions(a)), a), utility_devices)
1360 least = min(usages, key=lambda t: t[0]) 1369 least = min(usages, key=lambda t: t[0])
1361 return least[1] 1370 return least[1]
1362 1371
@@ -1427,18 +1436,20 @@ def osdize_dev(dev, osd_format, osd_journal, reformat_osd=False,
1427 wal = get_devices('bluestore-wal') 1436 wal = get_devices('bluestore-wal')
1428 if wal: 1437 if wal:
1429 cmd.append('--block.wal') 1438 cmd.append('--block.wal')
1430 cmd.append(wal) 1439 least_used_wal = find_least_used_utility_device(wal)
1440 cmd.append(least_used_wal)
1431 db = get_devices('bluestore-db') 1441 db = get_devices('bluestore-db')
1432 if db: 1442 if db:
1433 cmd.append('--block.db') 1443 cmd.append('--block.db')
1434 cmd.append(db) 1444 least_used_db = find_least_used_utility_device(db)
1445 cmd.append(least_used_db)
1435 elif cmp_pkgrevno('ceph', '12.1.0') >= 0 and not bluestore: 1446 elif cmp_pkgrevno('ceph', '12.1.0') >= 0 and not bluestore:
1436 cmd.append('--filestore') 1447 cmd.append('--filestore')
1437 1448
1438 cmd.append(dev) 1449 cmd.append(dev)
1439 1450
1440 if osd_journal: 1451 if osd_journal:
1441 least_used = find_least_used_journal(osd_journal) 1452 least_used = find_least_used_utility_device(osd_journal)
1442 cmd.append(least_used) 1453 cmd.append(least_used)
1443 else: 1454 else:
1444 # Just provide the device - no other options 1455 # Just provide the device - no other options