Пример #1
0
 def discard_zero_page(self, volume):
     ldev = utils.get_ldev(volume)
     try:
         self.run_raidcom(
             'modify', 'ldev', '-ldev_id', ldev,
             '-status', 'discard_zero_page')
     except exception.HPEXPError:
         utils.output_log(315, ldev=ldev)
Пример #2
0
 def delete_volume(self, volume):
     ldev = utils.get_ldev(volume)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is not None'.
     if ldev is None:
         utils.output_log(304, method='delete_volume', id=volume['id'])
         return
     try:
         self._delete_ldev(ldev)
     except exception.HPEXPBusy:
         raise exception.HPEXPVolumeIsBusy(volume_name=volume['name'])
Пример #3
0
 def extend_volume(self, volume, new_size):
     ldev = utils.get_ldev(volume)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is None'.
     if ldev is None:
         msg = utils.output_log(613, volume_id=volume['id'])
         raise exception.HPEXPError(data=msg)
     if self.check_vvol(ldev):
         msg = utils.output_log(618, volume_id=volume['id'])
         raise exception.HPEXPError(data=msg)
     self.delete_pair(ldev)
     self.extend_ldev(ldev, volume['size'], new_size)
Пример #4
0
 def delete_snapshot(self, snapshot):
     ldev = utils.get_ldev(snapshot)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is None'.
     if ldev is None:
         utils.output_log(
             304, method='delete_snapshot', id=snapshot['id'])
         return
     try:
         self._delete_ldev(ldev)
     except exception.HPEXPBusy:
         raise exception.HPEXPSnapshotIsBusy(snapshot_name=snapshot['name'])
Пример #5
0
 def unmanage(self, volume):
     ldev = utils.get_ldev(volume)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is None'.
     if ldev is None:
         utils.output_log(304, method='unmanage', id=volume['id'])
         return
     if self.check_vvol(ldev):
         utils.output_log(
             706, volume_id=volume['id'],
             volume_type=utils.NORMAL_LDEV_TYPE)
         raise exception.HPEXPVolumeIsBusy(volume_name=volume['name'])
     try:
         self.delete_pair(ldev)
     except exception.HPEXPBusy:
         raise exception.HPEXPVolumeIsBusy(volume_name=volume['name'])
Пример #6
0
 def create_snapshot(self, snapshot):
     src_vref = self.db.volume_get(self.ctxt, snapshot['volume_id'])
     ldev = utils.get_ldev(src_vref)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is None'.
     if ldev is None:
         msg = utils.output_log(624, type='volume', id=src_vref['id'])
         raise exception.HPEXPError(data=msg)
     size = snapshot['volume_size']
     metadata = utils.get_volume_metadata(src_vref)
     new_ldev, ldev_type = self._copy_ldev(ldev, size, metadata)
     if not self.conf.hpexp_driver_cert_mode:
         self.db.snapshot_metadata_update(
             self.ctxt, snapshot['id'],
             dict(ldev=new_ldev, type=ldev_type), False)
     return {
         'provider_location': six.text_type(new_ldev),
     }
Пример #7
0
 def create_volume_from_snapshot(self, volume, snapshot):
     ldev = utils.get_ldev(snapshot)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is None'.
     if ldev is None:
         msg = utils.output_log(
             624, type='snapshot', id=snapshot['id'])
         raise exception.HPEXPError(data=msg)
     size = volume['size']
     if size != snapshot['volume_size']:
         msg = utils.output_log(
             617, type='snapshot', volume_id=volume['id'])
         raise exception.HPEXPError(data=msg)
     metadata = volume.get('metadata', {})
     new_ldev, ldev_type = self._copy_ldev(ldev, size, metadata)
     return {
         'provider_location': six.text_type(new_ldev),
         'metadata': dict(
             metadata, ldev=new_ldev, type=ldev_type,
             snapshot=snapshot['id']),
     }
Пример #8
0
 def create_cloned_volume(self, volume, src_vref):
     ldev = utils.get_ldev(src_vref)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is not None'.
     if ldev is None:
         msg = utils.output_log(624, type='volume', id=src_vref['id'])
         raise exception.HPEXPError(data=msg)
     size = volume['size']
     metadata = volume.get('metadata', {})
     if size < src_vref['size']:
         msg = utils.output_log(617, type='volume', volume_id=volume['id'])
         raise exception.HPEXPError(data=msg)
     elif size == src_vref['size']:
         new_ldev, ldev_type = self._copy_ldev(ldev, size, metadata)
     else:
         new_ldev, ldev_type = self._copy_on_host(ldev, size)
     return {
         'provider_location': six.text_type(new_ldev),
         'metadata': dict(
             metadata, ldev=new_ldev,
             type=ldev_type, volume=src_vref['id']),
     }
Пример #9
0
    def terminate_connection(self, volume, connector, **dummy_kwargs):
        targets = {
            'info': {},
            'list': [],
        }
        mapped_targets = {
            'list': [],
        }
        unmap_targets = {}

        ldev = utils.get_ldev(volume)
        if ldev is None:
            utils.output_log(302, volume_id=volume['id'])
            return
        target_ports = self.get_target_ports(connector)
        self.find_targets_from_storage(targets, connector, target_ports)
        self.find_mapped_targets_from_storage(
            mapped_targets, ldev, target_ports)

        unmap_targets['list'] = self.get_unmap_targets_list(
            targets['list'], mapped_targets['list'])
        unmap_targets['list'].sort(reverse=True)
        self.unmap_ldev(unmap_targets, ldev)
Пример #10
0
    def initialize_connection(self, volume, connector):
        targets = {
            'info': {},
            'list': [],
        }
        ldev = utils.get_ldev(volume)
        # When 'ldev' is 0, it should be true.
        # Therefore, it cannot remove 'is None'.
        if ldev is None:
            msg = utils.output_log(619, volume_id=volume['id'])
            raise exception.HPEXPError(data=msg)

        target_ports = self.get_target_ports(connector)
        if (self.find_targets_from_storage(
                targets, connector, target_ports) and
                self.conf.hpexp_group_request):
            self.create_mapping_targets(targets, connector)

        utils.require_target_existed(targets)

        targets['list'].sort()
        self.modify_target_mode(volume, targets)
        target_lun = int(self.map_ldev(targets, ldev))

        conn_info = {
            'driver_volume_type': self.driver_info['volume_type'],
            'data': self.get_properties(volume, targets, target_lun,
                                        connector),
        }

        if self.conf.hpexp_zoning_request:
            init_targ_map = self._build_initiator_target_map(
                connector, conn_info['data']['target_wwn'])
            if init_targ_map:
                conn_info['data']['initiator_target_map'] = init_targ_map

        return conn_info
Пример #11
0
 def _terminate_connection(self, volume, connector):
     try:
         self.terminate_connection(volume, connector)
     except exception.HPEXPError:
         utils.output_log(310, ldev=utils.get_ldev(volume))