Skip to content

Commit

Permalink
Add private_key parameter for Synefo sites: #467
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Oct 30, 2017
1 parent 266ab85 commit 2de9c26
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions IM/connectors/OCCI.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,26 +854,20 @@ def launch(self, inf, radl, requested_radl, num_vm, auth_data):
volumes = self.create_volumes(system, auth_data)

body = 'Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"\n'
body += 'Category: ' + os_tpl + '; scheme="' + \
os_tpl_scheme + '"; class="mixin"\n'
body += 'Category: ' + os_tpl + '; scheme="' + os_tpl_scheme + '"; class="mixin"\n'
body += 'Category: user_data; scheme="http://schemas.openstack.org/compute/instance#"; class="mixin"\n'
# body += 'Category: public_key;
# scheme="http://schemas.openstack.org/instance/credentials#";
# class="mixin"\n'
body += 'Category: public_key; scheme="http://schemas.openstack.org/instance/credentials#";' + \
' class="mixin"\n'

if instance_type_uri:
body += 'Category: ' + instance_name + '; scheme="' + \
instance_scheme + '"; class="mixin"\n'
body += 'Category: ' + instance_name + '; scheme="' + instance_scheme + '"; class="mixin"\n'
else:
# Try to use this OCCI attributes (not supported by
# openstack)
# Try to use this OCCI attributes (not supported by openstack)
if cpu:
body += 'X-OCCI-Attribute: occi.compute.cores=' + \
str(cpu) + '\n'
body += 'X-OCCI-Attribute: occi.compute.cores=' + str(cpu) + '\n'
# body += 'X-OCCI-Attribute: occi.compute.architecture=' + arch +'\n'
if memory:
body += 'X-OCCI-Attribute: occi.compute.memory=' + \
str(memory) + '\n'
body += 'X-OCCI-Attribute: occi.compute.memory=' + str(memory) + '\n'

compute_id = "im.%s" % str(uuid.uuid1())
body += 'X-OCCI-Attribute: occi.core.id="' + compute_id + '"\n'
Expand All @@ -886,11 +880,10 @@ def launch(self, inf, radl, requested_radl, num_vm, auth_data):
default_domain=Config.DEFAULT_DOMAIN)

body += 'X-OCCI-Attribute: occi.compute.hostname="' + nodename + '"\n'
# See: https://wiki.egi.eu/wiki/HOWTO10
# body += 'X-OCCI-Attribute: org.openstack.credentials.publickey.name="my_key"'
# body += 'X-OCCI-Attribute: org.openstack.credentials.publickey.data="ssh-rsa BAA...zxe ==user@host"'
if user_data:
body += 'X-OCCI-Attribute: org.openstack.compute.user_data="' + user_data + '"\n'
if public_key:
body += 'X-OCCI-Attribute: org.openstack.credentials.publickey.data="' + public_key + '"\n'

# Add volume links
for device, volume_id in volumes:
Expand Down

0 comments on commit 2de9c26

Please sign in to comment.