Created
January 11, 2016 07:42
-
-
Save 2510/ef6f0717cf65903868b8 to your computer and use it in GitHub Desktop.
Test Script for ucarp+nfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python2.7 | |
import os | |
import subprocess | |
import sys | |
import time | |
path = '/glusterfs/test.dat' | |
addresses = [ '10.0.0.1', '10.0.0.2', '10.0.0.127' ] | |
null = open('/dev/null', 'w') | |
pinger = {} | |
for address in addresses: | |
pinger[address] = subprocess.Popen(['ping', address], stdout=null, stderr=null) | |
index = 0 | |
try: | |
f = open(path, 'w') | |
while True: | |
subprocess.call(['clear']) | |
subprocess.call(['date']) | |
for address in addresses: | |
subprocess.call(['arp', address]) | |
f.write("data %d\n" % index) | |
index = index + 1 | |
f.flush() | |
os.fsync(f) | |
time.sleep(0.5) | |
finally: | |
for process in pinger.values(): | |
process.terminate() | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment