From 7cc2af420b579109275ab2f7c47abc536dc7894e Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Mon, 1 May 2017 14:28:23 +0530 Subject: [PATCH] Added DEV_PREFIX parameter when creating VM, so that we create KVM virtual disk --- hosting/opennebula_functions.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hosting/opennebula_functions.py b/hosting/opennebula_functions.py index 5707f128..76029c2d 100644 --- a/hosting/opennebula_functions.py +++ b/hosting/opennebula_functions.py @@ -103,22 +103,30 @@ class HostingManageVMAdmin(admin.ModelAdmin): vm_template_int = int(vm_template) if 1 <= vm_template_int <= 8: vm_string_formatter = """ + + + {ssh_key} + + {memory} {vcpu} {cpu} {disk_type} {size} + {dev_prefix} """ vm_id = oca.VirtualMachine.allocate(self.client, - vm_string_formatter.format( - memory=1024 * vm_template_int, - vcpu=vm_template_int, - cpu=0.1 * vm_template_int, - disk_type='fs', - size=10000 * vm_template_int)) + vm_string_formatter.format( + ssh_key='' # public key of the user + memory=1024 * vm_template_int, # memory in MB + vcpu=vm_template_int, # vpcu + cpu=0.1 * vm_template_int, # cpu + disk_type='fs', + size=10000 * vm_template_int, + dev_prefix='vd')) # We need KVM virtual disk message = _("Created with id = " + str(vm_id)) messages.add_message(request, messages.SUCCESS, message) else: