« Previous | Next » 

Revision b3a43976


Added by Christos Stavrakakis over 9 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.


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences