Make invirt-lvm lvcreate-all use sqlalchemy correctly.
[invirt/packages/invirt-remote.git] / server / usr / sbin / invirt-remote-lvm
1 #!/usr/bin/python
2
3 """
4 Run an LVM command on one host, with failover for downed hosts.
5 """
6
7 from invirt.remote import monocast
8 import sys
9 import os
10
11 def main(argv):
12     # Query each of the hosts.
13     if(os.path.exists("/etc/invirt/nolvm")):
14         sys.stderr.write("LVM operations are temporarily disabled for maintenance, sorry.\n")
15         return 2
16     result = monocast(argv[1:])
17     #print "Hostname: %s; down=%s" % (result[0], result[1])
18     sys.stdout.write(result[3]) # stdout
19     sys.stderr.write(result[4]) # stderr
20     return 0
21
22 if __name__ == '__main__':
23     sys.exit(main(sys.argv))