示例#1
0
    def reenable(self, context, vol):
        if vol['replication_status'] == 'disabled':
            msg = _("Replication is not enabled")
            raise exception.ReplicationError(reason=msg, volume_id=vol['id'])
        if vol['replication_status'] not in REENABLE_PROCEED_STATUS:
            msg = _("Replication status for volume must be inactive,"
                    " active-stopped, or error, but current status "
                    "is: %s") % vol['replication_status']
            raise exception.ReplicationError(reason=msg, volume_id=vol['id'])

        volume_utils.notify_about_replication_usage(context, vol, 'sync')
        self.volume_rpcapi.reenable_replication(context, vol)
示例#2
0
    def promote(self, context, vol):
        if vol['replication_status'] == 'disabled':
            msg = _("Replication is not enabled for volume")
            raise exception.ReplicationError(reason=msg, volume_id=vol['id'])
        if vol['replication_status'] not in PROMOTE_PROCEED_STATUS:
            msg = _("Replication status for volume must be active or "
                    "active-stopped, but current status "
                    "is: %s") % vol['replication_status']
            raise exception.ReplicationError(reason=msg, volume_id=vol['id'])

        if vol['status'] != 'available':
            msg = _("Volume status for volume must be available, but current "
                    "status is: %s") % vol['status']
            raise exception.ReplicationError(reason=msg, volume_id=vol['id'])
        volume_utils.notify_about_replication_usage(context, vol, 'promote')
        self.volume_rpcapi.promote_replica(context, vol)