def populate_instance_id_choices(self, request, context): try: instances = guts_api.instances_list(request) except Exception: instances =[] exceptions.handle(request, _("Unable to retrieve instances list.") ) instances_list = [(instance.id, "%s - %s" % (instance.name, instance.hypervisor_name)) for instance in instances] if not instances_list: instances_list.insert(0, ("", _("No Instance present for migration")) ) else: instances_list.insert(0, ("", _("Select an Instance to be migrated")) ) return instances_list
def get(self, request): """Get a list of instances """ result = guts_api.instances_list(request) return {'items': [u.to_dict() for u in result]}