Refactor _make_subnet_dict to avoid issuing unnecessary queries
Use joined loads for attributes dns_nameservers and host_routes. As a result, particular scenarios like restarting DHCP agent could benefit from improved server-side performance. Change-Id: I6470356b601e2fcf74c7e0a6df438cef7099e9fe Closes-Bug: #1374044
This commit is contained in:
parent
c51e9c8aa2
commit
85bb8d51a1
@ -184,10 +184,12 @@ class Subnet(model_base.BASEV2, HasId, HasTenant):
|
|||||||
enable_dhcp = sa.Column(sa.Boolean())
|
enable_dhcp = sa.Column(sa.Boolean())
|
||||||
dns_nameservers = orm.relationship(DNSNameServer,
|
dns_nameservers = orm.relationship(DNSNameServer,
|
||||||
backref='subnet',
|
backref='subnet',
|
||||||
cascade='all, delete, delete-orphan')
|
cascade='all, delete, delete-orphan',
|
||||||
|
lazy='joined')
|
||||||
routes = orm.relationship(SubnetRoute,
|
routes = orm.relationship(SubnetRoute,
|
||||||
backref='subnet',
|
backref='subnet',
|
||||||
cascade='all, delete, delete-orphan')
|
cascade='all, delete, delete-orphan',
|
||||||
|
lazy='joined')
|
||||||
shared = sa.Column(sa.Boolean)
|
shared = sa.Column(sa.Boolean)
|
||||||
ipv6_ra_mode = sa.Column(sa.Enum(constants.IPV6_SLAAC,
|
ipv6_ra_mode = sa.Column(sa.Enum(constants.IPV6_SLAAC,
|
||||||
constants.DHCPV6_STATEFUL,
|
constants.DHCPV6_STATEFUL,
|
||||||
|
Loading…
Reference in New Issue
Block a user