From da0d8bf937a92b3b4bbf2d332494260c880444d7 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Thu, 22 Jun 2017 00:17:53 +0530 Subject: [PATCH] Added one.vm.rename xml-rpc call to rename a created vm --- opennebula_api/models.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 8059c82b..d18524c5 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -286,10 +286,7 @@ class OpenNebulaManager(): """.format(size=1024 * int(specs['disk_size']), image=image, image_uname=image_uname) - - if vm_name is not None: - vm_specs += """{template_vm_name} - """.format(template_vm_name=vm_name) + vm_specs += "" if ssh_key: vm_specs += "{ssh}".format(ssh=ssh_key) @@ -309,6 +306,13 @@ class OpenNebulaManager(): 'release', vm_id ) + + if vm_name is not None: + self.oneadmin_client.call( + 'vm.rename', + vm_id, + vm_name + ) return vm_id def delete_vm(self, vm_id):