Skip to content

Commit

Permalink
Merge pull request #8508 from JiYou/fix-ceph-disk
Browse files Browse the repository at this point in the history
ceph-disk: do not always fail when re-using a partition

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
Loic Dachary committed Apr 11, 2016
2 parents 4e2a29a + 14a66f6 commit 0913938
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/ceph-disk/ceph_disk/main.py
Expand Up @@ -122,7 +122,7 @@ def get_ready_by_type(what):

@staticmethod
def get_ready_by_name(name):
return [x[name]['ready'] for x in PTYPE.values()]
return [x[name]['ready'] for x in PTYPE.values() if name in x]

@staticmethod
def is_regular_space(ptype):
Expand Down Expand Up @@ -1876,18 +1876,18 @@ def set_type(self):
if stat.S_ISBLK(mode):
if getattr(args, name + '_file'):
raise Error('%s is not a regular file' % name.capitalize,
geattr(args, name))
getattr(args, name))
self.type = self.DEVICE
return

if stat.S_ISREG(mode):
if getattr(args, name + '_dev'):
raise Error('%s is not a block device' % name.capitalize,
geattr(args, name))
getattr(args, name))
self.type = self.FILE

raise Error('%s %s is neither a block device nor regular file' %
(name.capitalize, geattr(args, name)))
(name.capitalize, getattr(args, name)))

def is_none(self):
return self.type == self.NONE
Expand Down Expand Up @@ -2241,8 +2241,8 @@ def set_or_create_partition(self):
self.args.lockbox)
self.partition = DevicePartition.factory(
path=None, dev=self.args.lockbox, args=self.args)
ptype = partition.get_ptype()
ready = Ptype.get_ready_by_type('lockbox')
ptype = self.partition.get_ptype()
ready = Ptype.get_ready_by_name('lockbox')
if ptype not in ready:
LOG.warning('incorrect partition UUID: %s, expected %s'
% (ptype, str(ready)))
Expand Down Expand Up @@ -2384,7 +2384,7 @@ def set_type(self):
elif stat.S_ISBLK(dmode):
self.type = self.DEVICE
else:
raise Error('not a dir or block device', args.data)
raise Error('not a dir or block device', self.args.data)

def is_file(self):
return self.type == self.FILE
Expand Down Expand Up @@ -2539,8 +2539,8 @@ def set_data_partition(self):
self.args.data)
self.partition = DevicePartition.factory(
path=None, dev=self.args.data, args=self.args)
ptype = partition.get_ptype()
ready = Ptype.get_ready_by_type('osd')
ptype = self.partition.get_ptype()
ready = Ptype.get_ready_by_name('osd')
if ptype not in ready:
LOG.warning('incorrect partition UUID: %s, expected %s'
% (ptype, str(ready)))
Expand Down

0 comments on commit 0913938

Please sign in to comment.