示例#1
0
 def get_mounts(self):
     # TODO we only support NTFS
     mounts = []
     for volume_guid, list_of_mount_points in MountManager(
     ).get_mounts_of_all_volumes().items():
         for mount_point in list_of_mount_points:
             mounts.append(
                 WindowsMount(self.get_recommended_file_system(),
                              volume_guid, mount_point))
     return mounts
示例#2
0
 def _get_mount_point_for_labels(self, block_access_path):
     mount_points = []
     for volume_guid, list_of_mount_points in MountManager(
     ).get_mounts_of_all_volumes().items():
         if volume_guid != block_access_path:
             continue
         mount_points.extend(list_of_mount_points)
     if not mount_points:
         raise LabelNotSupported(
             "label can only be managed for mounted volumes")
     return mount_points[0]
示例#3
0
 def get_label(self, block_access_path):
     mount_point = self._get_mount_point_for_labels(block_access_path)
     return MountManager().get_volume_label(mount_point)
示例#4
0
 def set_label(self, block_access_path, label):
     mount_point = self._get_mount_point_for_labels(block_access_path)
     MountManager().set_volume_label(mount_point, label)
示例#5
0
 def unmount(self, block_access_path, mount_point):
     try:
         MountManager().remove_mount_point(block_access_path, mount_point)
     except:  # diskmanagement module is a thin wrapper on top ctypes, does not differntiate error codes
         raise UnmountFailedDeviceIsBusy(block_access_path, mount_point)
示例#6
0
 def mount(self, block_access_path, mount_point, mount_options_dict={}):
     from .mount import WindowsMount
     # TODO we only support partitions
     assert 'Volume' in block_access_path
     MountManager().add_volume_mount_point(block_access_path, mount_point)
     return WindowsMount(self, block_access_path, mount_point)
示例#7
0
 def is_auto_mount(self):
     return MountManager().is_auto_mount()
示例#8
0
 def enable_auto_mount(self):
     MountManager().enable_auto_mount()
示例#9
0
 def disable_auto_mount(self):
     MountManager().disable_auto_mount()
示例#10
0
 def get_available_drive_letters(self):
     return MountManager().get_avaialable_drive_letters()
示例#11
0
 def __init__(self):
     super(WindowsMountManager, self).__init__()
     self.mount_manager = MountManager()