def run(self, errors, error_level): errors = json.loads(errors, encoding="utf-8") if "name" not in errors: raise Exception( "Error: Instance name not provided in errors. Can not continue!" ) instance = errors["name"] vtm = Vtm(self.config, self.logger, instance) bsd = Bsd(self.config, self.logger) status = bsd.get_status(instance)[0] nodes = errors["traffic_health"]["failed_nodes"] failedPools = { pool: [node["node"] for node in nodes for pool in node["pools"]] for node in nodes for pool in node["pools"] } for pool in failedPools.keys(): nodes = vtm.get_pool_nodes(pool) if set(nodes["active"]).issubset(failedPools[pool]): self.logger.debug("Pool Dead") for vs in status["traffic_health"]["virtual_servers"]: if vs["pool"] == pool: self.logger.debug( "Putting VS: {} into maintenance.".format( vs["name"])) vtm.enable_maintenance(vs["name"], "maintenance") else: self.logger.debug("Pool not dead")
def run(self, vtm, password, address, bw, fp): bsd = Bsd(self.config, self.logger) result = bsd.addVtm(vtm, password, address, bw, fp) return result
def setup(self): self._bsd = Bsd(self._config, self._logger) self._last_errors = None
def run(self, vtm, stringify): bsd = Bsd(self.config, self.logger) result = bsd.get_bandwidth(vtm, stringify) return (True, result)
def run(self, full, deleted, stringify): bsd = Bsd(self.config, self.logger) result = bsd.list_vtms(full, deleted, stringify) return (True, result)
def run(self, vtm, bw): bsd = Bsd(self.config, self.logger) bsd.set_bandwidth(vtm, bw)
def run(self, vtm): bsd = Bsd(self.config, self.logger) result = bsd.del_vtm(vtm) return (True, result)
def setup(self): self._bsd = Bsd(self._config, self._logger) self._bw_tracker = None
def run(self, vtm, stringify): bsd = Bsd(self.config, self.logger) result = bsd.getStatus(vtm, stringify) return result
def run(self, stringify): bsd = Bsd(self.config, self.logger) result = bsd.getErrors(stringify) return result
def run(self, stringify): bsd = Bsd(self.config, self.logger) result = bsd.get_errors(stringify) return (True, result)
def run(self, vtms, cluster): bsd = Bsd(self.config, self.logger) result = bsd.get_active_vtm(vtms, cluster) if result is None: return (False, result) return (True, result)
def run(self, vtm): bsd = Bsd(self.config, self.logger) result = bsd.delVtm(vtm) return result