def create_subnet(self, context, label, tenant_id, quantum_net_id, priority, cidr=None, gateway=None, gateway_v6=None, cidr_v6=None, dns1=None, dns2=None): """Re-use the basic FlatManager create_networks method to initialize the networks and fixed_ips tables in Engine DB. Also stores a few more fields in the networks table that are needed by Quantum but not the FlatManager. """ admin_context = context.elevated() subnet_size = len(netaddr.IPNetwork(cidr)) networks = manager.FlatManager.create_networks(self.net_manager, admin_context, label, cidr, False, 1, subnet_size, cidr_v6, gateway, gateway_v6, quantum_net_id, None, dns1, dns2) if len(networks) != 1: raise Exception(_("Error creating network entry")) network = networks[0] net = {"project_id": tenant_id, "priority": priority, "uuid": quantum_net_id} db.network_update(admin_context, network['id'], net)