@@ -128,7 +128,7 @@ def __init__(self, name):
128
128
self .__type = None
129
129
self .__kblocks = None
130
130
self .__kblocks_used = None
131
- self .__kblocks_avail = None
131
+ self .__kblocks_free = None
132
132
self .__capacity = None
133
133
self .__properties = None
134
134
@@ -168,14 +168,36 @@ def update(self):
168
168
pass
169
169
self .__kblocks = info [index ]
170
170
self .__kblocks_used = info [index + 1 ]
171
- self .__kblocks_avail = info [index + 2 ]
172
- self .__capacity = info [index + 3 ]
171
+ self .__kblocks_free = info [index + 2 ]
172
+ self .__capacity = info [index + 3 ][: - 1 ] # remove the "%" off the end
173
173
174
174
def __repr__ (self ):
175
+ """
176
+ :return: the identifier used to create this object
177
+ """
178
+ return "{}" .format (self .name )
179
+
180
+ def __str__ (self ):
175
181
"""
176
182
:return: a string representing this object
177
183
"""
178
- return "{} mounted on {}" .format (self .name , self .mount_point )
184
+ result = (
185
+ "{name} mounted on {mount_point}, type: {type}\n "
186
+ " total kblocks: {kblocks}\n "
187
+ " used kblocks: {kblocks_used}\n "
188
+ " available kblocks: {kblocks_free}\n "
189
+ " remaining capacity: {capacity}\n "
190
+ " other properties: {properties}"
191
+ ).format (
192
+ name = self .name , mount_point = self .mount_point , type = self .type ,
193
+ kblocks = self .kblocks ,
194
+ kblocks_used = self .kblocks_used ,
195
+ kblocks_free = self .kblocks_free ,
196
+ capacity = self .capacity ,
197
+ properties = ', ' .join (self .properties )
198
+ )
199
+
200
+ return result
179
201
180
202
########
181
203
# PROPERTIES
@@ -198,19 +220,31 @@ def type(self):
198
220
199
221
@property
200
222
def kblocks (self ):
201
- return self .__kblocks if self .__kblocks else None
223
+ return int ( self .__kblocks ) if self .__kblocks else None
202
224
203
225
@property
204
226
def kblocks_used (self ):
205
- return self .__kblocks_used if self .__kblocks_used else None
227
+ return int (self .__kblocks_used ) if self .__kblocks_used else None
228
+
229
+ @property
230
+ def kblocks_free (self ):
231
+ return int (self .__kblocks_free ) if self .__kblocks_free else None
232
+
233
+ @property
234
+ def bytes (self ):
235
+ return 1024 * self .kblocks if self .kblocks else None
236
+
237
+ @property
238
+ def bytes_used (self ):
239
+ return 1024 * self .kblocks_used if self .kblocks_used else None
206
240
207
241
@property
208
- def kblocks_avail (self ):
209
- return self .__kblocks_avail if self .__kblocks_avail else None
242
+ def bytes_free (self ):
243
+ return 1024 * self .kblocks_free if self .kblocks_free else None
210
244
211
245
@property
212
246
def capacity (self ):
213
- return self .__capacity if self .__capacity else None
247
+ return int ( self .__capacity ) if self .__capacity else None
214
248
215
249
@property
216
250
def properties (self ):
0 commit comments