fixing errors on vm creation
This commit is contained in:
		
					parent
					
						
							
								3994d2d33b
							
						
					
				
			
			
				commit
				
					
						767a5fc5da
					
				
			
		
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -88,7 +88,7 @@ class HostingManageVMAdmin(admin.ModelAdmin):
 | 
				
			||||||
        return TemplateResponse(request, "hosting/managevms.html", context)
 | 
					        return TemplateResponse(request, "hosting/managevms.html", context)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def create_vm_view(self, specs):
 | 
					    def create_vm_view(self, specs):
 | 
				
			||||||
 | 
					        vm_id = None
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            # We do have the vm_template param set. Get and parse it
 | 
					            # We do have the vm_template param set. Get and parse it
 | 
				
			||||||
            # and check it to be in the desired range.
 | 
					            # and check it to be in the desired range.
 | 
				
			||||||
| 
						 | 
					@ -107,11 +107,11 @@ class HostingManageVMAdmin(admin.ModelAdmin):
 | 
				
			||||||
            vm_id = oca.VirtualMachine.allocate(
 | 
					            vm_id = oca.VirtualMachine.allocate(
 | 
				
			||||||
                self.client,
 | 
					                self.client,
 | 
				
			||||||
                vm_string_formatter.format(
 | 
					                vm_string_formatter.format(
 | 
				
			||||||
                    memory=specs.get('memory'),
 | 
					                    memory=1024 * specs.get('memory'),
 | 
				
			||||||
                    vcpu=specs.get('cores'),
 | 
					                    vcpu=specs.get('cores'),
 | 
				
			||||||
                    cpu=0.1 * specs.get('cores'),
 | 
					                    cpu=0.1 * specs.get('cores'),
 | 
				
			||||||
                    disk_type='fs',
 | 
					                    disk_type='fs',
 | 
				
			||||||
                    size=specs.get('disk_size')
 | 
					                    size=10000 * specs.get('disk_size')
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
                # message = _("Created with id = " + str(vm_id))
 | 
					                # message = _("Created with id = " + str(vm_id))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue