예제 #1
0
 def test_is_not_mapper_device(self, device_info):
     device_info()
     disk = device.Device("/dev/sda")
     assert not disk.is_mapper
예제 #2
0
 def test_is_ceph_disk_member_lsblk(self, device_info):
     lsblk = {"PARTLABEL": "ceph data"}
     device_info(lsblk=lsblk)
     disk = device.Device("/dev/sda")
     assert disk.is_ceph_disk_member
예제 #3
0
 def test_partition_is_encrypted_blkid(self, device_info, pvolumes):
     lsblk = {'TYPE': 'part'}
     blkid = {'TYPE': 'crypto_LUKS'}
     device_info(lsblk=lsblk, blkid=blkid)
     disk = device.Device("/dev/sda")
     assert disk.is_encrypted is True
예제 #4
0
 def test_is_mapper_device(self, device_info):
     device_info()
     disk = device.Device("/dev/mapper/foo")
     assert disk.is_mapper
예제 #5
0
 def test_is_not_acceptable_device(self, device_info):
     data = {"/dev/dm-0": {"foo": "bar"}}
     lsblk = {"TYPE": "mpath"}
     device_info(devices=data, lsblk=lsblk)
     disk = device.Device("/dev/dm-0")
     assert not disk.is_device
예제 #6
0
 def test_dm_is_mapper_device(self, device_info):
     lsblk = {"TYPE": "lvm"}
     device_info(lsblk=lsblk)
     disk = device.Device("/dev/dm-4")
     assert disk.is_mapper
예제 #7
0
    def test_partlabel_lsblk(self, device_info):
        lsblk = {"PARTLABEL": ""}
        device_info(lsblk=lsblk)
        disk = device.CephDiskDevice(device.Device("/dev/sda"))

        assert disk.partlabel == ''
예제 #8
0
 def test_device_is_not_rotational_lsblk(self, device_info):
     data = {"/dev/sda": {"rotational": "0"}}
     lsblk = {"TYPE": "device", "ROTA": "0"}
     device_info(devices=data, lsblk=lsblk)
     disk = device.Device("/dev/sda")
     assert not disk.rotational
예제 #9
0
 def test_accept_non_readonly_device(self, device_info):
     data = {"/dev/sda": {"ro": 0}}
     device_info(devices=data)
     disk = device.Device("/dev/sda")
     assert disk.available
예제 #10
0
 def test_dm_is_mapper_device(self, device_info):
     device_info()
     disk = device.Device("/dev/dm-4")
     assert disk.is_mapper
예제 #11
0
 def test_reject_readonly_device(self, device_info):
     data = {"/dev/cdrom": {"ro": 1}}
     device_info(devices=data)
     disk = device.Device("/dev/cdrom")
     assert not disk.available
예제 #12
0
 def test_accept_non_removable_device(self, device_info):
     data = {"/dev/sdb": {"removable": 0}}
     device_info(devices=data)
     disk = device.Device("/dev/sdb")
     assert disk.available
예제 #13
0
 def test_reject_removable_device(self, device_info):
     data = {"/dev/sdb": {"removable": 1}}
     device_info(devices=data)
     disk = device.Device("/dev/sdb")
     assert not disk.available
예제 #14
0
 def test_is_not_ceph_disk_member_lsblk(self, device_info):
     lsblk = {"PARTLABEL": "gluster partition"}
     device_info(lsblk=lsblk)
     disk = device.Device("/dev/sda")
     assert disk.is_ceph_disk_member is False
예제 #15
0
 def test_is_lv(self, device_info):
     data = {"lv_path": "vg/lv", "vg_name": "vg"}
     device_info(lv=data)
     disk = device.Device("vg/lv")
     assert disk.is_lv
예제 #16
0
 def test_sys_api(self, device_info):
     data = {"/dev/sda": {"foo": "bar"}}
     device_info(devices=data)
     disk = device.Device("/dev/sda")
     assert disk.sys_api
     assert "foo" in disk.sys_api
예제 #17
0
    def test_is_member_lsblk(self, device_info, label):
        lsblk = {"PARTLABEL": label}
        device_info(lsblk=lsblk)
        disk = device.CephDiskDevice(device.Device("/dev/sda"))

        assert disk.is_member is True
예제 #18
0
 def test_disk_is_device(self, device_info):
     data = {"/dev/sda": {"foo": "bar"}}
     lsblk = {"TYPE": "disk"}
     device_info(devices=data, lsblk=lsblk)
     disk = device.Device("/dev/sda")
     assert disk.is_device is True
예제 #19
0
    def test_unknown_type(self, device_info):
        lsblk = {"PARTLABEL": "gluster"}
        device_info(lsblk=lsblk)
        disk = device.CephDiskDevice(device.Device("/dev/sda"))

        assert disk.type == 'unknown'
예제 #20
0
 def test_is_lvm_memeber(self, device_info):
     data = {"/dev/sda1": {"foo": "bar"}}
     lsblk = {"TYPE": "part"}
     device_info(devices=data, lsblk=lsblk)
     disk = device.Device("/dev/sda1")
     assert not disk.is_lvm_member
예제 #21
0
 def test_is_partition(self, device_info, pvolumes):
     data = {"/dev/sda": {"foo": "bar"}}
     lsblk = {"TYPE": "part"}
     device_info(devices=data, lsblk=lsblk)
     disk = device.Device("/dev/sda")
     assert disk.is_partition
예제 #22
0
 def test_is_not_mapper_device(self, device_info):
     lsblk = {"TYPE": "disk"}
     device_info(lsblk=lsblk)
     disk = device.Device("/dev/sda")
     assert not disk.is_mapper
예제 #23
0
 def test_partition_is_not_encrypted_lsblk(self, device_info, pvolumes):
     lsblk = {'TYPE': 'part', 'FSTYPE': 'xfs'}
     device_info(lsblk=lsblk)
     disk = device.Device("/dev/sda")
     assert disk.is_encrypted is False