"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "openstack_dashboard/dashboards/admin/instances/views.py" between
horizon-18.6.3.tar.gz and horizon-18.6.4.tar.gz

About: OpenStack Horizon (Optional Service: Dashboard) provides a web-based self-service portal to interact with underlying OpenStack services, such as launching an instance, assigning IP addresses and configuring access controls.
The "Victoria" series (maintained release).

views.py  (horizon-18.6.3):views.py  (horizon-18.6.4)
skipping to change at line 104 skipping to change at line 104
instances if isinstance(instance.image, dict)) instances if isinstance(instance.image, dict))
real_img_ids = list(filter(None, img_ids)) real_img_ids = list(filter(None, img_ids))
images = api.glance.image_list_detailed_by_ids( images = api.glance.image_list_detailed_by_ids(
self.request, real_img_ids) self.request, real_img_ids)
image_map = dict((image.id, image) for image in images) image_map = dict((image.id, image) for image in images)
return image_map return image_map
except Exception: except Exception:
exceptions.handle(self.request, ignore=True) exceptions.handle(self.request, ignore=True)
return {} return {}
def _get_images_by_name(self, image_name):
result = api.glance.image_list_detailed(
self.request, filters={'name': image_name})
images = result[0]
return dict((image.id, image) for image in images)
def _get_flavors(self): def _get_flavors(self):
# Gather our flavors to correlate against IDs # Gather our flavors to correlate against IDs
try: try:
flavors = api.nova.flavor_list(self.request) flavors = api.nova.flavor_list(self.request)
return dict((str(flavor.id), flavor) for flavor in flavors) return dict((str(flavor.id), flavor) for flavor in flavors)
except Exception: except Exception:
msg = _("Unable to retrieve flavor list.") msg = _("Unable to retrieve flavor list.")
exceptions.handle(self.request, msg) exceptions.handle(self.request, msg)
return {} return {}
skipping to change at line 147 skipping to change at line 153
# list # list
if (setting_utils.get_dict_config('FILTER_DATA_FIRST', if (setting_utils.get_dict_config('FILTER_DATA_FIRST',
'admin.instances') and 'admin.instances') and
len(search_opts) == len(default_search_opts)): len(search_opts) == len(default_search_opts)):
self._needs_filter_first = True self._needs_filter_first = True
self._more = False self._more = False
return [] return []
self._needs_filter_first = False self._needs_filter_first = False
instances = self._get_instances(search_opts, sort_dir)
results = futurist_utils.call_functions_parallel( results = futurist_utils.call_functions_parallel(
(self._get_images, [tuple(instances)]),
self._get_flavors, self._get_flavors,
self._get_tenants) self._get_tenants)
image_dict, flavor_dict, tenant_dict = results flavor_dict, tenant_dict = results
non_api_filter_info = ( non_api_filter_info = [
('project', 'tenant_id', tenant_dict.values()), ('project', 'tenant_id', tenant_dict.values()),
('image_name', 'image', image_dict.values()),
('flavor_name', 'flavor', flavor_dict.values()), ('flavor_name', 'flavor', flavor_dict.values()),
) ]
filter_by_image_name = 'image_name' in search_opts
if filter_by_image_name:
image_dict = self._get_images_by_name(search_opts['image_name'])
non_api_filter_info.append(
('image_name', 'image', image_dict.values())
)
if not views.process_non_api_filters(search_opts, non_api_filter_info): if not views.process_non_api_filters(search_opts, non_api_filter_info):
self._more = False self._more = False
return [] return []
instances = self._get_instances(search_opts, sort_dir)
if not filter_by_image_name:
image_dict = self._get_images(tuple(instances))
# Loop through instances to get image, flavor and tenant info. # Loop through instances to get image, flavor and tenant info.
for inst in instances: for inst in instances:
if hasattr(inst, 'image') and isinstance(inst.image, dict): if hasattr(inst, 'image') and isinstance(inst.image, dict):
image_id = inst.image.get('id') image_id = inst.image.get('id')
if image_id in image_dict: if image_id in image_dict:
inst.image = image_dict[image_id] inst.image = image_dict[image_id]
# In case image not found in image_map, set name to empty # In case image not found in image_map, set name to empty
# to avoid fallback API call to Glance in api/nova.py # to avoid fallback API call to Glance in api/nova.py
# until the call is deprecated in api itself # until the call is deprecated in api itself
else: else:
 End of changes. 8 change blocks. 
6 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)