def refresh(request): for f in (TerminateInstance, RebootInstance): form, handled = f.maybe_handle(request) if handled: return handled instances = [] try: instances = api.admin_server_list(request) except Exception as e: if not hasattr(e, 'message'): e.message = str(e) messages.error(request, _('Unable to get instance list: %s') % e.message) # We don't have any way of showing errors for these, so don't bother # trying to reuse the forms from above terminate_form = TerminateInstance() reboot_form = RebootInstance() return render_to_response( 'syspanel/instances/_list.html', { 'instances': instances, 'terminate_form': terminate_form, 'reboot_form': reboot_form, }, context_instance=template.RequestContext(request))
def refresh(request): tenant_id = request.user.tenant_id instances = [] try: instances = api.server_list(request) except Exception as e: if not hasattr(e, 'message'): e.message = str(e) messages.error(request, _('Unable to get instance list: %s') % e.message) # We don't have any way of showing errors for these, so don't bother # trying to reuse the forms from above terminate_form = TerminateInstance() reboot_form = RebootInstance() return shortcuts.render(request, 'nova/instances_and_volumes/instances/_list.html', { 'instances': instances, 'terminate_form': terminate_form, 'reboot_form': reboot_form})
flavor in flavors]) for instance in instances: instance.full_flavor = full_flavors[instance.flavor["id"]] except api_exceptions.Unauthorized, e: LOG.exception('Unauthorized attempt to access flavor list.') messages.error(request, _('Unauthorized.')) except Exception, e: LOG.exception('Exception while fetching flavor info') if not hasattr(e, 'message'): e.message = str(e) messages.error(request, _('Unable to get flavor info: %s') % e.message) # We don't have any way of showing errors for these, so don't bother # trying to reuse the forms from above terminate_form = TerminateInstance() reboot_form = RebootInstance() return shortcuts.render( request, 'nova/instances_and_volumes/instances/index.html', { 'instances': instances, 'terminate_form': terminate_form, 'reboot_form': reboot_form }) @login_required def refresh(request): tenant_id = request.user.tenant_id instances = [] try: instances = api.server_list(request)