Fix bug in CIDR allocation
authorSapan Bhatia <sapanb@cs.princeton.edu>
Fri, 23 Jan 2015 16:22:12 +0000 (16:22 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Fri, 23 Jan 2015 16:22:12 +0000 (16:22 +0000)
planetstack/openstack_observer/steps/sync_controller_networks.py

index ea888c7..47a50a0 100644 (file)
@@ -18,14 +18,16 @@ class SyncControllerNetworks(OpenStackSyncStep):
     provides=[ControllerNetwork, Network]
 
     def alloc_subnet(self, uuid):
     provides=[ControllerNetwork, Network]
 
     def alloc_subnet(self, uuid):
+        # 16 bits only
+        uuid_masked = uuid & 0xffff
         a = 10
         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):
 
     def fetch_pending(self, deleted):
         if (deleted):