Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More client changes

make pool a variable, so you can change it in one place instead of each
jsonrequest call.

Signed-off-by: Andy Grover <agrover@redhat.com>
  • Loading branch information...
commit e1dbcd5be1568afeaca6af229878ab58f951bf1d 1 parent 3151963
@agrover authored
Showing with 18 additions and 11 deletions.
  1. +18 −11 client
View
29 client
@@ -45,6 +45,7 @@ port = 18700
path = '/targetrpc'
id = 1
ssl = False
+pool = 'vg-targetd'
def jsonrequest(method, params=None):
print "+"*20, method
@@ -96,38 +97,44 @@ def jsonrequest(method, params=None):
results = jsonrequest("export_list")
for result in results:
- print "export", result['initiator_wwn'], result['pool'], result['vol'], result['lun']
+ print "export", result['initiator_wwn'], result['pool'], result['vol_name'], result['lun']
+
+#sys.exit(1)
results = jsonrequest("pool_list")
for result in results:
print "pool", result['name'], result['size'], result['free_size']
-results = jsonrequest("vol_list", dict(pool="test"))
+results = jsonrequest("vol_list", dict(pool=pool))
for result in results:
- print "vol", result['name'], result['size']
+ print "vol", result['name'], result['size'], result['uuid']
-sys.exit(1)
+#sys.exit(1)
try:
- jsonrequest('vol_create', dict(pool="test", name="test2", size=4000000))
+ jsonrequest('vol_create', dict(pool=pool, name="test2", size=4000000))
try:
- jsonrequest("vol_copy", dict(pool="test", vol_orig="test2", vol_new="test2-copy"))
+ jsonrequest("vol_copy", dict(pool=pool, vol_orig="test2", vol_new="test2-copy"))
try:
- jsonrequest("export_create", dict(pool="test", vol="test2", lun=5, initiator_wwn="iqn.2006-03.com.wtf.ohyeah:666"))
+ jsonrequest("export_create", dict(pool=pool, vol="test2", lun=5, initiator_wwn="iqn.2006-03.com.wtf.ohyeah:666"))
print "waiting"
- time.sleep(10)
+ time.sleep(5)
+ results = jsonrequest("export_list")
+ for result in results:
+ print "export", result['initiator_wwn'], result['pool'], result['vol_name'], result['lun'], result['vol_uuid']
+ time.sleep(5)
print "go!"
finally:
- jsonrequest("export_destroy", dict(pool="test", vol="test2", initiator_wwn="iqn.2006-03.com.wtf.ohyeah:666"))
+ jsonrequest("export_destroy", dict(pool=pool, vol="test2", initiator_wwn="iqn.2006-03.com.wtf.ohyeah:666"))
finally:
- jsonrequest("vol_destroy", dict(pool="test", name="test2-copy"))
+ jsonrequest("vol_destroy", dict(pool=pool, name="test2-copy"))
finally:
- jsonrequest("vol_destroy", dict(pool="test", name="test2"))
+ jsonrequest("vol_destroy", dict(pool=pool, name="test2"))
print "done"
Please sign in to comment.
Something went wrong with that request. Please try again.