class SixthDriveTestCase(unittest.TestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)
        self._disk = Disk(3)

    @classmethod
    def setUpClass(cls):
        super(SixthDriveTestCase, cls).setUpClass()
        if socket.gethostname() != "host-ci38":
            raise unittest.SkipTest("This test case should run only on host-ci38")

    def test_uber(self):
        self._disk.destroy_partition_table()
        self._disk.create_partition_table("mbr")
        self._disk.create_first_partition()
        volume = self._disk.get_partitions()[0].get_volume()
        volume.format()
        self.assertFalse(volume.has_drive_letter())
        volume.assign_first_available_drive_letter()
        self.assertTrue(volume.has_drive_letter())
class SixthDriveTestCase(unittest.TestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)
        self._disk = Disk(3)

    @classmethod
    def setUpClass(cls):
        super(SixthDriveTestCase, cls).setUpClass()
        if socket.gethostname() != 'host-ci38':
            raise unittest.SkipTest(
                "This test case should run only on host-ci38")

    def test_uber(self):
        self._disk.destroy_partition_table()
        self._disk.create_partition_table('mbr')
        self._disk.create_first_partition()
        volume = self._disk.get_partitions()[0].get_volume()
        volume.format()
        self.assertFalse(volume.has_drive_letter())
        volume.assign_first_available_drive_letter()
        self.assertTrue(volume.has_drive_letter())
 def setUp(self):
     unittest.TestCase.setUp(self)
     self._disk = Disk(3)
예제 #4
0
class WindowsDiskDrive(disk.DiskDrive):
    def __init__(self, storage_device, path):
        super(WindowsDiskDrive, self).__init__()
        self._storage_device = storage_device
        self._disk_object = Disk(self._storage_device.get_physical_drive_number())
        self._path = path

    @cached_method
    def get_storage_device(self):
        return self._storage_device

    @cached_method
    def get_block_access_path(self):
        return self._disk_object._path

    def is_empty(self):
        return len(self._disk_object.get_partitions()) == 0

    def get_partition_table(self):
        from .partition import WindowsMBRPartitionTable, WindowsGPTPartitionTable
        if self._disk_object.is_gpt():
            return WindowsGPTPartitionTable(self)
        return WindowsMBRPartitionTable(self)

    def delete_partition_table(self):
        self._disk_object.destroy_partition_table()

    def create_mbr_partition_table(self):
        from .partition import WindowsMBRPartitionTable
        return WindowsMBRPartitionTable.create_partition_table(self)

    def create_gpt_partition_table(self):
        from .partition import WindowsGPTPartitionTable
        return WindowsGPTPartitionTable.create_partition_table(self)

    def is_online(self):
        return self._disk_object.is_online()

    def online(self):
        return self._disk_object.online()

    def offline(self):
        return self._disk_object.offline()

    def has_read_only_attribute(self):
        return self._disk_object.is_read_only()

    def unset_read_only_attribute(self):
        self._disk_object.read_write()

    def set_read_only_attribute(self):
        self._disk_object.read_only()
예제 #5
0
 def __init__(self, storage_device, path):
     super(WindowsDiskDrive, self).__init__()
     self._storage_device = storage_device
     self._disk_object = Disk(self._storage_device.get_physical_drive_number())
     self._path = path
예제 #6
0
 def __init__(self, storage_device, path):
     super(WindowsDiskDrive, self).__init__()
     self._storage_device = storage_device
     self._disk_object = Disk(self._storage_device.get_physical_drive_number())
     self._path = path
예제 #7
0
class WindowsDiskDrive(disk.DiskDrive):
    def __init__(self, storage_device, path):
        super(WindowsDiskDrive, self).__init__()
        self._storage_device = storage_device
        self._disk_object = Disk(self._storage_device.get_physical_drive_number())
        self._path = path

    @cached_method
    def get_storage_device(self):
        return self._storage_device

    @cached_method
    def get_block_access_path(self):
        return self._disk_object._path

    def is_empty(self):
        return len(gevent_wrapper.defer(self._disk_object.get_partitions)()) == 0

    def get_partition_table(self):
        from .partition import WindowsMBRPartitionTable, WindowsGUIDPartitionTable
        if gevent_wrapper.defer(self._disk_object.is_gpt)():
            return WindowsGUIDPartitionTable(self)
        return WindowsMBRPartitionTable(self)

    def delete_partition_table(self):
        gevent_wrapper.defer(self._disk_object.destroy_partition_table)()

    def create_mbr_partition_table(self, alignment_in_bytes=None):
        from .partition import WindowsMBRPartitionTable
        return WindowsMBRPartitionTable.create_partition_table(self, alignment_in_bytes)

    def create_guid_partition_table(self, alignment_in_bytes=None):
        from .partition import WindowsGUIDPartitionTable
        return WindowsGUIDPartitionTable.create_partition_table(self, alignment_in_bytes)

    def is_online(self):
        return gevent_wrapper.defer(self._disk_object.is_online)()

    def online(self):
        return gevent_wrapper.defer(self._disk_object.online)()

    def offline(self):
        return gevent_wrapper.defer(self._disk_object.offline)()

    def has_read_only_attribute(self):
        return gevent_wrapper.defer(self._disk_object.is_read_only)()

    def unset_read_only_attribute(self):
        gevent_wrapper.defer(self._disk_object.read_write)()

    def set_read_only_attribute(self):
        gevent_wrapper.defer(self._disk_object.read_only)()

    @cached_method
    def get_block_access_paths_for_partitions(self):
        from infi.wioctl.errors import WindowsException
        try:
            return super(WindowsDiskDrive, self).get_block_access_paths_for_partitions()
        except WindowsException:
            return []

    def get_volumes_cluster_sizes(self):
        return gevent_wrapper.defer(self._disk_object._get_volumes_cluster_sizes())
 def setUp(self):
     unittest.TestCase.setUp(self)
     self._disk = Disk(3)