Kashyap | Changed flavor map to use openstack's flavor IDs to map to EC2 flavor's IDs
This commit is contained in:
parent
dba0a1543b
commit
932f72ef6d
|
@ -175,7 +175,7 @@ class EC2Driver(driver.ComputeDriver):
|
|||
elastic_ip_address = self.ec2_conn.allocate_address(domain='vpc')
|
||||
|
||||
#Creating the EC2 instance
|
||||
flavor_type = flavor_map[instance.get_flavor().name]
|
||||
flavor_type = flavor_map[instance.get_flavor().id]
|
||||
|
||||
#passing user_data from the openstack instance which is Base64 encoded after decoding it.
|
||||
user_data = instance._user_data
|
||||
|
@ -619,14 +619,12 @@ class EC2Driver(driver.ComputeDriver):
|
|||
ec_instance_info = self.ec2_conn.get_only_instances(
|
||||
instance_ids=[ec2_id], filters=None, dry_run=False, max_results=None)
|
||||
ec2_instance = ec_instance_info[0]
|
||||
new_instance_type_name = flavors.get_flavor(
|
||||
migration['new_instance_type_id'])['name']
|
||||
|
||||
# EC2 instance needs to be stopped to modify it's attribute. So we stop the instance,
|
||||
# modify the instance type in this case, and then restart the instance.
|
||||
ec2_instance.stop()
|
||||
self._wait_for_state(instance, ec2_id, "stopped", power_state.SHUTDOWN)
|
||||
new_instance_type = flavor_map[new_instance_type_name]
|
||||
new_instance_type = flavor_map[migration['new_instance_type_id']]
|
||||
ec2_instance.modify_attribute('instanceType', new_instance_type)
|
||||
|
||||
def confirm_migration(self, migration, instance, network_info):
|
||||
|
|
|
@ -25,8 +25,8 @@ aws_ami = "ami-785bae10"
|
|||
#aws_ami = "ami-864d84ee"
|
||||
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'}
|
||||
# Mapping OpenStack's flavor IDs(which seems to be randomly assigned) to EC2's flavor names
|
||||
flavor_map = {2: 't2.micro', 5: 't2.small', 1: 't2.medium', 3: 'c3.xlarge', 4: 'c3.2xlarge'}
|
||||
#Add image maps key: image in openstack, Value: EC2_AMI_ID
|
||||
image_map = {}
|
||||
volume_map = {'3df37a34-662e-4aa8-b71d-b8313d2e945b': 'vol-83db57cb',
|
||||
|
|
Loading…
Reference in New Issue