Skip to content
Snippets Groups Projects
Commit 013df8d5 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added 'getSize()' method.

parent 33868095
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,19 @@ class TapeClient(object):
def disconnect(self):
self.client.close()
def getSize(self, fsMountPoint):
cmd = "df " + fsMountPoint + " | tail -n +2"
#out = subprocess.run(cmd, shell = True, capture_output = True)
stdin, stdout, stderr = self.client.exec_command(cmd)
#res = stdout.stdout.decode('UTF-8').rstrip('\n')
res = stdout.readlines()[0]
res = ' '.join(res.split()).split(' ')
#print(res)
total = res[1]
used = res[2]
available = res[3]
return ( total, used, available)
# Test
#tc = TapeClient("192.168.56.101", 22, "root", "ibm")
......@@ -80,6 +93,8 @@ class TapeClient(object):
#tc.copy("/home/curban/store/mydir", "/home/mydir")
#tc.copy("/home/curban/store/foo2.txt", "/home/mydir/foo2.txt")
#tl = tc.getTaskList()
#fsSize = tc.getSize("/ia2_tape_stb_01")
#print(fsSize)
#tc.disconnect()
#for i in tl:
# print(i.id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment