Kashyap | Added flavor mapping using the config file
This commit is contained in:
		| @@ -147,6 +147,7 @@ class EC2Driver(driver.ComputeDriver): | |||||||
|     def spawn(self, context, instance, image_meta, injected_files, |     def spawn(self, context, instance, image_meta, injected_files, | ||||||
|               admin_password, network_info=None, block_device_info=None): |               admin_password, network_info=None, block_device_info=None): | ||||||
|         #Creating the EC2 instance |         #Creating the EC2 instance | ||||||
|  |         instance_type = flavor_map[instance.get_flavor().name] | ||||||
|         reservation = self.ec2_conn.run_instances(aws_ami, instance_type=instance_type) |         reservation = self.ec2_conn.run_instances(aws_ami, instance_type=instance_type) | ||||||
|         ec2_instance = reservation.instances |         ec2_instance = reservation.instances | ||||||
|         instance['metadata'].update({'ec2_id':ec2_instance[0].id}) |         instance['metadata'].update({'ec2_id':ec2_instance[0].id}) | ||||||
|   | |||||||
| @@ -21,3 +21,9 @@ aws_secret_access_key = "FMld6m8kok9jpxBkORST5xfbZSod7mVm9ChDgttS" | |||||||
|  |  | ||||||
| aws_ami = "ami-864d84ee" | aws_ami = "ami-864d84ee" | ||||||
| instance_type = "t2.micro" | instance_type = "t2.micro" | ||||||
|  |  | ||||||
|  | flavor_map={ 'm1.tiny':'t2.micro', | ||||||
|  | 			 'm1.small':'t2.small', | ||||||
|  | 			 'm1.medium':'t2.medium', | ||||||
|  | 			 'm1.large':'c3.xlarge', | ||||||
|  | 			 'm1.xlarge':'c3.2xlarge'} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kashyap Kopparam
					Kashyap Kopparam