From 632ab6dde450c5e7b35f8817816c9d04294bd230 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Sun, 29 Jun 2008 00:40:18 -0400 Subject: [PATCH] web: say where a VM is running svn path=/trunk/packages/sipb-xen-www/; revision=662 --- code/controls.py | 7 +++++++ code/main.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/code/controls.py b/code/controls.py index 050b365..1d9b824 100644 --- a/code/controls.py +++ b/code/controls.py @@ -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) diff --git a/code/main.py b/code/main.py index 7513973..c8444e8 100755 --- a/code/main.py +++ b/code/main.py @@ -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)'), -- 1.7.9.5