more review cleanup
This commit is contained in:
@@ -103,16 +103,16 @@ class QuantumManager(manager.FlatManager):
|
||||
priority, cidr, gateway_v6, cidr_v6, dns1, dns2)
|
||||
|
||||
def delete_network(self, context, fixed_range):
|
||||
""" Lookup network by IPv4 cidr, delete both the IPAM
|
||||
subnet and the corresponding Quantum network.
|
||||
"""
|
||||
project_id = context.project_id
|
||||
quantum_net_id = self.ipam.get_network_id_by_cidr(
|
||||
""" Lookup network by IPv4 cidr, delete both the IPAM
|
||||
subnet and the corresponding Quantum network.
|
||||
"""
|
||||
project_id = context.project_id
|
||||
quantum_net_id = self.ipam.get_network_id_by_cidr(
|
||||
context, fixed_range, project_id)
|
||||
self.ipam.delete_subnets_by_net_id(context, quantum_net_id,
|
||||
self.ipam.delete_subnets_by_net_id(context, quantum_net_id,
|
||||
project_id)
|
||||
q_tenant_id = project_id or FLAGS.quantum_default_tenant_id
|
||||
self.q_conn.delete_network(q_tenant_id, quantum_net_id)
|
||||
q_tenant_id = project_id or FLAGS.quantum_default_tenant_id
|
||||
self.q_conn.delete_network(q_tenant_id, quantum_net_id)
|
||||
|
||||
def allocate_for_instance(self, context, **kwargs):
|
||||
""" Called by compute when it is creating a new VM.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import math
|
||||
import netaddr
|
||||
|
||||
from nova import db
|
||||
from nova import exception
|
||||
@@ -60,8 +60,7 @@ class QuantumNovaIPAMLib(object):
|
||||
are needed by Quantum but not the FlatManager.
|
||||
"""
|
||||
admin_context = context.elevated()
|
||||
# FIXME(danwent): Use the netaddr library here
|
||||
subnet_size = int(math.pow(2, (32 - int(cidr.split("/")[1]))))
|
||||
subnet_size = len(netaddr.IPNetwork(cidr))
|
||||
networks = manager.FlatManager.create_networks(self.net_manager,
|
||||
admin_context, label, cidr,
|
||||
False, 1, subnet_size, cidr_v6,
|
||||
@@ -114,8 +113,7 @@ class QuantumNovaIPAMLib(object):
|
||||
return sorted(net_list, key=lambda x: id_priority_map[x[0]])
|
||||
|
||||
def allocate_fixed_ip(self, context, tenant_id, quantum_net_id, vif_rec):
|
||||
""" Allocates a single fixed IPv4 address for a virtual interface.
|
||||
"""
|
||||
""" Allocates a single fixed IPv4 address for a virtual interface."""
|
||||
admin_context = context.elevated()
|
||||
network = db.network_get_by_uuid(admin_context, quantum_net_id)
|
||||
if network['cidr']:
|
||||
|
||||
Reference in New Issue
Block a user