Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test Script for ucarp+nfs
#!/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