From: Tony Mack Date: Mon, 7 Apr 2014 23:45:46 +0000 (-0400) Subject: Add slices to all deployments for now. Set starting subnet address. X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=6042aaf8bb8b83302faa0ebca092d2cf41bb75bf;p=plstackapi.git Add slices to all deployments for now. Set starting subnet address. --- diff --git a/planetstack/observer/steps/sync_slice_deployments.py b/planetstack/observer/steps/sync_slice_deployments.py index 9751a08..2254e7b 100644 --- a/planetstack/observer/steps/sync_slice_deployments.py +++ b/planetstack/observer/steps/sync_slice_deployments.py @@ -29,8 +29,11 @@ class SyncSliceDeployments(OpenStackSyncStep): for slice_deployment in slice_deployments: slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment) + all_deployments = Deployment.objects.filter() for slice in Slice.objects.all(): - expected_deployments = site_deploy_lookup[slice.site] + # slices are added to all deployments for now + expected_deployments = all_deployments + #expected_deployments = site_deploy_lookup[slice.site] for expected_deployment in expected_deployments: if slice not in slice_deploy_lookup or \ expected_deployment not in slice_deploy_lookup[slice]: @@ -48,6 +51,10 @@ class SyncSliceDeployments(OpenStackSyncStep): ints = [int(IPNetwork(subnet['cidr']).ip) for subnet in subnets \ if valid_subnet(subnet['cidr'])] ints.sort() + if ints: + last_ip = IPAddress(ints[-1]) + else: + last_ip = IPAddress('10.0.0.1') last_ip = IPAddress(ints[-1]) last_network = IPNetwork(str(last_ip) + "/24") next_network = IPNetwork(str(IPAddress(last_network) + last_network.size) + "/24")