add service.public_key; make sync_slivers get image id from ControllerImage object
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index f7259ae..eb6e29f 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -16,6 +16,7 @@
published = models.BooleanField(default=True)
view_url = StrippedCharField(blank=True, null=True, max_length=1024)
icon_url = StrippedCharField(blank=True, null=True, max_length=1024)
+ public_key = models.TextField(null=True, blank=True, max_length=1024, help_text="Public key string")
def __init__(self, *args, **kwargs):
# for subclasses, set the default kind appropriately
diff --git a/xos/openstack_observer/steps/sync_slivers.py b/xos/openstack_observer/steps/sync_slivers.py
index de17791..ca0c52c 100644
--- a/xos/openstack_observer/steps/sync_slivers.py
+++ b/xos/openstack_observer/steps/sync_slivers.py
@@ -47,6 +47,9 @@
if sliver.slice.creator.public_key:
pubkeys.add(sliver.slice.creator.public_key)
+ if sliver.slice.service and sliver.slice.service.public_key:
+ pubkeys.add(sliver.slice.service.public_key)
+
nics = []
networks = [ns.network for ns in NetworkSlice.objects.filter(slice=sliver.slice)]
controller_networks = ControllerNetwork.objects.filter(network__in=networks,
@@ -73,16 +76,20 @@
if net['name']=='public':
nics.append(net['id'])
- # look up image id
- if (not sliver.image.id):
+ image_id = None
+ controller_images = sliver.image.controllerimages.filter(controller=sliver.node.site_deployment.controller)
+ if controller_images:
+ image_id = controller_images[0].glance_image_id
+ logger.info("using image_id from ControllerImage object: " + str(image_id))
+
+ if image_id is None:
controller_driver = self.driver.admin_driver(controller=sliver.node.site_deployment.controller)
image_id = None
images = controller_driver.shell.glanceclient.images.list()
for image in images:
if image.name == sliver.image.name or not image_id:
image_id = image.id
- else:
- image_id = sliver.image.id
+ logger.info("using image_id from glance: " + str(image_id))
try:
legacy = Config().observer_legacy