Kashyap | volume swap is working and added a volume map
This commit is contained in:
parent
80f0dac557
commit
dba0a1543b
11
ec2driver.py
11
ec2driver.py
|
@ -37,6 +37,9 @@ from nova.openstack.common import loopingcall
|
|||
from nova.virt import driver
|
||||
from nova.virt import virtapi
|
||||
from nova.compute import flavors
|
||||
import base64
|
||||
import time
|
||||
from novaclient.v1_1 import client
|
||||
from credentials import get_nova_creds
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -393,6 +396,14 @@ class EC2Driver(driver.ComputeDriver):
|
|||
if instance_name not in self._mounts:
|
||||
self._mounts[instance_name] = {}
|
||||
self._mounts[instance_name][mountpoint] = new_connection_info
|
||||
|
||||
old_volume_id = old_connection_info['data']['volume_id']
|
||||
new_volume_id = new_connection_info['data']['volume_id']
|
||||
|
||||
self.detach_volume(old_connection_info, instance, mountpoint)
|
||||
# wait for the old volume to detach successfully to make sure /dev/sdn is available for the new volume to be attached
|
||||
time.sleep(60)
|
||||
self.ec2_conn.attach_volume(volume_map[new_volume_id], instance['metadata']['ec2_id'], "/dev/sdn", dry_run=False)
|
||||
return True
|
||||
|
||||
def attach_interface(self, instance, image_meta, vif):
|
||||
|
|
|
@ -29,8 +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 = {'46c7a63e-1069-4049-a4a4-648c905bf205': 'vol-83db57cb',
|
||||
'5c15bca3-fecc-4ed5-86aa-aefacb514c41': 'vol-83db57cb'}
|
||||
volume_map = {'3df37a34-662e-4aa8-b71d-b8313d2e945b': 'vol-83db57cb',
|
||||
'7d63c661-7e93-445b-b3cb-765f1c8ae4c0': 'vol-1eea8a56'}
|
||||
keypair_map = {}
|
||||
|
||||
# The limit on maximum resources you could have in the AWS EC2.
|
||||
|
|
Loading…
Reference in New Issue