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):