Exemplo n.º 1
0
 def _validate_osd_ids(self):
     unavailable_ids = [id_ for id_ in self.osd_ids if
                        not osd_id_available(id_)]
     if unavailable_ids:
         msg = ("Not all specfied OSD ids are available: {}"
                "unavailable").format(",".join(unavailable_ids))
         raise RuntimeError(msg)
Exemplo n.º 2
0
 def _validate_osd_ids(self):
     unavailable_ids = [id_ for id_ in self.osd_ids if
                        not osd_id_available(id_)]
     if unavailable_ids:
         msg = ("Not all specfied OSD ids are available: {}"
                "unavailable").format(",".join(unavailable_ids))
         raise RuntimeError(msg)
Exemplo n.º 3
0
 def test_returns_true_when_id_is_destroyed(self, monkeypatch):
     stdout = dict(nodes=[
         dict(id=0, status="destroyed"),
     ])
     stdout = ['', json.dumps(stdout)]
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: (stdout, '', 0))
     result = prepare.osd_id_available(0)
     assert result
Exemplo n.º 4
0
 def test_invalid_osd_id(self, monkeypatch):
     stdout = dict(nodes=[
         dict(id=0),
     ])
     stdout = ['', json.dumps(stdout)]
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: (stdout, '', 0))
     result = prepare.osd_id_available("foo")
     assert not result
Exemplo n.º 5
0
 def test_id_does_exist_but_not_available(self, monkeypatch):
     stdout = dict(nodes=[
         dict(id=0, status="up"),
     ])
     stdout = ['', json.dumps(stdout)]
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: (stdout, '', 0))
     result = prepare.osd_id_available(0)
     assert not result
Exemplo n.º 6
0
 def test_returns_true_when_id_is_destroyed(self, monkeypatch):
     stdout = dict(nodes=[
         dict(id=0, status="destroyed"),
     ])
     stdout = ['', json.dumps(stdout)]
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: (stdout, '', 0))
     result = prepare.osd_id_available(0)
     assert result
Exemplo n.º 7
0
 def test_invalid_osd_id(self, monkeypatch):
     stdout = dict(nodes=[
         dict(id=0),
     ])
     stdout = ['', json.dumps(stdout)]
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: (stdout, '', 0))
     result = prepare.osd_id_available("foo")
     assert not result
Exemplo n.º 8
0
 def test_id_does_exist_but_not_available(self, monkeypatch):
     stdout = dict(nodes=[
         dict(id=0, status="up"),
     ])
     stdout = ['', json.dumps(stdout)]
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: (stdout, '', 0))
     result = prepare.osd_id_available(0)
     assert not result
Exemplo n.º 9
0
 def test_returncode_is_not_zero(self, monkeypatch):
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: ('', '', 1))
     with pytest.raises(RuntimeError):
         prepare.osd_id_available(1)
Exemplo n.º 10
0
 def test_false_if_id_is_none(self):
     assert not prepare.osd_id_available(None)
Exemplo n.º 11
0
 def test_returncode_is_not_zero(self, monkeypatch):
     monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: ('', '', 1))
     with pytest.raises(RuntimeError):
         prepare.osd_id_available(1)
Exemplo n.º 12
0
 def test_false_if_id_is_none(self):
     assert not prepare.osd_id_available(None)