Skip to content
  • Christos Stavrakakis's avatar
    cyclades: Optimize DB queries of /servers API · 9ae370e6
    Christos Stavrakakis authored
    Use 'prefetch_related' attribute of Django queryset to prefetch the
    NetworkInterface and IPaddress objects that are related with a
    VirtualMachine object. Also, modify functions that operate on server
    NICs and IPs, to to use only the prefetched objects, which means that
    they can perform further filtering or ordering on objects because this
    is considered a new DB query and so will not get the cached objects.
    
    Also, return empty 'fqdn' and 'port_forwarding' attributes if the
    server has no public IP address.
    9ae370e6