Skip to content

Commit

Permalink
Merge pull request ceph#19285 from ceph/wip-rm22299
Browse files Browse the repository at this point in the history
ceph-volume Format correctly when vg/lv cannot be used

Reviewed-by: Andrew Schoen <[email protected]>
  • Loading branch information
andrewschoen authored Dec 1, 2017
2 parents b7a9c44 + d732031 commit dfe1b79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ceph-volume/ceph_volume/devices/lvm/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def prepare_device(self, arg, device_type, cluster_fsid, osd_fsid):
tags={'ceph.type': device_type})
else:
error = [
'Cannot use device (%s).',
'A vg/lv path or an existing device is needed' % arg]
'Cannot use device (%s).' % arg,
'A vg/lv path or an existing device is needed']
raise RuntimeError(' '.join(error))

raise RuntimeError('no data logical volume found with: %s' % arg)
Expand Down
9 changes: 9 additions & 0 deletions src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ def test_main_shows_prepare_subcommands(self, capsys):
assert 'Format an LVM device' in stdout


class TestPrepareDevice(object):

def test_cannot_use_device(self):
with pytest.raises(RuntimeError) as error:
lvm.prepare.Prepare([]).prepare_device(
'/dev/var/foo', 'data', 'asdf', '0')
assert 'Cannot use device (/dev/var/foo)' in str(error)
assert 'A vg/lv path or an existing device is needed' in str(error)

class TestPrepare(object):

def test_main_spits_help_with_no_arguments(self, capsys):
Expand Down

0 comments on commit dfe1b79

Please sign in to comment.