Make volume wait timeout configurable

Change-Id: I6029484f9b7c5e21054315f849f81a8fdb2bafd3
This commit is contained in:
Hongbin Lu 2020-08-23 04:35:57 +00:00
parent a8e97c118c
commit 994359ea96
2 changed files with 15 additions and 4 deletions

View File

@ -192,8 +192,10 @@ class Manager(periodic_task.PeriodicTasks):
container.host = None container.host = None
container.save(context) container.save(context)
def _wait_for_volumes_available(self, context, requested_volumes, def _wait_for_volumes_available(
container, timeout=60, poll_interval=1): self, context, requested_volumes, container,
timeout=CONF.volume.timeout_wait_volume_available,
poll_interval=1):
driver = self._get_driver(container) driver = self._get_driver(container)
start_time = time.time() start_time = time.time()
try: try:
@ -221,8 +223,10 @@ class Manager(periodic_task.PeriodicTasks):
self._fail_container(context, container, msg, unset_host=True) self._fail_container(context, container, msg, unset_host=True)
raise exception.Conflict(msg) raise exception.Conflict(msg)
def _wait_for_volumes_deleted(self, context, volmaps, container, def _wait_for_volumes_deleted(
timeout=60, poll_interval=1): self, context, volmaps, container,
timeout=CONF.volume.timeout_wait_volume_deleted,
poll_interval=1):
start_time = time.time() start_time = time.time()
try: try:
volmaps = itertools.chain(volmaps) volmaps = itertools.chain(volmaps)

View File

@ -46,6 +46,13 @@ Use multipath connection of volume
Volumes can be connected as multipath devices. This will provide high Volumes can be connected as multipath devices. This will provide high
availability and fault tolerance. availability and fault tolerance.
"""), """),
cfg.IntOpt('timeout_wait_volume_available',
default=60,
help='Defines the timeout on waiting volume to become '
'available after its creation.'),
cfg.IntOpt('timeout_wait_volume_deleted',
default=60,
help='Defines the timeout on waiting volume to be deleted.'),
] ]