示例#1
0
 def populate_volume_id_choices(self, request, context):
     try:
         volumes = guts_api.volumes_list(request)
     except Exception:
         volumes = []
         exceptions.handle(request,
             _("Unable to retrieve volumes list")
         )
     volumes_list = [(volume.id, "%s - %s" % (volume.name, volume.hypervisor_name))
                         for volume in volumes]
     if not volumes_list:
         volumes_list.insert(0,
             ("", _("No Volume present for migration"))
         )
     else:
         volumes_list.insert(0,
             ("", _("Select Volume to be migrated"))
         )
     return volumes_list
示例#2
0
 def get(self, request):
     """Get a list of volumes
     """
     result = guts_api.volumes_list(request)
     return {'items': [u.to_dict() for u in result]}