Enhance error handling for volume creation failure
1. Enhance error handling for volume creation failure; 2. Fix the trackback of force_clean.py if other resourses are pre-existed in the cloud under test; 3. Update requirements to support sphinx 1.4.0; Change-Id: Ifa403a560a6673c23f791833992e188f4d15878e
This commit is contained in:
parent
84f2f3d741
commit
668a7ea9cb
@ -19,13 +19,16 @@ import log as logging
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class KBVolAttachException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BaseCompute(object):
|
class BaseCompute(object):
|
||||||
"""
|
"""
|
||||||
The Base class for nova compute resources
|
The Base class for nova compute resources
|
||||||
1. Creates virtual machines with specific configs
|
1. Creates virtual machines with specific configs
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, vm_name, network):
|
def __init__(self, vm_name, network):
|
||||||
self.novaclient = network.router.user.nova_client
|
self.novaclient = network.router.user.nova_client
|
||||||
self.network = network
|
self.network = network
|
||||||
@ -92,6 +95,8 @@ class BaseCompute(object):
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
def attach_vol(self):
|
def attach_vol(self):
|
||||||
|
if self.vol.status != 'available':
|
||||||
|
raise KBVolAttachException('Volume must be in available status before attaching.')
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
try:
|
try:
|
||||||
self.novaclient.volumes.create_server_volume(self.instance.id, self.vol.id)
|
self.novaclient.volumes.create_server_volume(self.instance.id, self.vol.id)
|
||||||
|
@ -18,6 +18,9 @@ import log as logging
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class KBVolCreationException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
class BaseStorage(object):
|
class BaseStorage(object):
|
||||||
"""
|
"""
|
||||||
The Base class for cinder storage resources
|
The Base class for cinder storage resources
|
||||||
@ -27,7 +30,17 @@ class BaseStorage(object):
|
|||||||
self.cinderclient = cinderclient
|
self.cinderclient = cinderclient
|
||||||
|
|
||||||
def create_vol(self, size, name=None):
|
def create_vol(self, size, name=None):
|
||||||
return self.cinderclient.volumes.create(size, name=name)
|
vol = self.cinderclient.volumes.create(size, name=name)
|
||||||
|
for _ in range(10):
|
||||||
|
if vol.status == 'creating':
|
||||||
|
time.sleep(1)
|
||||||
|
elif vol.status == 'available':
|
||||||
|
break
|
||||||
|
elif vol.status == 'error':
|
||||||
|
raise KBVolCreationException('Not enough disk space in the host?')
|
||||||
|
vol = self.cinderclient.volumes.get(vol.id)
|
||||||
|
|
||||||
|
return vol
|
||||||
|
|
||||||
def delete_vol(self, volume):
|
def delete_vol(self, volume):
|
||||||
"""
|
"""
|
||||||
|
@ -89,7 +89,7 @@ def fetch_resources(fetcher, options=None):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
resid = res['id']
|
resid = res['id']
|
||||||
resname = res['name']
|
resname = res['name']
|
||||||
if resource_name_re.match(resname):
|
if resname and resource_name_re.match(resname):
|
||||||
resources[resid] = resname
|
resources[resid] = resname
|
||||||
return resources
|
return resources
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ flake8>=2.3.0
|
|||||||
git-review>=1.24
|
git-review>=1.24
|
||||||
pylint>=1.3
|
pylint>=1.3
|
||||||
pep8>=1.5.7
|
pep8>=1.5.7
|
||||||
sphinx>=1.2.3
|
sphinx>=1.4.0
|
||||||
|
sphinx_rtd_theme>=0.1.9
|
||||||
tox>=1.9.0
|
tox>=1.9.0
|
||||||
twine>=1.6.5
|
twine>=1.6.5
|
||||||
|
@ -7,7 +7,8 @@ hacking<0.11,>=0.10.0
|
|||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
discover
|
discover
|
||||||
python-subunit>=0.0.18
|
python-subunit>=0.0.18
|
||||||
sphinx>=1.3.1
|
sphinx>=1.4.0
|
||||||
|
sphinx_rtd_theme>=0.1.9
|
||||||
oslosphinx>=2.5.0 # Apache-2.0
|
oslosphinx>=2.5.0 # Apache-2.0
|
||||||
oslotest>=1.10.0 # Apache-2.0
|
oslotest>=1.10.0 # Apache-2.0
|
||||||
testrepository>=0.0.18
|
testrepository>=0.0.18
|
||||||
|
Loading…
Reference in New Issue
Block a user