X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=emuvim%2Fapi%2Fzerorpcapi.py;h=c6b9c700dac31de7ad763024dde8d28c3d5cccb7;hb=d47ab253c3958c8ea0c03c520ef99502935c7263;hp=28519c6b4cdf8a1aced1433b9e155b607f6a2b88;hpb=7aae68563f4ca72f321bd264215f6a58dec6c346;p=osm%2Fvim-emu.git diff --git a/emuvim/api/zerorpcapi.py b/emuvim/api/zerorpcapi.py index 28519c6..c6b9c70 100644 --- a/emuvim/api/zerorpcapi.py +++ b/emuvim/api/zerorpcapi.py @@ -7,7 +7,7 @@ import logging import threading import zerorpc -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) class ZeroRpcApiEndpoint(object): @@ -66,7 +66,7 @@ class MultiDatacenterApi(object): return ex.message def compute_action_stop(self, dc_name, compute_name): - logging.info("RPC CALL: compute stop") + logging.debug("RPC CALL: compute stop") try: return self.dcs.get(dc_name).stopCompute(compute_name) except Exception as ex: @@ -74,16 +74,25 @@ class MultiDatacenterApi(object): return ex.message def compute_list(self, dc_name): - logging.info("RPC CALL: compute list") + logging.debug("RPC CALL: compute list") try: - return [(c.name, c.IP()) - for c in self.dcs.get(dc_name).listCompute()] + if dc_name is None: + # return list with all compute nodes in all DCs + all_containers = [] + for dc in self.dcs.itervalues(): + all_containers += dc.listCompute() + return [(c.name, c.getStatus()) + for c in all_containers] + else: + # return list of compute nodes for specified DC + return [(c.name, c.getStatus()) + for c in self.dcs.get(dc_name).listCompute()] except Exception as ex: logging.exception("RPC error.") return ex.message def compute_status(self, dc_name, compute_name): - logging.info("RPC CALL: compute status") + logging.debug("RPC CALL: compute status") try: return self.dcs.get( dc_name).containers.get(compute_name).getStatus()