Changeset 623 for trunk/packages/sipb-xen-remote-server/files/usr/sbin
- Timestamp:
- Jun 21, 2008, 7:56:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remote-listvms
r622 r623 10 10 import yaml 11 11 12 ###13 14 12 def main(argv): 15 13 # Query each of the server for their VMs. … … 18 16 servers = ['black-mesa.mit.edu', 'sx-blade-2.mit.edu'] 19 17 # XXX 20 pipes = [Popen(['remctl', server, 'remote', 'web', 'listvms'], stdout=PIPE) 18 pipes = [(server, 19 Popen(['remctl', server, 'remote', 'web', 'listvms'], stdout=PIPE)) 21 20 for server in servers] 22 outputs = [ p.communicate()[0] for pin pipes]23 for pin pipes:21 outputs = [(s, p.communicate()[0]) for (s, p) in pipes] 22 for (s, p) in pipes: 24 23 if p.returncode != 0: 25 raise RuntimeError(" Command '%s'returned non-zero exit status %d"26 % ( 'remctl', p.returncode))27 results = [ yaml.load(o, yaml.CSafeLoader) for oin outputs]28 results = filter(lambda x: x is not None, results)24 raise RuntimeError("remctl to host %s returned non-zero exit status %d" 25 % (s, p.returncode)) 26 results = [(s, yaml.load(o, yaml.CSafeLoader)) for (s, o) in outputs] 27 results = filter(lambda (_, x): x is not None, results) 29 28 30 29 # Merge the results and print. 31 30 merged = {} 32 for result in results: 31 for server, result in results: 32 for data in result.itervalues(): 33 data['host'] = server 33 34 merged.update(result) 34 35
Note: See TracChangeset
for help on using the changeset viewer.