summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-09-25 15:49:38 +0000
committerGerrit Code Review <review@openstack.org>2017-09-25 15:49:38 +0000
commit6f93bdeae73940734ac485713393c7ebd3f26eb4 (patch)
tree357b40229427f405f836d03e29723e6276aab039
parente79c23d88226e059fab9cec53a495fea644575bf (diff)
parent594b6a361d07ea8a619ca874010b6f3c89c963fc (diff)
Merge "Add optional additional device types"
-rw-r--r--.gitignore1
-rw-r--r--ceph/utils.py27
-rw-r--r--tox.ini1
3 files changed, 29 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 463840f..daef4ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
7dist 7dist
8.project 8.project
9.pydevproject 9.pydevproject
10.stestr \ No newline at end of file
diff --git a/ceph/utils.py b/ceph/utils.py
index 1226549..19192de 100644
--- a/ceph/utils.py
+++ b/ceph/utils.py
@@ -51,6 +51,8 @@ from charmhelpers.core.hookenv import (
51 DEBUG, 51 DEBUG,
52 ERROR, 52 ERROR,
53 WARNING, 53 WARNING,
54 storage_get,
55 storage_list,
54) 56)
55from charmhelpers.fetch import ( 57from charmhelpers.fetch import (
56 apt_cache, 58 apt_cache,
@@ -1359,6 +1361,23 @@ def find_least_used_journal(journal_devices):
1359 return least[1] 1361 return least[1]
1360 1362
1361 1363
1364def get_devices(name):
1365 """ Merge config and juju storage based devices
1366
1367 :name: THe name of the device type, eg: wal, osd, journal
1368 :returns: Set(device names), which are strings
1369 """
1370 if config(name):
1371 devices = [l.strip() for l in config(name).split(' ')]
1372 else:
1373 devices = []
1374 storage_ids = storage_list(name)
1375 devices.extend((storage_get('location', s) for s in storage_ids))
1376 devices = filter(os.path.exists, devices)
1377
1378 return set(devices)
1379
1380
1362def osdize(dev, osd_format, osd_journal, reformat_osd=False, 1381def osdize(dev, osd_format, osd_journal, reformat_osd=False,
1363 ignore_errors=False, encrypt=False, bluestore=False): 1382 ignore_errors=False, encrypt=False, bluestore=False):
1364 if dev.startswith('/dev'): 1383 if dev.startswith('/dev'):
@@ -1405,6 +1424,14 @@ def osdize_dev(dev, osd_format, osd_journal, reformat_osd=False,
1405 # NOTE(jamespage): enable experimental bluestore support 1424 # NOTE(jamespage): enable experimental bluestore support
1406 if cmp_pkgrevno('ceph', '10.2.0') >= 0 and bluestore: 1425 if cmp_pkgrevno('ceph', '10.2.0') >= 0 and bluestore:
1407 cmd.append('--bluestore') 1426 cmd.append('--bluestore')
1427 wal = get_devices('bluestore-wal')
1428 if wal:
1429 cmd.append('--block.wal')
1430 cmd.append(wal)
1431 db = get_devices('bluestore-db')
1432 if db:
1433 cmd.append('--block.db')
1434 cmd.append(db)
1408 elif cmp_pkgrevno('ceph', '12.1.0') >= 0 and not bluestore: 1435 elif cmp_pkgrevno('ceph', '12.1.0') >= 0 and not bluestore:
1409 cmd.append('--filestore') 1436 cmd.append('--filestore')
1410 1437
diff --git a/tox.ini b/tox.ini
index b9a2be6..b51ed19 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,7 @@
1[tox] 1[tox]
2envlist = pep8,py27,py34,py35 2envlist = pep8,py27,py34,py35
3skipsdist = True 3skipsdist = True
4skip_missing_interpreters = True
4 5
5[testenv] 6[testenv]
6setenv = VIRTUAL_ENV={envdir} 7setenv = VIRTUAL_ENV={envdir}