Пример #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.'))
Пример #2
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.'))
    def handle(self, request, data):
        fip = None
        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 if fip else "None", data['tenant_id'], e.message))