def run(args):
# Volmark from Master side
fmt_string = "!" + "B" * 19 + "II"
try:
vm = struct.unpack(fmt_string, xattr.get(
args.path,
"trusted.glusterfs.volume-mark",
nofollow=True))
print "UUID : %s" % uuid.UUID(
"".join(['%02x' % x for x in vm[2:18]]))
print "VERSION : %s.%s" % vm[0:2]
print "RETVAL : %s" % vm[18]
print "VOLUME MARK : %s.%s (%s)" % (
vm[19], vm[20], human_time("%s.%s" % (vm[19], vm[20])))
except (OSError, IOError) as e:
if e.errno == ENODATA:
pass
else:
print "[Error %s] %s" % (e.errno, os.strerror(e.errno))
sys.exit(-1)
# Volmark from slave side
all_xattrs = xattr.list(args.path)
fmt_string = "!" + "B" * 19 + "II" + "I"
volmark_xattrs = []
for x in all_xattrs:
if x.startswith("trusted.glusterfs.volume-mark."):
volmark_xattrs.append(x)
for vx in volmark_xattrs:
try:
vm = struct.unpack(fmt_string, xattr.get(
args.path,
vx))
print "UUID : %s" % uuid.UUID(
"".join(['%02x' % x for x in vm[2:18]]))
print "VERSION : %s.%s" % vm[0:2]
print "RETVAL : %s" % vm[18]
print "VOLUME MARK : %s.%s (%s)" % (
vm[19], vm[20], human_time("%s.%s" % (vm[19], vm[20])))
print "TIMEOUT : %s (%s)" % (vm[-1], human_time(vm[-1]))
except (OSError, IOError) as e:
if e.errno == ENODATA:
pass
else:
print "[Error %s] %s" % (e.errno, os.strerror(e.errno))
sys.exit(-1)
评论列表
文章目录