コード例 #1
0
    def test_tenant_floating_ip_allocate(self):
        novaclient = self.stub_novaclient()

        novaclient.floating_ips = self.mox.CreateMockAnything()
        novaclient.floating_ips.create().AndReturn(self.floating_ip)
        self.mox.ReplayAll()

        floating_ip = api.tenant_floating_ip_allocate(self.request)

        self.assertIsInstance(floating_ip, api.FloatingIp)
        self.mox.VerifyAll()
コード例 #2
0
    def handle(self, request, data):
        try:
            fip = api.tenant_floating_ip_allocate(request)
            LOG.info('Allocating Floating IP "%s" to tenant "%s"'
                     % (fip.ip, data['tenant_id']))

            messages.success(request, 'Successfully allocated Floating IP "%s"\
                         to tenant "%s"' % (fip.ip, data['tenant_id']))

        except novaclient_exceptions.ClientException, e:
            LOG.error("ClientException in FloatingIpAllocate", exc_info=True)
            messages.error(request, 'Error allocating Floating IP "%s"\
                           to tenant "%s": %s' %
                           (fip.ip, data['tenant_id'], e.message))
コード例 #3
0
    def handle(self, request, data):
        try:
            fip = api.tenant_floating_ip_allocate(request)
            LOG.info('Allocating Floating IP "%s" to tenant "%s"' %
                     (fip.ip, data['tenant_id']))

            messages.success(
                request, 'Successfully allocated Floating IP "%s"\
                         to tenant "%s"' % (fip.ip, data['tenant_id']))

        except novaclient_exceptions.ClientException, e:
            LOG.error("ClientException in FloatingIpAllocate", exc_info=True)
            messages.error(
                request, 'Error allocating Floating IP "%s"\
                           to tenant "%s": %s' %
                (fip.ip, data['tenant_id'], e.message))
コード例 #4
0
    def handle(self, request, data):
        try:
            fip = api.tenant_floating_ip_allocate(request)
            LOG.info('Allocating Floating IP "%s" to tenant "%s"'
                     % (fip.ip, data['tenant_id']))

            messages.success(request,
                             _('Successfully allocated Floating IP "%(ip)s"\
                                to tenant "%(tenant)s"')
                             % {"ip": fip.ip, "tenant": data['tenant_id']})

        except novaclient_exceptions.ClientException, e:
            LOG.exception("ClientException in FloatingIpAllocate")
            messages.error(request, _('Error allocating Floating IP "%(ip)s"\
                to tenant "%(tenant)s": %(msg)s') %
                {"ip": fip.ip, "tenant": data['tenant_id'], "msg": e.message})