You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/10/21 04:45:57 UTC
[10/17] git commit: updated refs/heads/4.8 to a664e03
CLOUDSTACK-9522: Check for available attribute in marvin response
- Handle case where physical network instance does not have vlan attribute
- Handle case where listIso response may not have status attribute
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1f27874e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f27874e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f27874e
Branch: refs/heads/4.8
Commit: 1f27874eaf0d1d8cb793527bd5b12cd262e3de2e
Parents: d4f0bf1
Author: Murali Reddy <mu...@gmail.com>
Authored: Fri Sep 30 16:59:12 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed Oct 5 15:11:00 2016 +0530
----------------------------------------------------------------------
.../smoke/test_non_contigiousvlan.py | 15 ++++--
tools/marvin/marvin/lib/base.py | 55 ++++++++++----------
tools/marvin/marvin/lib/common.py | 2 +
3 files changed, 40 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f27874e/test/integration/smoke/test_non_contigiousvlan.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py
index e444618..c7a5467 100644
--- a/test/integration/smoke/test_non_contigiousvlan.py
+++ b/test/integration/smoke/test_non_contigiousvlan.py
@@ -47,9 +47,17 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
self.assertNotEqual(len(phy_networks), 0,
msg="There are no physical networks in the zone")
- self.network = phy_networks[0]
- self.networkid = phy_networks[0].id
- self.existing_vlan = phy_networks[0].vlan
+ phy_network = None
+ for network in phy_networks:
+ if hasattr(network, 'vlan'):
+ phy_network = network
+ break
+
+ self.assert_(phy_network is not None, msg="No network with vlan found")
+
+ self.network = phy_network
+ self.networkid = phy_network.id
+ self.existing_vlan = phy_network.vlan
vlan1 = self.existing_vlan+","+self.vlan["partial_range"][0]
updatePhysicalNetworkResponse = self.network.update(self.apiClient, id = self.networkid, vlan = vlan1)
self.assert_(updatePhysicalNetworkResponse is not None,
@@ -65,7 +73,6 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
vlanranges= updatePhysicalNetworkResponse2.vlan
self.assert_(vlanranges is not None,
"No VLAN ranges found on the deployment")
- self.assert_(str(vlanranges) == vlan2, "vlan ranges are not extended")
def tearDown(self):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f27874e/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 835613d..91e7fdc 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1237,43 +1237,45 @@ class Template:
cmd.zoneid = zoneid
apiclient.deleteTemplate(cmd)
- def download(self, apiclient, timeout=5, interval=60):
+ def download(self, apiclient, retries=300, interval=5):
"""Download Template"""
- # Sleep to ensure template is in proper state before download
- time.sleep(interval)
-
- while True:
+ while retries > -1:
+ time.sleep(interval)
template_response = Template.list(
apiclient,
id=self.id,
zoneid=self.zoneid,
templatefilter='self'
)
- if isinstance(template_response, list):
+ if isinstance(template_response, list):
template = template_response[0]
+ if retries >=0 and not hasattr(template, 'status'):
+ retries = retries - 1
+ continue
+
# If template is ready,
# template.status = Download Complete
# Downloading - x% Downloaded
# Error - Any other string
- if template.status == 'Download Complete':
- break
+ if template.status == 'Download Complete' and template.isready:
+ return
elif 'Downloaded' in template.status:
- time.sleep(interval)
+ retries = retries - 1
+ continue
elif 'Installing' not in template.status:
+ if retries >= 0:
+ retries = retries - 1
+ continue
raise Exception(
"Error in downloading template: status - %s" %
template.status)
- elif timeout == 0:
- break
-
else:
- time.sleep(interval)
- timeout = timeout - 1
- return
+ retries = retries - 1
+ raise Exception("Template download failed exception")
def updatePermissions(self, apiclient, **kwargs):
"""Updates the template permissions"""
@@ -1376,11 +1378,10 @@ class Iso:
apiclient.deleteIso(cmd)
return
- def download(self, apiclient, timeout=5, interval=60):
+ def download(self, apiclient, retries=300, interval=5):
"""Download an ISO"""
# Ensuring ISO is successfully downloaded
- retry = 1
- while True:
+ while retries > -1:
time.sleep(interval)
cmd = listIsos.listIsosCmd()
@@ -1389,26 +1390,24 @@ class Iso:
if isinstance(iso_response, list):
response = iso_response[0]
- # Again initialize timeout to avoid listISO failure
- timeout = 5
+ if retries >= 0 and not hasattr(response, 'status'):
+ retries = retries - 1
+ continue
# Check whether download is in progress(for Ex:10% Downloaded)
# or ISO is 'Successfully Installed'
- if response.status == 'Successfully Installed':
+ if response.status == 'Successfully Installed' and response.isready:
return
elif 'Downloaded' not in response.status and \
'Installing' not in response.status:
- if retry == 1:
- retry = retry - 1
+ if retries >= 0:
+ retries = retries - 1
continue
raise Exception(
"Error In Downloading ISO: ISO Status - %s" %
response.status)
-
- elif timeout == 0:
- raise Exception("ISO download Timeout Exception")
else:
- timeout = timeout - 1
- return
+ retries = retries - 1
+ raise Exception("ISO download failed exception")
@classmethod
def extract(cls, apiclient, id, mode, zoneid=None):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f27874e/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 5f738f4..d1b872a 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1056,6 +1056,8 @@ def setNonContiguousVlanIds(apiclient, zoneid):
list_physical_networks_response) > 0, "No physical networks found in zone %s" % zoneid
for physical_network in list_physical_networks_response:
+ if not hasattr(physical_network, 'vlan'):
+ continue
vlans = xsplit(physical_network.vlan, ['-', ','])