Merge branch 'master' of github.com:open-cloud/xos
diff --git a/xos/model_policies/model_policy_Slice.py b/xos/model_policies/model_policy_Slice.py
index b610601..ac63fca 100644
--- a/xos/model_policies/model_policy_Slice.py
+++ b/xos/model_policies/model_policy_Slice.py
@@ -33,15 +33,17 @@
# make sure slice has at least 1 public and 1 private networkd
public_nets = []
- private_net = None
+ private_nets = []
networks = Network.objects.filter(owner=slice)
for network in networks:
+ if not network.autoconnect:
+ continue
if network.template.name == 'Public dedicated IPv4':
public_nets.append(network)
elif network.template.name == 'Public shared IPv4':
public_nets.append(network)
elif network.template.name == 'Private':
- private_net = network
+ private_nets.append(network)
if not public_nets:
# ensure there is at least one public network, and default it to dedicated
nat_net = Network(
@@ -52,27 +54,28 @@
nat_net.save()
public_nets.append(nat_net)
- if not private_net:
+ if not private_nets:
private_net = Network(
- name = slice.name+'-private',
- template = NetworkTemplate.objects.get(name='Private'),
- owner = slice
+ name = slice.name+'-private',
+ template = NetworkTemplate.objects.get(name='Private'),
+ owner = slice
)
private_net.save()
+ private_nets = [private_net]
# create slice networks
public_net_slice = None
private_net_slice = None
- net_slices = NetworkSlice.objects.filter(slice=slice, network__in=[private_net]+public_nets)
+ net_slices = NetworkSlice.objects.filter(slice=slice, network__in=private_nets+public_nets)
for net_slice in net_slices:
if net_slice.network in public_nets:
public_net_slice = net_slice
- elif net_slice.network == private_net:
+ elif net_slice.network in private_nets:
private_net_slice = net_slice
if not public_net_slice:
public_net_slice = NetworkSlice(slice=slice, network=public_nets[0])
public_net_slice.save()
if not private_net_slice:
- private_net_slice = NetworkSlice(slice=slice, network=private_net)
+ private_net_slice = NetworkSlice(slice=slice, network=private_nets[0])
private_net_slice.save()
diff --git a/xos/openstack_observer/event_loop.py b/xos/openstack_observer/event_loop.py
index 57d6a31..003634b 100644
--- a/xos/openstack_observer/event_loop.py
+++ b/xos/openstack_observer/event_loop.py
@@ -349,7 +349,7 @@
try:
duration=time.time() - start_time
- logger.info('Executing step %s' % sync_step.__name__)
+ logger.info('Executing step %s, deletion=%s' % (sync_step.__name__, deletion))
print bcolors.OKBLUE + "Executing step %s" % sync_step.__name__ + bcolors.ENDC
failed_objects = sync_step(failed=list(self.failed_step_objects), deletion=deletion)
@@ -359,13 +359,13 @@
if failed_objects:
self.failed_step_objects.update(failed_objects)
- logger.info("Step %r succeeded" % step)
- print bcolors.OKGREEN + "Step %r succeeded" % step + bcolors.ENDC
+ logger.info("Step %r succeeded" % sync_step.__name__)
+ print bcolors.OKGREEN + "Step %r succeeded" % sync_step.__name__ + bcolors.ENDC
my_status = STEP_STATUS_OK
self.update_run_time(sync_step,deletion)
except Exception,e:
- print bcolors.FAIL + "Model step %r failed" % (step) + bcolors.ENDC
- logger.error('Model step %r failed. This seems like a misconfiguration or bug: %r. This error will not be relayed to the user!' % (step, e))
+ print bcolors.FAIL + "Model step %r failed" % (sync_step.__name__) + bcolors.ENDC
+ logger.error('Model step %r failed. This seems like a misconfiguration or bug: %r. This error will not be relayed to the user!' % (sync_step.__name__, e))
logger.log_exc(e)
self.failed_steps.append(S)
my_status = STEP_STATUS_KO
diff --git a/xos/openstack_observer/steps/sync_network_slivers.py b/xos/openstack_observer/steps/sync_network_slivers.py
index 6746418..62eb513 100644
--- a/xos/openstack_observer/steps/sync_network_slivers.py
+++ b/xos/openstack_observer/steps/sync_network_slivers.py
@@ -144,7 +144,7 @@
# that don't have neutron ports, and create them.
for networkSliver in NetworkSliver.objects.filter(port_id__isnull=True, sliver__isnull=False):
#logger.info("XXX working on networksliver %s" % networkSliver)
- controller = sliver.node.site_deployment.controller
+ controller = networkSliver.sliver.node.site_deployment.controller
if controller:
cn=networkSliver.network.controllernetworks.filter(controller=controller)
if not cn: