3 Sends remctl commands about a running VM to the host it's running on.
6 from subprocess import PIPE, Popen, call
12 print >>sys.stderr, "usage: sipb-xen-remote-control <machine> <command>"
14 machine_name = argv[1]
17 p = Popen(['/usr/sbin/sipb-xen-remote-proxy-web', 'listvms'], stdout=PIPE)
18 output = p.communicate()[0]
20 raise RuntimeError("Command '%s' returned non-zero exit status %d"
21 % ('sipb-xen-remote-proxy-web', p.returncode))
22 vms = yaml.load(output, yaml.CSafeLoader)
24 if machine_name not in vms:
25 print >>sys.stderr, "machine '%s' is not on" % machine_name
27 host = vms[machine_name]['host']
29 return call(['remctl', host, 'remote', 'control'] + argv[1:])
31 if __name__ == '__main__':
32 sys.exit(main(sys.argv))