except Exception as ex:
logging.exception("RPC error.")
return ex.message
+
+ def datacenter_list(self):
+ logging.debug("RPC CALL: datacenter list")
+ try:
+ return [d.getStatus() for d in self.dcs.itervalues()]
+ except Exception as ex:
+ logging.exception("RPC error.")
+ return ex.message
parser = argparse.ArgumentParser(description='son-emu compute')
parser.add_argument(
"command",
- help="Action to be executed: start|stop|list")
+ choices=['start', 'stop', 'list', 'status'],
+ help="Action to be executed.")
parser.add_argument(
"--datacenter", "-d", dest="datacenter",
help="Data center to in which the compute instance should be executed")
import sys
import compute
import network
+import datacenter
def main():
compute.main(sys.argv[2:])
elif sys.argv[1] == "network":
network.main(sys.argv[2:])
+ elif sys.argv[1] == "datacenter":
+ datacenter.main(sys.argv[2:])
if __name__ == '__main__':
main()
data center.
"""
return list(self.containers.itervalues())
+
+ def getStatus(self):
+ """
+ Return a dict with status information about this DC.
+ """
+ return {"label": self.label}