Esempio n. 1
0
 def handle(self, request, data):
     try:
         fip = api.tenant_floating_ip_allocate(request, pool=data["pool"])
         messages.success(request, _("Allocated Floating IP %(ip)s.") % {"ip": fip.ip})
         return fip
     except:
         exceptions.handle(request, _("Unable to allocate Floating IP."))
Esempio n. 2
0
    def handle(self, request, data):
        try:
            fip = api.tenant_floating_ip_allocate(request, pool=data.get("pool", None))
            LOG.info('Allocating Floating IP "%s" to project "%s"' % (fip.ip, data["tenant_name"]))

            messages.success(
                request,
                _('Successfully allocated Floating IP "%(ip)s" ' 'to project "%(project)s"')
                % {"ip": fip.ip, "project": data["tenant_name"]},
            )
        except:
            exceptions.handle(request, _("Unable to allocate Floating IP."))
        return shortcuts.redirect("horizon:nova:access_and_security:index")
Esempio n. 3
0
    def handle(self, request, data):
        try:
            fip = api.tenant_floating_ip_allocate(request,
                                                  pool=data.get('pool', None))
            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:
            exceptions.handle(request, _('Unable to allocate Floating IP.'))
        return shortcuts.redirect(
                        'horizon:nova:access_and_security:index')
Esempio n. 4
0
    def handle(self, request, data):
        try:
            fip = api.tenant_floating_ip_allocate(request,
                                                  pool=data.get('pool', None))
            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:
            exceptions.handle(request, _('Unable to allocate Floating IP.'))
        return shortcuts.redirect(
                        'horizon:nova:access_and_security:index')
Esempio n. 5
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})
Esempio n. 6
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
                })