~james-page/charms/quantal/ceph/trunk

« back to all changes in this revision

Viewing changes to hooks/hooks.py

  • Committer: James Page
  • Date: 2012-11-12 09:45:28 UTC
  • Revision ID: james.page@canonical.com-20121112094528-dken40820ik1slx1
Add feature to enabled forced reformatting of OSD devices.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
            os.unlink(keyring)
122
122
 
123
123
 
 
124
def reformat_osd():
 
125
    if utils.config_get('osd-reformat') != "":
 
126
        return True
 
127
    else:
 
128
        return False
 
129
 
 
130
 
124
131
def osdize(dev):
125
132
    if not os.path.exists(dev):
126
133
        utils.juju_log('INFO',
131
138
    if e_mountpoint != "":
132
139
        subprocess.call(['umount', e_mountpoint])
133
140
 
134
 
    if ceph.is_osd_disk(dev):
 
141
    if (ceph.is_osd_disk(dev) and not
 
142
        reformat_osd()):
135
143
        utils.juju_log('INFO',
136
144
                       'Looks like {} is already an OSD, skipping.'
137
145
                       .format(dev))