Beispiel #1
0
 def terminateFailed(err, pp):
     log.msg(
         'Received terminate failure from Argia. CID: %s, Ports: %s -> %s'
         % (id(self), self.source_port, self.dest_port),
         system=LOG_SYSTEM)
     try:
         tree = ET.parse(pp.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 terminate faliure',
                 system=LOG_SYSTEM)
         d.errback(
             error.TerminateError('Error terminating connection: %s' %
                                  str(message)))
     except Exception, e:
         log.msg('Error terminating connection in Argia: %s' % message,
                 system=LOG_SYSTEM)
         self._logProcessPipes(pp)
         d.errback(
             error.TerminateError(
                 'Error handling termination failure: %s' % str(e)))
Beispiel #2
0
 def terminateConfirmed(_, pp):
     log.msg('Received terminate reply from Argia. CID: %s, Ports: %s -> %s' % (id(self), self.source_port, self.dest_port), system=LOG_SYSTEM)
     try:
         tree = ET.parse(pp.stdout)
         argia_state = list(tree.getiterator('state'))[0].text
         if argia_state == ARGIA_TERMINATED:
             self.state.switchState(state.TERMINATED)
             self.argia_id = None
             d.callback(self)
         else:
             d.errback( error.TerminateError('Got unexpected state from Argia (%s)' % argia_state) )
     except Exception, e:
         log.msg('Error handling termination reply: %s' % str(e), system=LOG_SYSTEM)
         self._logProcessPipes(pp)
         d.errback( error.TerminateError('Error handling termination reply: %s' % str(e)) )
Beispiel #3
0
    def terminate(self):

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

        try:
            self.state.switchState(state.TERMINATING)
        except error.StateTransitionError:
            return defer.fail(
                error.TerminateError(
                    'Cannot terminate connection in state %s' % self.state()))

        self.scheduler.cancelTransition()
        d = defer.Deferred()

        def terminateConfirmed(_, pp):
            log.msg(
                'Received terminate reply from Argia. CID: %s, Ports: %s -> %s'
                % (id(self), self.source_port, self.dest_port),
                system=LOG_SYSTEM)
            try:
                tree = ET.parse(pp.stdout)
                argia_state = list(tree.getiterator('state'))[0].text
                if argia_state == ARGIA_TERMINATED:
                    self.state.switchState(state.TERMINATED)
                    self.argia_id = None
                    d.callback(self)
                else:
                    d.errback(
                        error.TerminateError(
                            'Got unexpected state from Argia (%s)' %
                            argia_state))
            except Exception, e:
                log.msg('Error handling termination reply: %s' % str(e),
                        system=LOG_SYSTEM)
                self._logProcessPipes(pp)
                d.errback(
                    error.TerminateError(
                        'Error handling termination reply: %s' % str(e)))
Beispiel #4
0
    def terminateFailed(self, correlation_id, requester_nsa, provider_nsa,
                        global_reservation_id, connection_id, connection_state,
                        error_message):

        self.triggerCall(provider_nsa, correlation_id, 'terminate',
                         error.TerminateError(error_message))
Beispiel #5
0
 def terminateRequestFailed(err):
     # invocation failed, so we error out immediately
     self.triggerCall(provider_nsa.urn(), correlation_id, 'terminate',
                      error.TerminateError(err.getErrorMessage()))
Beispiel #6
0
            try:
                tree = ET.parse(pp.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 terminate faliure', system=LOG_SYSTEM)
                d.errback( error.TerminateError('Error terminating connection: %s' % str(message)) )
            except Exception, e:
                log.msg('Error terminating connection in Argia: %s' % message, system=LOG_SYSTEM)
                self._logProcessPipes(pp)
                d.errback( error.TerminateError('Error handling termination failure: %s' % str(e)) )

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

        return d


    def query(self, query_filter):
        pass