Merge pull request #274 from Modulos/develop

Context fix
This commit is contained in:
Noe 2017-05-24 20:47:54 +02:00 committed by GitHub
commit 7a5555fe99

View file

@ -154,10 +154,7 @@ class OpenNebulaManager():
<MEMORY>{memory}</MEMORY> <MEMORY>{memory}</MEMORY>
<VCPU>{vcpu}</VCPU> <VCPU>{vcpu}</VCPU>
<CPU>{cpu}</CPU> <CPU>{cpu}</CPU>
<CONTEXT> """
<SSH_PUBLIC_KEY>{ssh}</SSH_PUBLIC_KEY>
</CONTEXT>
"""
try: try:
disk = template.template.disks[0] disk = template.template.disks[0]
image_id = disk.image_id image_id = disk.image_id
@ -165,7 +162,6 @@ class OpenNebulaManager():
vcpu=int(specs['cpu']), vcpu=int(specs['cpu']),
cpu=0.1* int(specs['cpu']), cpu=0.1* int(specs['cpu']),
memory=1024 * int(specs['memory']), memory=1024 * int(specs['memory']),
ssh=ssh_key
) )
vm_specs += """<DISK> vm_specs += """<DISK>
@ -187,7 +183,6 @@ class OpenNebulaManager():
vcpu=int(specs['cpu']), vcpu=int(specs['cpu']),
cpu=0.1* int(specs['cpu']), cpu=0.1* int(specs['cpu']),
memory=1024 * int(specs['memory']), memory=1024 * int(specs['memory']),
ssh=ssh_key
) )
vm_specs += """<DISK> vm_specs += """<DISK>
@ -205,6 +200,14 @@ class OpenNebulaManager():
pending=False, pending=False,
extra_template=vm_specs, ) extra_template=vm_specs, )
self.oneadmin_client.call(
'vm.updateconf',
vm_id,
"""<CONTEXT>
<SSH_PUBLIC_KEY>{ssh}</SSH_PUBLIC_KEY>
</CONTEXT>
""".format(ssh=ssh_key)
)
try: try:
self.oneadmin_client.call( self.oneadmin_client.call(
oca.VirtualMachine.METHODS['chown'], oca.VirtualMachine.METHODS['chown'],