summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-04-06 16:02:30 +0000
committerGerrit Code Review <review@openstack.org>2012-04-06 16:02:30 +0000
commit72c1dd677b2ea67820c07a12372904e0016742c9 (patch)
treee65a3b31072a44fb7e3f5cd54e35d50d7e63c5a4
parent7a51a3f9626fe1135a85c77cb9d2a3a119783474 (diff)
parent4e4605694f02ec0c65fc1ced88c9f86dccd48dcb (diff)
downloadnova-72c1dd677b2ea67820c07a12372904e0016742c9.tar.gz
nova-72c1dd677b2ea67820c07a12372904e0016742c9.tar.xz
nova-72c1dd677b2ea67820c07a12372904e0016742c9.zip
Merge "Remove unused user_id and project_id parameters to fetch_image()"
-rw-r--r--nova/tests/xenapi/stubs.py3
-rw-r--r--nova/virt/xenapi/vm_utils.py26
2 files changed, 12 insertions, 17 deletions
diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py
index 6b76b2e5e..c82820dcf 100644
--- a/nova/tests/xenapi/stubs.py
+++ b/nova/tests/xenapi/stubs.py
@@ -40,8 +40,7 @@ def stubout_firewall_driver(stubs, conn):
def stubout_instance_snapshot(stubs):
@classmethod
- def fake_fetch_image(cls, context, session, instance, image, user,
- project, type):
+ def fake_fetch_image(cls, context, session, instance, image, type):
return [dict(vdi_type='os', vdi_uuid=_make_fake_vdi())]
stubs.Set(vm_utils.VMHelper, 'fetch_image', fake_fetch_image)
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index 1a5ad0987..e3c2537a5 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -610,7 +610,7 @@ class VMHelper(xenapi.HelperBase):
if filename == "":
return cls.fetch_image(context, session, instance, image,
- user_id, project_id, image_type)
+ image_type)
else:
return [dict(vdi_type=ImageType.to_string(image_type),
vdi_uuid=None,
@@ -627,10 +627,8 @@ class VMHelper(xenapi.HelperBase):
if FLAGS.cache_images == False or image_type == ImageType.DISK_ISO:
# If caching is disabled, we do not have to keep a copy of the
# image. Fetch the image from glance.
- return cls.fetch_image(context, session,
- instance, instance.image_ref,
- instance.user_id, instance.project_id,
- image_type)
+ return cls.fetch_image(context, session, instance,
+ instance.image_ref, image_type)
sr_ref = cls.safe_find_sr(session)
sr_type = session.call_xenapi('SR.get_record', sr_ref)["type"]
@@ -644,8 +642,8 @@ class VMHelper(xenapi.HelperBase):
vdi_ref = cls.find_cached_image(session, image, sr_ref)
if vdi_ref is None:
- vdis = cls.fetch_image(context, session, instance, image, user_id,
- project_id, image_type)
+ vdis = cls.fetch_image(context, session, instance, image,
+ image_type)
vdi_ref = session.call_xenapi('VDI.get_by_uuid',
vdis[0]['vdi_uuid'])
session.call_xenapi('VDI.add_to_other_config',
@@ -694,19 +692,18 @@ class VMHelper(xenapi.HelperBase):
return vdi_return_list
@classmethod
- def fetch_image(cls, context, session, instance, image, _user_id,
- _project_id, image_type):
+ def fetch_image(cls, context, session, instance, image, image_type):
"""Fetch image from glance based on image type.
Returns: A single filename if image_type is KERNEL or RAMDISK
A list of dictionaries that describe VDIs, otherwise
"""
if image_type == ImageType.DISK_VHD:
- return cls._fetch_image_glance_vhd(context,
- session, instance, image, image_type)
+ return cls._fetch_image_glance_vhd(context, session, instance,
+ image)
else:
- return cls._fetch_image_glance_disk(context,
- session, instance, image, image_type)
+ return cls._fetch_image_glance_disk(context, session, instance,
+ image, image_type)
@classmethod
def _retry_glance_download_vhd(cls, context, session, image):
@@ -749,8 +746,7 @@ class VMHelper(xenapi.HelperBase):
raise exception.CouldNotFetchImage(image=image)
@classmethod
- def _fetch_image_glance_vhd(cls, context, session, instance, image,
- _image_type):
+ def _fetch_image_glance_vhd(cls, context, session, instance, image):
"""Tell glance to download an image and put the VHDs into the SR
Returns: A list of dictionaries that describe VDIs