Example #1
0
    def handle(self, request, data):
        try:
            cinder.volume_snapshot_reset_state(request, self.initial["snapshot_id"], data["status"])

            choices = dict(STATUS_CHOICES)
            choice = choices[data["status"]]
            messages.success(request, _("Successfully updated volume snapshot" ' status: "%s".') % choice)
            return True
        except Exception:
            exceptions.handle(request, _("Unable to update volume snapshot status."))
            return False
Example #2
0
    def handle(self, request, data):
        try:
            cinder.volume_snapshot_reset_state(request,
                                               self.initial['snapshot_id'],
                                               data['status'])

            choices = dict(STATUS_CHOICES)
            choice = choices[data['status']]
            messages.success(request, _('Successfully updated volume snapshot'
                                     ' status: "%s".') % choice)
            return True
        except Exception:
            exceptions.handle(request,
                              _('Unable to update volume snapshot status.'))
            return False
Example #3
0
    def test_update_snapshot_status(self):
        snapshot = self.cinder_volume_snapshots.first()
        state = 'error'

        cinder.volume_snapshot_get(IsA(http.HttpRequest), snapshot.id) \
            .AndReturn(snapshot)
        cinder.volume_snapshot_reset_state(IsA(http.HttpRequest), snapshot.id,
                                           state)
        self.mox.ReplayAll()

        formData = {'status': state}
        url = reverse('horizon:admin:snapshots:update_status',
                      args=(snapshot.id, ))
        res = self.client.post(url, formData)
        self.assertNoFormErrors(res)
Example #4
0
    def handle(self, request, data):
        try:
            cinder.volume_snapshot_reset_state(request,
                                               self.initial['snapshot_id'],
                                               data['status'])

            choices = dict(STATUS_CHOICES)
            choice = choices[data['status']]
            messages.success(request, _('Successfully updated volume snapshot'
                                        ' status: "%s".') % choice)
            return True
        except Exception:
            redirect = reverse("horizon:admin:snapshots:index")
            exceptions.handle(request,
                              _('Unable to update volume snapshot status.'),
                              redirect=redirect)
Example #5
0
    def test_update_snapshot_status(self):
        snapshot = self.cinder_volume_snapshots.first()
        state = 'error'

        cinder.volume_snapshot_get(IsA(http.HttpRequest), snapshot.id) \
            .AndReturn(snapshot)
        cinder.volume_snapshot_reset_state(IsA(http.HttpRequest),
                                           snapshot.id,
                                           state)
        self.mox.ReplayAll()

        formData = {'status': state}
        url = reverse('horizon:admin:volumes:snapshots:update_status',
                      args=(snapshot.id,))
        res = self.client.post(url, formData)
        self.assertNoFormErrors(res)