source: trunk/packages/invirt-remote-server/files/usr/sbin/invirt-remote-listvms @ 1705

Last change on this file since 1705 was 1176, checked in by price, 16 years ago

sipb-xen -> invirt for remote-server

  • Property svn:executable set to *
File size: 631 bytes
Line 
1#!/usr/bin/python
2
3"""
4Collates the results of listvms from multiple VM servers.  Part of the xvm
5suite.
6"""
7
8from invirt.remote import bcast
9import sys
10import yaml
11
12def main(argv):
13    # Query each of the hosts.
14    results = filter(lambda (_, x): x is not None, bcast('listvms'))
15
16    # Merge the results and print.
17    merged = {}
18    for server, result in results:
19        for data in result.itervalues():
20            data['host'] = server
21        merged.update(result)
22
23    print yaml.dump(merged, Dumper=yaml.CSafeDumper, default_flow_style=False)
24
25if __name__ == '__main__':
26    sys.exit(main(sys.argv))
27
28# vim:et:sw=4:ts=4
Note: See TracBrowser for help on using the repository browser.