Refactored obtaining vm price to utils.hosting_utils.get_vm_price
This commit is contained in:
		
					parent
					
						
							
								dd3c967500
							
						
					
				
			
			
				commit
				
					
						3bb7f09d41
					
				
			
		
					 1 changed files with 13 additions and 0 deletions
				
			
		|  | @ -9,3 +9,16 @@ def get_all_public_keys(customer): | ||||||
|     """ |     """ | ||||||
|     return UserHostingKey.objects.filter(user_id=customer.id).values_list( |     return UserHostingKey.objects.filter(user_id=customer.id).values_list( | ||||||
|         "public_key", flat=True) |         "public_key", flat=True) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def get_vm_price(cpu, memory, disk_size): | ||||||
|  |     """ | ||||||
|  |     A helper function that computes price of a VM from given cpu, ram and | ||||||
|  |     ssd parameters | ||||||
|  | 
 | ||||||
|  |     :param cpu: Number of cores of the VM | ||||||
|  |     :param memory: RAM of the VM | ||||||
|  |     :param disk_size: Disk space of the VM | ||||||
|  |     :return: The price of the VM | ||||||
|  |     """ | ||||||
|  |     return (cpu * 5) + (memory * 2) + (disk_size * 0.6) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue