Kashyap | Added volume_map to attach and detach volume mapping cinder volumes to ebs volumes
This commit is contained in:
parent
e46a51dd89
commit
2629d9f695
|
@ -371,7 +371,10 @@ class EC2Driver(driver.ComputeDriver):
|
|||
if instance_name not in self._mounts:
|
||||
self._mounts[instance_name] = {}
|
||||
self._mounts[instance_name][mountpoint] = connection_info
|
||||
self.ec2_conn.attach_volume("vol-83db57cb", instance['metadata']['ec2_id'], "/dev/sdn", dry_run=False)
|
||||
|
||||
volume_id = connection_info['data']['volume_id']
|
||||
# ec2 only attaches volumes at /dev/sdf through /dev/sdp
|
||||
self.ec2_conn.attach_volume(volume_map[volume_id], instance['metadata']['ec2_id'], "/dev/sdn", dry_run=False)
|
||||
|
||||
def detach_volume(self, connection_info, instance, mountpoint,
|
||||
encryption=None):
|
||||
|
@ -380,7 +383,8 @@ class EC2Driver(driver.ComputeDriver):
|
|||
del self._mounts[instance['name']][mountpoint]
|
||||
except KeyError:
|
||||
pass
|
||||
return True
|
||||
volume_id = connection_info['data']['volume_id']
|
||||
self.ec2_conn.detach_volume(volume_map[volume_id], instance_id=instance['metadata']['ec2_id'], device="/dev/sdn", force=False, dry_run=False)
|
||||
|
||||
def swap_volume(self, old_connection_info, new_connection_info,
|
||||
instance, mountpoint):
|
||||
|
|
|
@ -29,7 +29,8 @@ flavor_map = {'m1.tiny': 't2.micro', 'm1.small': 't2.small', 'm1.medium': 't2.me
|
|||
'm1.xlarge': 'c3.2xlarge'}
|
||||
#Add image maps key: image in openstack, Value: EC2_AMI_ID
|
||||
image_map = {}
|
||||
volume_map = {}
|
||||
volume_map = {'46c7a63e-1069-4049-a4a4-648c905bf205': 'vol-83db57cb',
|
||||
'5c15bca3-fecc-4ed5-86aa-aefacb514c41': 'vol-83db57cb'}
|
||||
keypair_map = {}
|
||||
|
||||
# The limit on maximum resources you could have in the AWS EC2.
|
||||
|
|
|
@ -194,8 +194,6 @@ class EC2DriverTest(unittest.TestCase):
|
|||
print raw_response
|
||||
self.assertEqual(raw_response.code, 200)
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def tearDown(self):
|
||||
print "Cleanup: Destroying the instance used for testing"
|
||||
|
|
Loading…
Reference in New Issue