diff --git a/transfer_service/tape_client.py b/transfer_service/tape_client.py index c2826cbcc566caf0bf044a8776a3d6509f50bc21..048289b2f4e759e052bdf0af3e8a2e040eeeed08 100644 --- a/transfer_service/tape_client.py +++ b/transfer_service/tape_client.py @@ -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)