コード例 #1
0
 def _generate_snapshot_response_with_verification(self, cli_object):
     if not cli_object.FC_id:
         logger.error(
             "FlashCopy Mapping not found for target volume: {}".format(
                 cli_object.name))
         raise controller_errors.ExpectedSnapshotButFoundVolumeError(
             cli_object.name, self.endpoint)
     fcmap = self._get_fcmap_as_target_if_exists(cli_object.name)
     if fcmap is None or fcmap.copy_rate != '0':
         raise controller_errors.ExpectedSnapshotButFoundVolumeError(
             cli_object.name, self.endpoint)
     return self._generate_snapshot_response(cli_object,
                                             fcmap.source_vdisk_name)
コード例 #2
0
 def _generate_snapshot_response_with_verification(self, api_object):
     flashcopy_as_target = get_flashcopy_as_target_if_exists(api_object)
     if flashcopy_as_target is None or flashcopy_as_target.backgroundcopy != "disabled":
         raise array_errors.ExpectedSnapshotButFoundVolumeError(
             api_object.name, self.service_address)
     return self._generate_snapshot_response(
         api_object, flashcopy_as_target.sourcevolume)
コード例 #3
0
 def get_object_by_id(self, object_id, object_type):
     cli_object = self._get_cli_object_by_wwn(object_id)
     if not cli_object:
         return None
     if object_type is controller_config.SNAPSHOT_TYPE_NAME:
         if not cli_object.master_name:
             raise array_errors.ExpectedSnapshotButFoundVolumeError(
                 object_id, self.endpoint)
         return self._generate_snapshot_response(cli_object)
     return self._generate_volume_response(cli_object)
コード例 #4
0
 def _get_api_snapshot(self, snapshot_name, pool_id=None):
     logger.debug("Get snapshot : {} in pool: {}".format(snapshot_name, pool_id))
     api_snapshot = self._get_api_volume_by_name(volume_name=snapshot_name,
                                                 pool_id=pool_id)
     if not api_snapshot:
         return None
     if not is_snapshot(api_snapshot):
         logger.error(
             "FlashCopy relationship not found for target volume: {}".format(snapshot_name))
         raise array_errors.ExpectedSnapshotButFoundVolumeError(api_snapshot.name,
                                                                self.service_address)
     return api_snapshot
コード例 #5
0
 def get_object_by_id(self, object_id, object_type):
     try:
         cli_object = self._get_cli_object_by_wwn(object_id)
     except xcli_errors.IllegalValueForArgumentError as ex:
         logger.exception(ex)
         raise controller_errors.IllegalObjectID(ex.status)
     if not cli_object:
         return None
     if object_type is controller_config.SNAPSHOT_TYPE_NAME:
         if not cli_object.master_name:
             raise controller_errors.ExpectedSnapshotButFoundVolumeError(
                 object_id, self.endpoint)
         return self._generate_snapshot_response(cli_object)
     return self._generate_volume_response(cli_object)
コード例 #6
0
 def get_snapshot(self, snapshot_name, pool_id=None):
     logger.debug("Get snapshot : {}".format(snapshot_name))
     try:
         cli_snapshot = self.client.cmd.vol_list(
             vol=snapshot_name).as_single_element
     except xcli_errors.IllegalNameForObjectError as ex:
         logger.exception(ex)
         raise controller_errors.IllegalObjectName(ex.status)
     if not cli_snapshot:
         return None
     if not cli_snapshot.master_name:
         raise controller_errors.ExpectedSnapshotButFoundVolumeError(
             cli_snapshot.name, self.endpoint)
     array_snapshot = self._generate_snapshot_response(cli_snapshot)
     return array_snapshot