'Lists all floating IPs (optionally by host).
Note: if host is given, only active floating IPs are returned'

@args('--host', metavar='<host>', help='Host')
def list(self, host=None):

    ctxt = context.get_admin_context()
    try:
        if (host is None):
            floating_ips = db.floating_ip_get_all(ctxt)
        else:
            floating_ips = db.floating_ip_get_all_by_host(ctxt, host)
    except exception.NoFloatingIpsDefined:
        print(_('No    floating    IP    addresses    have    been    defined.'))
        return
    for floating_ip in floating_ips:
        instance_uuid = None
        if floating_ip['fixed_ip_id']:
            fixed_ip = db.fixed_ip_get(ctxt, floating_ip['fixed_ip_id'])
            instance_uuid = fixed_ip['instance_uuid']
        print(('%s DCTB %s DCTB %s DCTB %s DCTB %s' % (floating_ip['project_id'], floating_ip['address'], instance_uuid, floating_ip['pool'], floating_ip['interface'])))
