コード例 #1
0
    def _set_share_replica_error_state(self, context, method, exc,
                                       request_spec, action=None):

        LOG.warning("Failed to schedule_%(method)s: %(exc)s",
                    {'method': method, 'exc': exc})
        status_updates = {
            'status': constants.STATUS_ERROR,
            'replica_state': constants.STATUS_ERROR,
        }
        share_replica_id = request_spec.get(
            'share_instance_properties').get('id')

        # Set any snapshot instances to 'error'.
        replica_snapshots = db.share_snapshot_instance_get_all_with_filters(
            context, {'share_instance_ids': share_replica_id})
        for snapshot_instance in replica_snapshots:
            db.share_snapshot_instance_update(
                context, snapshot_instance['id'],
                {'status': constants.STATUS_ERROR})

        db.share_replica_update(context, share_replica_id, status_updates)

        if action:
            self.message_api.create(
                context, action, context.project_id,
                resource_type=message_field.Resource.SHARE_REPLICA,
                resource_id=share_replica_id, exception=exc)
コード例 #2
0
    def _set_share_replica_error_state(self, context, method, exc,
                                       request_spec):

        LOG.warning(_LW("Failed to schedule_%(method)s: %(exc)s"),
                    {'method': method, 'exc': exc})
        status_updates = {
            'status': constants.STATUS_ERROR,
            'replica_state': constants.STATUS_ERROR,
        }
        share_replica_id = request_spec.get(
            'share_instance_properties').get('id')

        db.share_replica_update(context, share_replica_id, status_updates)
コード例 #3
0
ファイル: base.py プロジェクト: bswartz/manila
def share_replica_update_db(context, share_replica_id, host):
    """Set the host and the scheduled_at field of a share replica.

    :returns: A Share Replica with the updated fields set.
    """
    now = timeutils.utcnow()
    values = {'host': host, 'scheduled_at': now}
    return db.share_replica_update(context, share_replica_id, values)
コード例 #4
0
    def create_share_replica(self, context, request_spec=None,
                             filter_properties=None):
        try:
            self.driver.schedule_create_replica(context, request_spec,
                                                filter_properties)
        except Exception as ex:
            with excutils.save_and_reraise_exception():

                msg = _LW("Failed to schedule the new share replica: %s")

                LOG.warning(msg % ex)

                db.share_replica_update(
                    context,
                    request_spec.get('share_instance_properties').get('id'),
                    {'status': constants.STATUS_ERROR,
                     'replica_state': constants.STATUS_ERROR})
コード例 #5
0
ファイル: base.py プロジェクト: openstack/manila
def share_replica_update_db(context, share_replica_id, host):
    """Set the host and the scheduled_at field of a share replica.

    :returns: A Share Replica with the updated fields set.
    """
    now = timeutils.utcnow()
    values = {'host': host, 'scheduled_at': now}
    return db.share_replica_update(context, share_replica_id, values)
コード例 #6
0
ファイル: manager.py プロジェクト: ISCAS-VDI/manila-base
    def _set_share_replica_error_state(self, context, method, exc,
                                       request_spec):

        LOG.warning(_LW("Failed to schedule_%(method)s: %(exc)s"),
                    {'method': method, 'exc': exc})
        status_updates = {
            'status': constants.STATUS_ERROR,
            'replica_state': constants.STATUS_ERROR,
        }
        share_replica_id = request_spec.get(
            'share_instance_properties').get('id')

        # Set any snapshot instances to 'error'.
        replica_snapshots = db.share_snapshot_instance_get_all_with_filters(
            context, {'share_instance_ids': share_replica_id})
        for snapshot_instance in replica_snapshots:
            db.share_snapshot_instance_update(
                context, snapshot_instance['id'],
                {'status': constants.STATUS_ERROR})

        db.share_replica_update(context, share_replica_id, status_updates)
コード例 #7
0
    def _set_share_replica_error_state(self, context, method, exc,
                                       request_spec):

        LOG.warning(_LW("Failed to schedule_%(method)s: %(exc)s"), {
            'method': method,
            'exc': exc
        })
        status_updates = {
            'status': constants.STATUS_ERROR,
            'replica_state': constants.STATUS_ERROR,
        }
        share_replica_id = request_spec.get('share_instance_properties').get(
            'id')

        # Set any snapshot instances to 'error'.
        replica_snapshots = db.share_snapshot_instance_get_all_with_filters(
            context, {'share_instance_ids': share_replica_id})
        for snapshot_instance in replica_snapshots:
            db.share_snapshot_instance_update(
                context, snapshot_instance['id'],
                {'status': constants.STATUS_ERROR})

        db.share_replica_update(context, share_replica_id, status_updates)
コード例 #8
0
ファイル: share_replicas.py プロジェクト: vkmc/manila
 def _update(self, *args, **kwargs):
     db.share_replica_update(*args, **kwargs)
コード例 #9
0
 def _update(self, *args, **kwargs):
     db.share_replica_update(*args, **kwargs)