~1chb1n/charms/trusty/ceph-osd/stable-flip-tests-helper-syncs

« back to all changes in this revision

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

  • Committer: james.page at ubuntu
  • Date: 2015-08-10 16:33:15 UTC
  • Revision ID: james.page@ubuntu.com-20150810163315-5b5oocs7c40qcw4g
Tags: 15.07
[gnuoy] 15.07 Charm release

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
    :param block_device: str: Full path of block device to clean.
45
45
    '''
 
46
    # https://github.com/ceph/ceph/commit/fdd7f8d83afa25c4e09aaedd90ab93f3b64a677b
46
47
    # sometimes sgdisk exits non-zero; this is OK, dd will clean up
47
 
    call(['sgdisk', '--zap-all', '--mbrtogpt',
48
 
          '--clear', block_device])
 
48
    call(['sgdisk', '--zap-all', '--', block_device])
 
49
    call(['sgdisk', '--clear', '--mbrtogpt', '--', block_device])
49
50
    dev_end = check_output(['blockdev', '--getsz',
50
51
                            block_device]).decode('UTF-8')
51
52
    gpt_end = int(dev_end.split()[0]) - 100
67
68
    out = check_output(['mount']).decode('UTF-8')
68
69
    if is_partition:
69
70
        return bool(re.search(device + r"\b", out))
70
 
    return bool(re.search(device + r"[0-9]+\b", out))
 
71
    return bool(re.search(device + r"[0-9]*\b", out))