Context fix

By setting the ssh key in the context section network information were
overwritten. We use updateconf now
This commit is contained in:
modulos 2017-05-24 20:45:20 +02:00
parent 4c5cbe5bd9
commit 17a85e3831

View file

@ -154,9 +154,6 @@ 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]
@ -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'],