Browse Source

Added counter for volume creation

Change-Id: I56b3a5866968891785d4dc85d6276a998c81ff2a
changes/75/745275/4
rbalasun 2 years ago
parent
commit
cf0219961b
  1. 13
      kloudbuster/base_network.py
  2. 12
      kloudbuster/base_storage.py
  3. 2
      kloudbuster/cfg.scale.yaml

13
kloudbuster/base_network.py

@ -173,6 +173,12 @@ class BaseNetwork():
bs_obj = base_storage.BaseStorage(self.cinder_client)
vol_size = config_scale['storage_stage_configs']['disk_size']
volume_type = config_scale['storage_stage_configs'].get('volume_type', None)
DEFAULT_VOL_CREATE_TIMEOUT_SEC = 150
try:
vol_timeout = int(config_scale['storage_stage_configs'].get('vol_create_timeout_sec', DEFAULT_VOL_CREATE_TIMEOUT_SEC))
except ValueError:
vol_timeout = DEFAULT_VOL_CREATE_TIMEOUT_SEC
LOG.info("Incorrect input for vol_create_timeout_sec in cfg file ,proceeding with default timeout %d" % vol_timeout)
else:
vol_size = 0
@ -186,11 +192,8 @@ class BaseNetwork():
# Don't create volumn for KB-Proxy
if vol_size and instance_count < vm_total - 1:
vol_name = network_prefix + "-V" + str(instance_count)
if volume_type:
perf_instance.vol = bs_obj.create_vol(vol_size, name=vol_name,
type=volume_type)
else:
perf_instance.vol = bs_obj.create_vol(vol_size, name=vol_name)
perf_instance.vol = bs_obj.create_vol(vol_size, vol_timeout, name=vol_name,
type=volume_type)
self.res_logger.log('volumes', vol_name, perf_instance.vol.id)
perf_instance.subnet_ip = self.network['subnet_ip']

12
kloudbuster/base_storage.py

@ -29,19 +29,25 @@ class BaseStorage():
def __init__(self, cinderclient):
self.cinderclient = cinderclient
def create_vol(self, size, name=None, type=None):
def create_vol(self, size, vol_timeout, name=None, type=None):
if type:
vol = self.cinderclient.volumes.create(size, name=name,
volume_type=type)
else:
vol = self.cinderclient.volumes.create(size, name=name)
for _ in range(10):
start_t = time.time()
while (True):
if vol.status == 'creating':
time.sleep(1)
time.sleep(5)
elif vol.status == 'available':
break
elif vol.status == 'error':
raise KBVolCreationException('Not enough disk space in the host?')
if (time.time() - start_t) > vol_timeout:
raise KBVolCreationException('Volume creation timed out')
break
vol = self.cinderclient.volumes.get(vol.id)
return vol

2
kloudbuster/cfg.scale.yaml

@ -323,6 +323,8 @@ client:
# Make sure volume type is public
# If an invalid volume type is specified tool will Error out on volume create
# volume_type: cephtype
# Volume creation timeout value specified in sec
vol_create_timeout_sec: 150
# Storage tool specific configs (per VM)

Loading…
Cancel
Save