From fb8dac7d0084c04133d77a185231b38cf209444c Mon Sep 17 00:00:00 2001 From: modulos Date: Thu, 25 May 2017 00:18:03 +0200 Subject: [PATCH] Use client to create vms and set ssh key correct --- opennebula_api/models.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 0c4e521b..600b2bd6 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -196,12 +196,15 @@ class OpenNebulaManager(): """.format(size=1024 * int(specs['disk_size']), image=image, image_uname=image_uname) - vm_id = template.instantiate(name ='', - pending=False, - extra_template=vm_specs, ) + vm_id = self.client.call(oca.VmTemplate.METHODS['instantiate'], + template.id, + '', + True, + vm_specs, + False) self.oneadmin_client.call( - 'vm.updateconf', + 'vm.update', vm_id, """ {ssh} @@ -217,6 +220,12 @@ class OpenNebulaManager(): ) except AttributeError: logger.info('Could not change owner for vm with id: {}.'.format(vm_id)) + + self.oneadmin_client.call( + oca.VirtualMachine.METHODS['action'], + 'release', + vm_id + ) return vm_id def delete_vm(self, vm_id):