Esempio n. 1
0
 def get_initial(self):
     aws_tuples = []
     snapshot_id = self.kwargs["snapshot_id"]
     zone = self.kwargs["zone"]
     zone_id = Snapshots(self.request).get_zone()
     for zone in zone_id:
         aws_tuples.append((str(zone.name), str(zone.name)))
     snapshots = Snapshots(self.request).get_snapshot_detail(
         self.kwargs['snapshot_id'])
     volume_size = snapshots[0].volume_size
     aws_tuples.insert(0, ("", _("Select Zone")))
     return {
         'snapshot_id': snapshot_id,
         'zone_choices': aws_tuples,
         'volume_size': volume_size
     }
Esempio n. 2
0
 def get_data(self):
     snapshot = []
     try:
         snapshot = Snapshots(self.request).get_snapshots()
     except Exception, e:
         messages.error(self.request, _(e.message))
         LOG.error(e.message)
Esempio n. 3
0
 def get_initial(self):
     aws_tuples = []
     snapshot_id = self.kwargs["snapshot_id"]
     regions = Snapshots(self.request).get_regions()
     for region in regions:
         aws_tuples.append((str(region.name), str(region.name)))
     aws_tuples.insert(0, ("", _("Select Region")))
     return {'snapshot_id': snapshot_id, 'region_choices': aws_tuples}
Esempio n. 4
0
 def get_data(self):
     try:
         vol = Snapshots(self.request).get_snapshot_detail(
             self.kwargs['snapshot_id'])
         return vol[0]
     except Exception, e:
         redirect = reverse('horizon:amazon:snapshots:index')
         messages.error(self.request, _(e.message))
         LOG.error(e.message)
         exceptions.handle_redirect(self.request, redirect)
Esempio n. 5
0
 def handle(self, request, context):
     try:
         Snapshots(request).create_snapshot(
             volume_id=context['availability_volume'],
             description=context['description'],
             name=str(context['snapshot_name']))
         return True
     except Exception, e:
         redirect = reverse("horizon:amazon:snapshots:index")
         messages.error(request, _(e.message))
         LOG.error(e.message)
         exceptions.handle_redirect(request, redirect)
         return False
Esempio n. 6
0
    def populate_availability_volume_choices(self, request, context):
        aws_tuples = []
        aws_volumes = Snapshots(request).get_volumes()
        for volume in aws_volumes:
            if "Name" in volume.tags:
                aws_tuples.append(
                    (str(volume.id),
                     str(volume.id) + " - " + str(volume.tags["Name"])))
            else:
                aws_tuples.append((str(volume.id), str(volume.id)))
        aws_tuples.insert(0, ("", _("Select Volume")))

        return aws_tuples
Esempio n. 7
0
 def handle(self, request, data):
     try:
         Snapshots(request).copy_snapshot(data['snapshot_id'],
                                          data['destination_region'],
                                          data['description'])
         messages.success(
             request,
             _('Snapshot %s Copied to the Selected Region : ') %
             data['snapshot_id'])
         return True
     except Exception, e:
         redirect = reverse("horizon:amazon:snapshots:index")
         messages.error(request, _(e.message))
         LOG.error(e.message)
         exceptions.handle_redirect(request, redirect)
Esempio n. 8
0
 def handle(self, request, data):
     try:
         Snapshots(request).create_volume(data['snapshot_id'],
                                          data['availability_zone'],
                                          data['volume_name'],
                                          data['volume_type'], data['size'],
                                          data['iops'])
         messages.success(
             request,
             _('Volume created for Snapshot : %s') % data['snapshot_id'])
         return True
     except Exception, e:
         redirect = reverse("horizon:amazon:snapshots:index")
         messages.error(request, _(e.message))
         LOG.error(e.message)
         exceptions.handle_redirect(request, redirect)
 def action(self, request, obj_id):
     try:
         Snapshots(request).delete_snapshots(obj_id)
     except Exception, e:
         messages.error(request, _(e.message))
         LOG.error(e.message)