From 01a072a359f4787690c02e08b7546cb8edfac2da Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Fri, 23 Jan 2015 16:22:12 +0000 Subject: [PATCH] Fix bug in CIDR allocation --- .../steps/sync_controller_networks.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/planetstack/openstack_observer/steps/sync_controller_networks.py b/planetstack/openstack_observer/steps/sync_controller_networks.py index ea888c7..47a50a0 100644 --- a/planetstack/openstack_observer/steps/sync_controller_networks.py +++ b/planetstack/openstack_observer/steps/sync_controller_networks.py @@ -18,14 +18,16 @@ class SyncControllerNetworks(OpenStackSyncStep): provides=[ControllerNetwork, Network] def alloc_subnet(self, uuid): + # 16 bits only + uuid_masked = uuid & 0xffff a = 10 - b = uuid >> 32 - c = uuid & 0xffffffff - d = 0 + b = uuid_masked >> 8 + c = uuid_masked & 0xff + d = 0 + + cidr = '%d.%d.%d.%d/24'%(a,b,c,d) + return cidr - cidr = '%d.%d.%d.%d/24'%(a,b,c,d) - return cidr - def fetch_pending(self, deleted): if (deleted): -- 2.43.0