~hopem/charms/trusty/cinder/ensure-apache-restart

« back to all changes in this revision

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

  • Committer: Liam Young
  • Date: 2015-01-09 16:02:39 UTC
  • mfrom: (65 cinder.next)
  • mto: This revision was merged to the branch mainline in revision 67.
  • Revision ID: liam.young@canonical.com-20150109160239-qldk423wxfno2ao3
Merged next in and resolved conflicts

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))