コード例 #1
0
ファイル: tests.py プロジェクト: rukmal/horizon
    def test_extend_volume(self):
        volume = self.cinder_volumes.first()
        formData = {"name": u"A Volume I Am Making", "orig_size": volume.size, "new_size": 100}

        cinder.volume_get(IsA(http.HttpRequest), volume.id).AndReturn(self.cinder_volumes.first())

        cinder.volume_extend(IsA(http.HttpRequest), volume.id, formData["new_size"]).AndReturn(volume)

        self.mox.ReplayAll()

        url = reverse("horizon:project:volumes:volumes:extend", args=[volume.id])
        res = self.client.post(url, formData)

        redirect_url = VOLUME_INDEX_URL
        self.assertRedirectsNoFollow(res, redirect_url)
コード例 #2
0
    def handle(self, request, data):
        volume_id = self.initial['id']
        try:
            volume = cinder.volume_extend(request, volume_id, data['new_size'])

            message = _('Extending volume: "%s"') % data['name']
            messages.info(request, message)

            # operation log
            config = _("Volume ID: %s Volume Size: %s") % (
                volume_id, str(data['new_size']))
            api.logger.Logger(request).create(resource_type='volume',
                                              action_name='Extend Volume',
                                              resource_name='Volume',
                                              config=config,
                                              status='Success')
            return volume
        except Exception:
            redirect = reverse("horizon:storage:volumes:index")
            exceptions.handle(request,
                              _('Unable to extend volume.'),
                              redirect=redirect)

            # operation log
            api.logger.Logger(request).create(
                resource_type='volume',
                action_name='Extend Volume',
                resource_name='Volume',
                config=_('Unable to extend volume.'),
                status='Error')
コード例 #3
0
ファイル: forms.py プロジェクト: kili/horizon
    def handle(self, request, data):
        volume_id = self.initial["id"]
        try:
            volume = cinder.volume_extend(request, volume_id, data["new_size"])

            message = _('Successfully extended volume: "%s"') % data["name"]
            messages.success(request, message)
            return volume
        except Exception:
            redirect = reverse("horizon:project:volumes:index")
            exceptions.handle(request, _("Unable to extend volume."), redirect=redirect)
コード例 #4
0
ファイル: tests.py プロジェクト: vasart/horizon
    def test_extend_volume(self):
        volume = self.cinder_volumes.first()
        formData = {'name': u'A Volume I Am Making',
                    'orig_size': volume.size,
                    'new_size': 100}

        cinder.volume_get(IsA(http.HttpRequest), volume.id).\
                          AndReturn(self.cinder_volumes.first())

        cinder.volume_extend(IsA(http.HttpRequest),
                             volume.id,
                             formData['new_size']).AndReturn(volume)

        self.mox.ReplayAll()

        url = reverse('horizon:project:volumes:volumes:extend',
                      args=[volume.id])
        res = self.client.post(url, formData)

        redirect_url = VOLUME_INDEX_URL
        self.assertRedirectsNoFollow(res, redirect_url)
コード例 #5
0
ファイル: tests.py プロジェクト: anyaelise/horizon
    def test_extend_volume(self):
        volume = self.volumes.first()
        formData = {'name': u'A Volume I Am Making',
                    'orig_size': volume.size,
                    'new_size': 100}

        cinder.volume_get(IsA(http.HttpRequest), volume.id).\
                          AndReturn(self.volumes.first())

        cinder.volume_extend(IsA(http.HttpRequest),
                             volume.id,
                             formData['new_size']).AndReturn(volume)

        self.mox.ReplayAll()

        url = reverse('horizon:project:volumes:extend',
                      args=[volume.id])
        res = self.client.post(url, formData)

        redirect_url = reverse('horizon:project:volumes:index')
        self.assertRedirectsNoFollow(res, redirect_url)
コード例 #6
0
    def handle(self, request, data):
        volume_id = self.initial['id']
        try:
            volume = cinder.volume_extend(request, volume_id, data['new_size'])

            message = _('Extending volume: "%s"') % data['name']
            messages.info(request, message)
            return volume
        except Exception:
            redirect = reverse("horizon:admin:volumes:index")
            exceptions.handle(request,
                              _('Unable to extend volume.'),
                              redirect=redirect)
コード例 #7
0
ファイル: forms.py プロジェクト: jaisins/horizon
    def handle(self, request, data):
        volume_id = self.initial['id']
        try:
            volume = cinder.volume_extend(request,
                                          volume_id,
                                          data['new_size'])

            message = _('Extending volume: "%s"') % data['name']
            messages.info(request, message)
            return volume
        except Exception:
            redirect = reverse("horizon:project:volumes:index")
            exceptions.handle(request,
                              _('Unable to extend volume.'),
                              redirect=redirect)