summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKashyap Kopparam <kashyapk@thoughtworks.com>2014-11-04 12:29:47 +0530
committerKashyap Kopparam <kashyapk@thoughtworks.com>2014-11-04 12:29:47 +0530
commite060e1464a709f5dc1eb2a290d8354e293fbffe1 (patch)
tree9230840221cedd58d382022bcb4ec6f6ab4532f1
parent448797f034f9e3ccaeac5d9e49293c470af2b954 (diff)
Venu and Kashyap | moved the aws keys from our config file to nova.conf and importing those values using cfg
-rw-r--r--README.md16
-rw-r--r--ec2driver.py11
-rw-r--r--ec2driver_standard_config.py2
3 files changed, 19 insertions, 10 deletions
diff --git a/README.md b/README.md
index df4af6c..af53141 100644
--- a/README.md
+++ b/README.md
@@ -21,14 +21,22 @@ Using the native OpenStack Dashboard or APIs you would be able to manage the EC2
21- VirtualBox 21- VirtualBox
22- Vagrant 22- Vagrant
23 23
24###Instructions 24###Instructions for Developer environment
251. Clone this repository: `git clone https://github.com/ThoughtWorksInc/OpenStack-EC2-Driver.git` 251. Clone this repository: `git clone https://github.com/ThoughtWorksInc/OpenStack-EC2-Driver.git`
262. Run`vagrant up` from within the repository to create an Ubuntu virtualbox that will install devstack. This will take a couple minutes. 262. Run`vagrant up` from within the repository to create an Ubuntu virtualbox that will install devstack. This will take a couple minutes.
273. `vagrant ssh` to ssh into the new machine 273. `vagrant ssh` to ssh into the new machine
284. Use `vim /etc/nova/nova.conf` to edit the nova configuration so that 284. Use `vim /etc/nova/nova.conf` to edit the nova configuration so that
29 - the compute_driver is set to ec2.EC2Driver 29
30 - under the [conductor] section, add the following line 30 [DEFAULT]
31 use_local = True 31 compute_driver=ec2.EC2Driver
32
33 [conductor]
34 use_local=True
35
36 [ec2driver]
37 ec2_secret_access_key = <your_aws_secret_access_key>
38 ec2_access_key_id = <your_aws_access_key_id>
39
325. Restart nova 405. Restart nova
33 - `~/devstack/rejoin-stack.sh` 41 - `~/devstack/rejoin-stack.sh`
34 - go to the nova-cpu screen (`ctrl+a`, `6`) 42 - go to the nova-cpu screen (`ctrl+a`, `6`)
diff --git a/ec2driver.py b/ec2driver.py
index ff52b72..ada1465 100644
--- a/ec2driver.py
+++ b/ec2driver.py
@@ -67,6 +67,10 @@ ec2driver_opts = [
67 cfg.BoolOpt('use_linked_clone', 67 cfg.BoolOpt('use_linked_clone',
68 default=True, 68 default=True,
69 help='Whether to use linked clone'), 69 help='Whether to use linked clone'),
70 cfg.StrOpt('ec2_secret_access_key',
71 help='The secret access key of the Amazon Web Services account'),
72 cfg.StrOpt('ec2_access_key_id',
73 help='The access key ID of the Amazon Web Services account'),
70] 74]
71 75
72CONF = cfg.CONF 76CONF = cfg.CONF
@@ -140,17 +144,16 @@ class EC2Driver(driver.ComputeDriver):
140 144
141 self.creds = get_nova_creds() 145 self.creds = get_nova_creds()
142 self.nova = client.Client(**self.creds) 146 self.nova = client.Client(**self.creds)
143
144 region = RegionInfo(name=aws_region, endpoint=aws_endpoint) 147 region = RegionInfo(name=aws_region, endpoint=aws_endpoint)
145 self.ec2_conn = ec2.EC2Connection(aws_access_key_id=aws_access_key_id, 148 self.ec2_conn = ec2.EC2Connection(aws_access_key_id=CONF.ec2driver.ec2_access_key_id,
146 aws_secret_access_key=aws_secret_access_key, 149 aws_secret_access_key=CONF.ec2driver.ec2_secret_access_key,
147 host=host, 150 host=host,
148 port=port, 151 port=port,
149 region=region, 152 region=region,
150 is_secure=secure) 153 is_secure=secure)
151 154
152 self.cloudwatch_conn = ec2.cloudwatch.connect_to_region( 155 self.cloudwatch_conn = ec2.cloudwatch.connect_to_region(
153 aws_region, aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) 156 aws_region, aws_access_key_id=CONF.ec2driver.ec2_access_key_id, aws_secret_access_key=CONF.ec2driver.ec2_secret_access_key)
154 157
155 self.security_group_lock = Lock() 158 self.security_group_lock = Lock()
156 self.rule_comparator = rule_comparator.RuleComparator(self.ec2_conn) 159 self.rule_comparator = rule_comparator.RuleComparator(self.ec2_conn)
diff --git a/ec2driver_standard_config.py b/ec2driver_standard_config.py
index 984e425..1606d84 100644
--- a/ec2driver_standard_config.py
+++ b/ec2driver_standard_config.py
@@ -18,8 +18,6 @@ from collections import defaultdict
18 18
19aws_region = 'us-east-1' 19aws_region = 'us-east-1'
20aws_endpoint = 'ec2.us-east-1.amazonaws.com' 20aws_endpoint = 'ec2.us-east-1.amazonaws.com'
21aws_access_key_id = 'AKIAIZJDDRNNJUWZ3LXA'
22aws_secret_access_key = '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'
23port = 443 21port = 443
24host = str(port) + ":" + aws_endpoint 22host = str(port) + ":" + aws_endpoint
25secure = True 23secure = True