Last change
on this file since 2503 was
2495,
checked in by adehnert, 15 years ago
|
Balance LVM requests (LP: #307361)
- Add "monocast" method to send remctl requests to exactly one
randomly-selected host.
- Send LVM requests to randomly-selected host for redundancy and
load-balancing (LP: #307361).
|
-
Property svn:executable set to
*
|
File size:
603 bytes
|
Rev | Line | |
---|
[2495] | 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 | |
---|
| 21 | if __name__ == '__main__': |
---|
| 22 | sys.exit(main(sys.argv)) |
---|
| 23 | |
---|
| 24 | # vim:et:sw=4:ts=4 |
---|
Note: See
TracBrowser
for help on using the repository browser.