Exemplo n.º 1
0
 def test_report_has_multiple_items(self, monkeypatch):
     report = ['  ;/path;VolName;root', ';/dev/path;ceph_lv;ceph_vg']
     monkeypatch.setattr(api.process, 'call', lambda x, **kw:
                         (report, '', 0))
     result = api.get_api_lvs()
     assert result[0]['lv_name'] == 'VolName'
     assert result[1]['lv_name'] == 'ceph_lv'
Exemplo n.º 2
0
def is_lv(device_name):
    """
    Boolean to detect if a device is an LV or not ...
    """
    dev_name = "/dev/" + device_name
    is_logical_volume = False
    lvs = lvm.get_api_lvs()

    if lvs is not None:
        for lv in lvs:
            if lv["lv_path"] == dev_name:
                is_logical_volume = True
                break
    return is_logical_volume
Exemplo n.º 3
0
 def test_report_has_stuff(self, monkeypatch):
     report = ['  ;/path;VolGroup00;root']
     monkeypatch.setattr(api.process, 'call', lambda x, **kw:
                         (report, '', 0))
     result = api.get_api_lvs()
     assert result[0]['lv_name'] == 'VolGroup00'
Exemplo n.º 4
0
 def test_report_is_emtpy(self, monkeypatch):
     monkeypatch.setattr(api.process, 'call', lambda x, **kw: ('', '', 0))
     assert api.get_api_lvs() == []
Exemplo n.º 5
0
 def test_report_has_multiple_items(self, monkeypatch):
     report = ['  ;/path;VolName;root', ';/dev/path;ceph_lv;ceph_vg']
     monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0))
     result = api.get_api_lvs()
     assert result[0]['lv_name'] == 'VolName'
     assert result[1]['lv_name'] == 'ceph_lv'
Exemplo n.º 6
0
 def test_report_has_stuff(self, monkeypatch):
     report = ['  ;/path;VolGroup00;root']
     monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0))
     result = api.get_api_lvs()
     assert result[0]['lv_name'] == 'VolGroup00'
Exemplo n.º 7
0
 def test_report_is_emtpy(self, monkeypatch):
     monkeypatch.setattr(api.process, 'call', lambda x: ('', '', 0))
     assert api.get_api_lvs() == []
Exemplo n.º 8
0
def get_api_lvs():
    """
    Return the list of logical volumes available in the system ...
    """
    lvs = lvm.get_api_lvs()
    return lvs
Exemplo n.º 9
0
 def monkey_populate(self):
     api.volumes_obj_create_count += 1
     for lv_item in api.get_api_lvs():
         self.append(api.Volume(**lv_item))