Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions gwcli/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def reset(self):
for child in children:
self.remove_child(child)

def ui_command_create(self, pool=None, image=None, size=None, count=1):
def ui_command_create(self, pool=None, image=None, size=None, count=1,
cmd_time_out=None):
"""
Create a LUN and assign to the gateway(s).

Expand All @@ -83,6 +84,8 @@ def ui_command_create(self, pool=None, image=None, size=None, count=1):
create rbd.test 1g count=5
-> create 5 LUNs called test1..test5 each of 1GB in size
from the rbd pool
cmd_time_out : Optional, integer(defaults to 30, i.e. TCMU_TIME_OUT),
value of TCMU command timeout.

Notes.
1) size does not support decimal representations
Expand Down Expand Up @@ -128,12 +131,14 @@ def ui_command_create(self, pool=None, image=None, size=None, count=1):
return

self.logger.debug("CMD: /disks/ create pool={} "
"image={} size={} count={}".format(pool,
"image={} size={} count={} cmd_time_out={}".format(pool,
image,
size,
count))
count,
cmd_time_out))

self.create_disk(pool=pool, image=image, size=size, count=count)
self.create_disk(pool=pool, image=image, size=size,
count=count, cmd_time_out=cmd_time_out)

def _valid_pool(self, pool=None):
"""
Expand Down Expand Up @@ -161,7 +166,7 @@ def _valid_pool(self, pool=None):
return False

def create_disk(self, pool=None, image=None, size=None, count=1,
parent=None):
cmd_time_out=None, parent=None):

rc = 0

Expand All @@ -184,7 +189,8 @@ def create_disk(self, pool=None, image=None, size=None, count=1,
disk_key)

api_vars = {'pool': pool, 'size': size.upper(), 'owner': local_gw,
'count': count, 'mode': 'create'}
'count': count, 'mode': 'create',
'cmd_time_out': cmd_time_out}

self.logger.debug("Issuing disk create request")

Expand Down
8 changes: 5 additions & 3 deletions rbd-target-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ def disk(image_id):
size = request.form.get('size')
mode = request.form.get('mode')
count = request.form.get('count', '1')
cmd_time_out = request.form.get('cmd_time_out', None)

pool, image_name = image_id.split('.')

Expand All @@ -615,7 +616,7 @@ def disk(image_id):
sfx)

api_vars = {'pool': pool, 'size': size, 'owner': local_gw,
'mode': mode}
'mode': mode, 'cmd_time_out': cmd_time_out}

resp_text, resp_code = call_api(gateways, '_disk',
image_name,
Expand Down Expand Up @@ -686,7 +687,8 @@ def _disk(image_id):
str(request.form['pool']),
image_name,
str(request.form['size']),
str(request.form['owner']))
str(request.form['owner']),
request.form.get('cmd_time_out', None))
if lun.error:
logger.error("Unable to create a LUN instance"
" : {}".format(lun.error_msg))
Expand Down Expand Up @@ -729,7 +731,7 @@ def _disk(image_id):
else:

# this is an invalid request
return jsonify(message="Invalid Request - need to provide"
return jsonify(message="Invalid Request - need to provide "
"pool, size and owner"), 400

else:
Expand Down