Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e915c71

Browse files
committed
lib/libtest.py updated
1 parent 3cc50a3 commit e915c71

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

lib/libtest.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from common_variable import *
88
from all_commands import *
99

10+
global container
1011
container = "false"
1112
volume = "false"
1213

@@ -27,7 +28,7 @@ def default_setup_noexit(disk_l):
2728
else:
2829
print "pool does not exist"
2930
# print "TESTPOOL",TESTPOOL
30-
log_must([[ZPOOL,"create","-f",TESTPOOL]+disk_l])
31+
log_must([[ZPOOL,"create","-f",TESTPOOL,disk_l]])
3132

3233
(out, ret) = cmdExecute([[RM,"-rf",TESTDIR]])
3334
if ret != 0:
@@ -54,7 +55,6 @@ def default_setup_noexit(disk_l):
5455
log_must([[ZFS,"create",TESTPOOL+"/"+TESTCTR+"/"+TESTFS1]])
5556
log_must([[ZFS,"set","mountpoint="+TESTDIR1,TESTPOOL+"/"+TESTCTR+"/"+TESTFS1]])
5657

57-
global container
5858
container = "false"
5959
return 0
6060

@@ -316,3 +316,23 @@ def check_version(unsupported_vers):
316316
return 0
317317
return 1
318318

319+
320+
321+
#
322+
# Simple function to get the specified property of pool. If unable to
323+
# get the property then exits.
324+
#
325+
def get_pool_prop(prop, pool) :
326+
327+
prop_val = ""
328+
if 0 == poolexists(pool) :
329+
(prop_val, ret) = cmdExecute([[ZPOOL, "get", prop, pool, "2>/dev/null"],[TAIL, "-1"],[AWK, '{print $3}']])
330+
if ret != 0 :
331+
log_note("Unable to get prop property for pool")
332+
return (prop_val, 1)
333+
else :
334+
log_note(" pool not exists : ")
335+
return (prop_val, 1)
336+
return (prop_val, ret)
337+
338+

0 commit comments

Comments
 (0)