From: Sapan Bhatia Date: Fri, 23 Jan 2015 16:22:12 +0000 (+0000) Subject: Fix bug in CIDR allocation X-Git-Url: http://git.onelab.eu/?p=plstackapi.git;a=commitdiff_plain;h=01a072a359f4787690c02e08b7546cb8edfac2da Fix bug in CIDR allocation --- 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):