コード例 #1
0
    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")
コード例 #2
0
    def run(self, vtm, password, address, bw, fp):

        bsd = Bsd(self.config, self.logger)
        result = bsd.addVtm(vtm, password, address, bw, fp)
        return result
コード例 #3
0
 def setup(self):
     self._bsd = Bsd(self._config, self._logger)
     self._last_errors = None
コード例 #4
0
    def run(self, vtm, stringify):

        bsd = Bsd(self.config, self.logger)
        result = bsd.get_bandwidth(vtm, stringify)
        return (True, result)
コード例 #5
0
    def run(self, full, deleted, stringify):

        bsd = Bsd(self.config, self.logger)
        result = bsd.list_vtms(full, deleted, stringify)
        return (True, result)
コード例 #6
0
    def run(self, vtm, bw):

        bsd = Bsd(self.config, self.logger)
        bsd.set_bandwidth(vtm, bw)
コード例 #7
0
    def run(self, vtm):

        bsd = Bsd(self.config, self.logger)
        result = bsd.del_vtm(vtm)
        return (True, result)
コード例 #8
0
 def setup(self):
     self._bsd = Bsd(self._config, self._logger)
     self._bw_tracker = None
コード例 #9
0
    def run(self, vtm, stringify):

        bsd = Bsd(self.config, self.logger)
        result = bsd.getStatus(vtm, stringify)
        return result
コード例 #10
0
 def run(self, stringify):
     bsd = Bsd(self.config, self.logger)
     result = bsd.getErrors(stringify)
     return result
コード例 #11
0
 def run(self, stringify):
     bsd = Bsd(self.config, self.logger)
     result = bsd.get_errors(stringify)
     return (True, result)
コード例 #12
0
 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)
コード例 #13
0
    def run(self, vtm):

        bsd = Bsd(self.config, self.logger)
        result = bsd.delVtm(vtm)
        return result