« Previous | Next » 

Revision b3a43976

IDb3a439762829ea72e12e6fa3d4bd96757be7fe83

Added by Christos Stavrakakis over 10 years ago

cyclades: Optimize DB queries of /servers API

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.

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences