예제 #1
0
파일: callbacks.py 프로젝트: vgerak/synnefo
def update_network(network, msg, event_time, atomic_context=None):
    """Process a notification of type 'ganeti-network-status'"""
    log.debug("Processing ganeti-network-status msg: %s", msg)

    if msg['type'] != "ganeti-network-status":
        log.error("Message is of unknown type %s.", msg['type'])
        return

    opcode = msg['operation']
    status = msg['status']
    jobid = msg['jobId']
    job_fields = msg.get('job_fields', {})

    if status in rapi.JOB_STATUS_FINALIZED:
        log.info("Processing ganeti-network-status jobId: %s, operation: %s, "
                 "network: %s, status: %s", jobid, opcode, network.id, status)

    if opcode == "OP_NETWORK_SET_PARAMS":
        backend_mod.process_network_modify(network, event_time, jobid, opcode,
                                           status, job_fields)
    else:
        backend_mod.process_network_status(network, event_time, jobid, opcode,
                                           status, msg['logmsg'],
                                           atomic_context=atomic_context)

    log.debug("Done processing ganeti-network-status msg for network %s.",
              msg['network'])
예제 #2
0
def reconcile_unsynced_network(network, backend, backend_network):
    write("D: Unsynced network %s in backend %s\n" % (network, backend))
    if fix:
        write("F: Issuing OP_NETWORK_CONNECT\n")
        etime = datetime.datetime.now()
        backend_mod.process_network_status(backend_network, etime, 0,
                                           "OP_NETWORK_CONNECT", "success",
                                           "Reconciliation simulated eventd")
예제 #3
0
 def reconcile_unsynced_network(self, network, backend, backend_network):
     self.log.info("D: Unsynced network %s in backend %s", network, backend)
     if self.fix:
         self.log.info("F: Issuing OP_NETWORK_CONNECT")
         backend_network = BackendNetwork.objects.select_for_update()\
                                                 .get(id=backend_network.id)
         backend_mod.process_network_status(
             backend_network, self.event_time, 0, "OP_NETWORK_CONNECT",
             "success", "Reconciliation simulated eventd")
예제 #4
0
def reconcile_stale_network(backend_network):
    write("D: Stale DB entry for network %s in backend %s\n" %
          (backend_network.network, backend_network.backend))
    if fix:
        etime = datetime.datetime.now()
        backend_mod.process_network_status(backend_network, etime, 0,
                                           "OP_NETWORK_REMOVE", "success",
                                           "Reconciliation simulated event")
        write("F: Reconciled event: OP_NETWORK_REMOVE\n")
def reconcile_unsynced_network(network, backend, backend_network):
    write("D: Unsynced network %s in backend %s\n" % (network, backend))
    if fix:
        write("F: Issuing OP_NETWORK_CONNECT\n")
        etime = datetime.datetime.now()
        backend_mod.process_network_status(backend_network, etime, 0,
                                           "OP_NETWORK_CONNECT",
                                           "success",
                                           "Reconciliation simulated eventd")
예제 #6
0
 def reconcile_stale_network(self, backend_network):
     self.log.info("D: Stale DB entry for network %s in backend %s",
                   backend_network.network, backend_network.backend)
     if self.fix:
         backend_network = BackendNetwork.objects.select_for_update()\
                                                 .get(id=backend_network.id)
         backend_mod.process_network_status(
             backend_network, self.event_time, 0, "OP_NETWORK_REMOVE",
             "success", "Reconciliation simulated event")
         self.log.info("F: Reconciled event: OP_NETWORK_REMOVE")
def reconcile_stale_network(backend_network):
    write("D: Stale DB entry for network %s in backend %s\n" %
          (backend_network.network, backend_network.backend))
    if fix:
        etime = datetime.datetime.now()
        backend_mod.process_network_status(backend_network, etime, 0,
                                           "OP_NETWORK_REMOVE",
                                           "success",
                                           "Reconciliation simulated event")
        write("F: Reconciled event: OP_NETWORK_REMOVE\n")
예제 #8
0
 def reconcile_unsynced_network(self, network, backend, backend_network):
     self.log.info("D: Unsynced network %s in backend %s", network, backend)
     if self.fix:
         self.log.info("F: Issuing OP_NETWORK_CONNECT")
         backend_network = BackendNetwork.objects.select_for_update()\
                                                 .get(id=backend_network.id)
         backend_mod.process_network_status(
             backend_network, self.event_time, 0,
             "OP_NETWORK_CONNECT",
             "success",
             "Reconciliation simulated eventd")
예제 #9
0
 def reconcile_stale_network(self, backend_network):
     self.log.info("D: Stale DB entry for network %s in backend %s",
                   backend_network.network, backend_network.backend)
     if self.fix:
         backend_network = BackendNetwork.objects.select_for_update()\
                                                 .get(id=backend_network.id)
         backend_mod.process_network_status(
             backend_network, self.event_time, 0,
             "OP_NETWORK_REMOVE",
             "success",
             "Reconciliation simulated event")
         self.log.info("F: Reconciled event: OP_NETWORK_REMOVE")
예제 #10
0
def update_network(network, msg, event_time):
    """Process a notification of type 'ganeti-network-status'"""
    log.debug("Processing ganeti-network-status msg: %s", msg)

    if msg["type"] != "ganeti-network-status":
        log.error("Message is of unknown type %s.", msg["type"])
        return

    opcode = msg["operation"]
    status = msg["status"]
    jobid = msg["jobId"]

    if opcode == "OP_NETWORK_SET_PARAMS":
        backend.process_network_modify(
            network, event_time, jobid, opcode, status, msg["add_reserved_ips"], msg["remove_reserved_ips"]
        )
    else:
        backend.process_network_status(network, event_time, jobid, opcode, status, msg["logmsg"])

    log.debug("Done processing ganeti-network-status msg for network %s.", msg["network"])
예제 #11
0
def update_network(network, msg, event_time):
    """Process a notification of type 'ganeti-network-status'"""
    log.debug("Processing ganeti-network-status msg: %s", msg)

    if msg['type'] != "ganeti-network-status":
        log.error("Message is of unknown type %s.", msg['type'])
        return

    opcode = msg['operation']
    status = msg['status']
    jobid = msg['jobId']

    if opcode == "OP_NETWORK_SET_PARAMS":
        backend.process_network_modify(network, event_time, jobid, opcode,
                                       status, msg['add_reserved_ips'],
                                       msg['remove_reserved_ips'])
    else:
        backend.process_network_status(network, event_time, jobid, opcode,
                                       status, msg['logmsg'])

    log.debug("Done processing ganeti-network-status msg for network %s.",
              msg['network'])
예제 #12
0
def update_network(network, msg, event_time):
    """Process a notification of type 'ganeti-network-status'"""
    log.debug("Processing ganeti-network-status msg: %s", msg)

    if msg['type'] != "ganeti-network-status":
        log.error("Message is of unknown type %s.", msg['type'])
        return

    opcode = msg['operation']
    status = msg['status']
    jobid = msg['jobId']
    job_fields = msg.get('job_fields', {})

    if opcode == "OP_NETWORK_SET_PARAMS":
        backend_mod.process_network_modify(network, event_time, jobid, opcode,
                                           status, job_fields)
    else:
        backend_mod.process_network_status(network, event_time, jobid, opcode,
                                           status, msg['logmsg'])

    log.debug("Done processing ganeti-network-status msg for network %s.",
              msg['network'])