Merge pull request #21455 from dmick/wip-ceph-volume

ceph-volume: Nits noticed while studying code
This commit is contained in:
Alfredo Deza 2018-04-20 20:10:31 -04:00 committed by GitHub
commit 6f60a995de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 21 deletions

View File

@ -172,7 +172,7 @@ def get_api_vgs():
Return the list of group volumes available in the system using flags to
include common metadata associated with them
Command and sample delimeted output, should look like::
Command and sample delimited output should look like::
$ vgs --noheadings --readonly --separator=';' \
-o vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free
@ -192,7 +192,7 @@ def get_api_lvs():
Return the list of logical volumes available in the system using flags to include common
metadata associated with them
Command and delimeted output, should look like::
Command and delimited output should look like::
$ lvs --noheadings --readonly --separator=';' -o lv_tags,lv_path,lv_name,vg_name
;/dev/ubuntubox-vg/root;root;ubuntubox-vg
@ -213,7 +213,7 @@ def get_api_pvs():
This will only return physical volumes set up to work with LVM.
Command and delimeted output, should look like::
Command and delimited output should look like::
$ pvs --noheadings --readonly --separator=';' -o pv_name,pv_tags,pv_uuid
/dev/sda1;;
@ -313,7 +313,7 @@ def remove_vg(vg_name):
"""
Removes a volume group.
"""
fail_msg = "Unable to remove vg %s".format(vg_name)
fail_msg = "Unable to remove vg %s" % vg_name
process.run(
[
'vgremove',
@ -329,7 +329,7 @@ def remove_pv(pv_name):
"""
Removes a physical volume.
"""
fail_msg = "Unable to remove vg %s".format(pv_name)
fail_msg = "Unable to remove vg %s" % pv_name
process.run(
[
'pvremove',
@ -359,7 +359,7 @@ def remove_lv(path):
terminal_verbose=True,
)
if returncode != 0:
raise RuntimeError("Unable to remove %s".format(path))
raise RuntimeError("Unable to remove %s" % path)
return True
@ -542,7 +542,7 @@ class Volumes(list):
def _purge(self):
"""
Deplete all the items in the list, used internally only so that we can
Delete all the items in the list, used internally only so that we can
dynamically allocate the items when filtering without the concern of
messing up the contents
"""

View File

@ -61,7 +61,7 @@ def log_descriptors(reads, process, terminal_logging):
def obfuscate(command_, on=None):
"""
Certain commands that are useful to log might contain information that
should be replaced by '*' like when creating OSDs and the keyryings are
should be replaced by '*' like when creating OSDs and the keyrings are
being passed, which should not be logged.
:param on: A string (will match a flag) or an integer (will match an index)

View File

@ -60,7 +60,7 @@ def mask_ceph_disk():
# systemctl allows using a glob like '*' for masking, but there was a bug
# in that it wouldn't allow this for service templates. This means that
# masking ceph-disk@* will not work, so we must link the service directly.
# /etc/systemd takes precendence regardless of the location of the unit
# /etc/systemd takes precedence regardless of the location of the unit
process.run(
['ln', '-sf', '/dev/null', '/etc/systemd/system/ceph-disk@.service']
)

View File

@ -179,18 +179,6 @@ def lsblk(device, columns=None, abspath=False):
return _lsblk_parser(' '.join(out))
def _lsblk_type(device):
"""
Helper function that will use the ``TYPE`` label output of ``lsblk`` to determine
if a device is a partition or disk.
It does not process the output to return a boolean, but it does process it to return the
"""
out, err, rc = process.call(
['blkid', '-s', 'PARTUUID', '-o', 'value', device]
)
return ' '.join(out).strip()
def is_device(dev):
"""
Boolean to determine if a given device is a block device (**not**