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)
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')
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)
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)
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)
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)
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)