コード例 #1
0
ファイル: forms.py プロジェクト: BenJaziaSadok/horizon
 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
ファイル: forms.py プロジェクト: redondos/horizon
 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.'))
コード例 #3
0
    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))