# mira004.front.sepia.ceph.com is dead
-VMMACHINES = textwrap.dedent('''\
+VM_HOSTS = textwrap.dedent('''\
vercoi01.front.sepia.ceph.com
vercoi02.front.sepia.ceph.com
vercoi03.front.sepia.ceph.com
def __init__(self, file):
self.cfgparser = ConfigParser.SafeConfigParser(
- {
- 'vmmachines': VMMACHINES,
+ defaults={
+ 'vm_hosts': VM_HOSTS,
'cachefile': CACHEFILE,
'novaclient_version': NOVACLIENT_VERSION,
}
usage = """
-Usage: vmlist [-r] [-m MACHINE]
+Usage: vmlist [-r] [-h VM_HOST]
List all KVM, LXC, and OpenStack vms known
Options:
-r, --refresh refresh cached list (cache in {cachefile})
- -m, --machine MACHINE get list from only this host, and do not cache
+ -h, --host MACHINE get list from only this host, and do not cache
""".format(cachefile=cfg.get('cachefile'))
args = docopt.docopt(usage)
cachefile = os.path.expanduser(cfg.get('cachefile'))
- if args['--refresh'] or args['--machine']:
+ if args['--refresh'] or args['--host']:
procs = []
outfiles = []
- hosts = args['--machine'] or cfg.get('vmmachines').split('\n')
+ hosts = [args['--host']] or cfg.get('vm_hosts').split('\n')
for host in hosts:
outfile = tempfile.NamedTemporaryFile()
proc = multiprocessing.Process(
outfiles.append(outfile)
proc.start()
- if not args['--machine']:
+ if not args['--host']:
# one more for nova output
outfile = tempfile.NamedTemporaryFile()
proc = multiprocessing.Process(target=list_nova, args=(outfile,))
lines.extend(fil.readlines())
lines = sorted(lines)
- if args['--machine']:
+ if args['--host']:
sys.stdout.writelines(lines)
return 0