Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal vs external rep of disks #290

Merged
merged 3 commits into from
May 29, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions srv/salt/_modules/osd.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,8 @@ def configured(**kwargs):
if 'format' in kwargs and kwargs['format'] != 'filestore':
return []
log.debug("devices: {}".format(devices))
for device in devices:
# find real device
cmd = "readlink -f {}".format(device)
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
proc.wait()
result = proc.stdout.read().rstrip()
osds.append(result)
log.debug(pprint.pformat(result))
log.debug(pprint.pformat(proc.stderr.read()))
return osds

return devices

def list():
"""
Expand Down Expand Up @@ -322,7 +314,8 @@ def __init__(self, device, **kwargs):
filters = kwargs.get('filters', None)
# top_level_identifiier
self.tli = self._set_tli()
self.device = device
self.device = self.set_device(device)
self.by_id_path = device
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove trailing whitespace here

self.capacity = self.set_capacity()
self.size = self.set_bytes()
self.small = self._set_small()
Expand Down Expand Up @@ -361,6 +354,18 @@ def set_bytes(self):
log.error(error)
raise RuntimeError(error)

def set_device(self, device):
"""
Return the short symlink for a by-id device path
"""
cmd = "readlink -f {}".format(device)
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
proc.wait()
result = proc.stdout.read().rstrip()
log.debug(pprint.pformat(result))
log.debug(pprint.pformat(proc.stderr.read()))
return result

def set_capacity(self):
"""
Return the capacity from the mine for this disk
Expand Down Expand Up @@ -741,7 +746,9 @@ def osd_partition(self):
TODO: dmcrypt
"""
device = self.osd.device
if 'osds' in self.settings and device in self.settings['osds']:
internal_ident = self.osd.by_id_path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more trailing whitespaces.

# self.settings['osds'] holds the pillardata, hence the by-id path
if 'osds' in self.settings and internal_ident in self.settings['osds']:
if self.osd.disk_format == 'filestore':
if self.osd.journal:
# Journal on separate device
Expand Down