Add more debug logging to download detached volume test

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
Prasanna Santhanam 2013-08-10 16:18:29 +05:30
parent 99329dfa4a
commit 3455a76237
1 changed files with 6 additions and 4 deletions

View File

@ -521,13 +521,15 @@ class TestVolumes(cloudstackTestCase):
#Attempt to download the volume and save contents locally
try:
formatted_url = urllib.unquote_plus(extract_vol.url)
self.debug("Attempting to download volume at url %s" % formatted_url)
response = urllib.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug("Saving volume %s to path %s" %(self.volume.id, path))
os.close(fd)
fd = open(path, 'wb')
fd.write(response.read())
fd.close()
with open(path, 'wb') as fd:
fd.write(response.read())
self.debug("Saved volume successfully")
except Exception:
self.fail(
"Extract Volume Failed with invalid URL %s (vol id: %s)" \