コード例 #1
0
    def get_device_number_from_device_name(self, device_name):
        matches = self._phys_dev_name_regex.findall(device_name)
        if matches:
            return matches[0]

        err_msg = _("Could not find device number for device: %s")
        raise exceptions.DiskNotFound(err_msg % device_name)
コード例 #2
0
    def _get_disk_by_number(self, disk_number, msft_disk_cls=True):
        if msft_disk_cls:
            disk = self._conn_storage.Msft_Disk(Number=disk_number)
        else:
            disk = self._conn_cimv2.Win32_DiskDrive(Index=disk_number)

        if not disk:
            err_msg = _("Could not find the disk number %s")
            raise exceptions.DiskNotFound(err_msg % disk_number)
        return disk[0]
コード例 #3
0
 def _get_disks_by_unique_id(self, unique_id, unique_id_format):
     # In some cases, multiple disks having the same unique id may be
     # exposed to the OS. This may happen if there are multiple paths
     # to the LUN and MPIO is not properly configured. This can be
     # valuable information to the caller.
     disks = self._conn_storage.Msft_Disk(UniqueId=unique_id,
                                          UniqueIdFormat=unique_id_format)
     if not disks:
         err_msg = _("Could not find any disk having unique id "
                     "'%(unique_id)s' and unique id format "
                     "'%(unique_id_format)s'")
         raise exceptions.DiskNotFound(
             err_msg %
             dict(unique_id=unique_id, unique_id_format=unique_id_format))
     return disks
コード例 #4
0
 def _get_disk(self, disk_number):
     disk = self._conn_storage.Msft_Disk(Number=disk_number)
     if not disk:
         err_msg = _("Could not find the disk number %s")
         raise exceptions.DiskNotFound(err_msg % disk_number)
     return disk[0]