~corey.bryant/charms/trusty/ceph/render

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/storage/linux/utils.py

  • Committer: Edward Hope-Morley
  • Date: 2014-11-25 18:29:07 UTC
  • mfrom: (85.2.4 ceph)
  • Revision ID: edward.hope-morley@canonical.com-20141125182907-oyi0vts2tw6o0a5p
[niedbalski,r=hopem]

Adds sysctl config option to allow dict of
sysctl key/val pairs to be set on ceph nodes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    # sometimes sgdisk exits non-zero; this is OK, dd will clean up
31
31
    call(['sgdisk', '--zap-all', '--mbrtogpt',
32
32
          '--clear', block_device])
33
 
    dev_end = check_output(['blockdev', '--getsz', block_device])
 
33
    dev_end = check_output(['blockdev', '--getsz',
 
34
                            block_device]).decode('UTF-8')
34
35
    gpt_end = int(dev_end.split()[0]) - 100
35
36
    check_call(['dd', 'if=/dev/zero', 'of=%s' % (block_device),
36
37
                'bs=1M', 'count=1'])
47
48
        it doesn't.
48
49
    '''
49
50
    is_partition = bool(re.search(r".*[0-9]+\b", device))
50
 
    out = check_output(['mount'])
 
51
    out = check_output(['mount']).decode('UTF-8')
51
52
    if is_partition:
52
53
        return bool(re.search(device + r"\b", out))
53
54
    return bool(re.search(device + r"[0-9]+\b", out))