import threading
import zerorpc
-logging.basicConfig(level=logging.DEBUG)
+logging.basicConfig(level=logging.INFO)
class ZeroRpcApiEndpoint(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:
return ex.message
def compute_list(self, dc_name):
- logging.info("RPC CALL: compute list")
+ logging.debug("RPC CALL: compute list")
try:
if dc_name is None:
# return list with all compute nodes in all DCs
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()
def getNextIp(self):
return self.mnet.getNextIp()
+ def getAllContainers(self):
+ """
+ Returns a list with all containers within all data centers.
+ """
+ all_containers = []
+ for dc in self.dcs.itervalues():
+ all_containers += dc.listCompute()
+ return all_containers
+
def start(self):
# start
for dc in self.dcs.itervalues():
"""
assert name is not None
# no duplications
- if name in self.containers:
+ if name in [c.name for c in self.net.getAllContainers()]:
raise Exception("Container with name %s already exists." % name)
# set default parameter
if image is None:
from dcemulator.net import DCNetwork
from api.zerorpcapi import ZeroRpcApiEndpoint
-logging.basicConfig(level=logging.DEBUG)
+logging.basicConfig(level=logging.INFO)
def create_topology1():