コード例 #1
0
        def releaseFailed(err, pp):
            log.msg(
                'Received reservation failure from Argia. CID: %s, Ports: %s -> %s'
                % (id(self), self.source_port, self.dest_port),
                system=LOG_SYSTEM)
            try:
                tree = ET.parse(process_proto.stderr)
                message = list(tree.getiterator('message'))[0].text
                argia_state = list(tree.getiterator('state'))[0].text

                if argia_state == ARGIA_PROVISIONED:
                    self.state.switchState(state.PROVISIONED)
                elif argia_state == ARGIA_TERMINATED:
                    self.state.switchState(state.TERMINATED)
                else:
                    log.msg(
                        'Unknown state returned from Argia in release faliure (%s)'
                        % message,
                        system=LOG_SYSTEM)

                d.errback(
                    error.ReleaseError('Error releasing connection: %s' %
                                       str(err)))

            except Exception, e:
                log.msg('Error handling release failure: %s' % str(e),
                        system=LOG_SYSTEM)
                self._logProcessPipes(pp)
                d.errback(
                    error.ReleaseError('Error handling release failure: %s' %
                                       str(e)))
コード例 #2
0
        def releaseConfirmed(_, pp):
            log.msg(
                'Received reservation reply from Argia. CID: %s, Ports: %s -> %s'
                % (id(self), self.source_port, self.dest_port),
                system=LOG_SYSTEM)
            try:
                tree = ET.parse(process_proto.stdout)
                argia_state = list(tree.getiterator('state'))[0].text
                argia_id = list(tree.getiterator('reservationId'))[0].text

                if argia_state in (ARGIA_RESERVED):
                    self.state.switchState(state.SCHEDULED)
                    self.argia_id = argia_id
                    d.callback(self)
                else:
                    d.errback(
                        error.ReleaseError(
                            'Got unexpected state from Argia (%s)' %
                            argia_state))
            except Exception, e:
                log.msg('Error handling release reply: %s' % str(e),
                        system=LOG_SYSTEM)
                self._logProcessPipes(pp)
                d.errback(
                    error.ReleaseError('Error handling release reply: %s' %
                                       str(e)))
コード例 #3
0
ファイル: requester.py プロジェクト: jeroenh/OpenNSA
    def releaseFailed(self, correlation_id, requester_nsa, provider_nsa,
                      global_reservation_id, connection_id, connection_state,
                      error_message):

        self.triggerCall(provider_nsa, correlation_id, 'release',
                         error.ReleaseError(error_message))
コード例 #4
0
ファイル: requester.py プロジェクト: jeroenh/OpenNSA
 def releaseRequestFailed(err):
     # invocation failed, so we error out immediately
     self.triggerCall(provider_nsa.urn(), correlation_id, 'release',
                      error.ReleaseError(err.getErrorMessage()))
コード例 #5
0
                else:
                    log.msg('Unknown state returned from Argia in release faliure (%s)' % message, system=LOG_SYSTEM)

                d.errback( error.ReleaseError('Error releasing connection: %s' % str(err)) )

            except Exception, e:
                log.msg('Error handling release failure: %s' % str(e), system=LOG_SYSTEM)
                self._logProcessPipes(pp)
                d.errback( error.ReleaseError('Error handling release failure: %s' % str(e)) )


        process_proto = ArgiaProcessProtocol()
        try:
            reactor.spawnProcess(process_proto, self.command, args=[self.command_bin, ARGIA_CMD_RELEASE, self.argia_id], path=self.command_dir)
        except OSError, e:
            return defer.fail(error.ReleaseError('Failed to invoke argia control command (%s)' % str(e)))
        process_proto.d.addCallbacks(releaseConfirmed, releaseFailed, callbackArgs=[process_proto], errbackArgs=[process_proto])

        return d


    def terminate(self):

        log.msg('Terminating reservation. CID %s' % id(self), system=LOG_SYSTEM)

        try:
            self.state.switchState(state.TERMINATING)
        except error.InvalidTransitionError as e:
            return defer.fail(e)

        self.scheduler.cancelTransition()
コード例 #6
0
                        system=LOG_SYSTEM)
                self._logProcessPipes(pp)
                d.errback(
                    error.ReleaseError('Error handling release failure: %s' %
                                       str(e)))

        process_proto = ArgiaProcessProtocol()
        try:
            reactor.spawnProcess(
                process_proto,
                self.command,
                args=[self.command_bin, ARGIA_CMD_RELEASE, self.argia_id],
                path=self.command_dir)
        except OSError, e:
            return defer.fail(
                error.ReleaseError(
                    'Failed to invoke argia control command (%s)' % str(e)))
        process_proto.d.addCallbacks(releaseConfirmed,
                                     releaseFailed,
                                     callbackArgs=[process_proto],
                                     errbackArgs=[process_proto])

        return d

    def terminate(self):

        log.msg('Terminating reservation. CID %s' % id(self),
                system=LOG_SYSTEM)

        try:
            self.state.switchState(state.TERMINATING)
        except error.StateTransitionError: