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'])
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")
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")
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_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 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"])
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'])
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'])