web: say where a VM is running
authorGreg Price <price@mit.edu>
Sun, 29 Jun 2008 04:40:18 +0000 (00:40 -0400)
committerGreg Price <price@mit.edu>
Sun, 29 Jun 2008 04:40:18 +0000 (00:40 -0400)
svn path=/trunk/packages/sipb-xen-www/; revision=662

code/controls.py
code/main.py

index 050b365..1d9b824 100644 (file)
@@ -196,6 +196,13 @@ def statusInfo(machine):
     status = parseStatus(value_string)
     return status
 
+def listHost(machine):
+    """Return the host a machine is running on"""
+    out, err = remctl('control', machine.name, 'listhost', err=True)
+    if err:
+        return None
+    return out
+
 def deleteVM(machine):
     """Delete a VM."""
     remctl('control', machine.name, 'destroy', err=True)
index 7513973..c8444e8 100755 (executable)
@@ -491,6 +491,7 @@ def infoDict(username, state, machine):
         cputime = None
     else:
         main_status = dict(status[1:])
+        main_status['host'] = controls.listHost(machine)
         start_time = float(main_status.get('start_time', 0))
         uptime = datetime.timedelta(seconds=int(time.time()-start_time))
         cpu_time_float = float(main_status.get('cpu_time', 0))
@@ -507,6 +508,7 @@ def infoDict(username, state, machine):
                       'NIC_INFO',
                       ('uptime', 'uptime'),
                       ('cputime', 'CPU usage'),
+                      ('host', 'Hosted on'),
                       ('memory', 'RAM'),
                       'DISK_INFO',
                       ('state', 'state (xen format)'),