Venu and Kashyap | moved the aws keys from our config file to nova.conf and importing those values using cfg

This commit is contained in:
Kashyap Kopparam 2014-11-04 12:29:47 +05:30
parent 448797f034
commit e060e1464a
3 changed files with 19 additions and 10 deletions

View File

@ -21,14 +21,22 @@ Using the native OpenStack Dashboard or APIs you would be able to manage the EC2
- VirtualBox
- Vagrant
###Instructions
###Instructions for Developer environment
1. Clone this repository: `git clone https://github.com/ThoughtWorksInc/OpenStack-EC2-Driver.git`
2. Run`vagrant up` from within the repository to create an Ubuntu virtualbox that will install devstack. This will take a couple minutes.
3. `vagrant ssh` to ssh into the new machine
4. Use `vim /etc/nova/nova.conf` to edit the nova configuration so that
- the compute_driver is set to ec2.EC2Driver
- under the [conductor] section, add the following line
use_local = True
[DEFAULT]
compute_driver=ec2.EC2Driver
[conductor]
use_local=True
[ec2driver]
ec2_secret_access_key = <your_aws_secret_access_key>
ec2_access_key_id = <your_aws_access_key_id>
5. Restart nova
- `~/devstack/rejoin-stack.sh`
- go to the nova-cpu screen (`ctrl+a`, `6`)

View File

@ -67,6 +67,10 @@ ec2driver_opts = [
cfg.BoolOpt('use_linked_clone',
default=True,
help='Whether to use linked clone'),
cfg.StrOpt('ec2_secret_access_key',
help='The secret access key of the Amazon Web Services account'),
cfg.StrOpt('ec2_access_key_id',
help='The access key ID of the Amazon Web Services account'),
]
CONF = cfg.CONF
@ -140,17 +144,16 @@ class EC2Driver(driver.ComputeDriver):
self.creds = get_nova_creds()
self.nova = client.Client(**self.creds)
region = RegionInfo(name=aws_region, endpoint=aws_endpoint)
self.ec2_conn = ec2.EC2Connection(aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
self.ec2_conn = ec2.EC2Connection(aws_access_key_id=CONF.ec2driver.ec2_access_key_id,
aws_secret_access_key=CONF.ec2driver.ec2_secret_access_key,
host=host,
port=port,
region=region,
is_secure=secure)
self.cloudwatch_conn = ec2.cloudwatch.connect_to_region(
aws_region, aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key)
aws_region, aws_access_key_id=CONF.ec2driver.ec2_access_key_id, aws_secret_access_key=CONF.ec2driver.ec2_secret_access_key)
self.security_group_lock = Lock()
self.rule_comparator = rule_comparator.RuleComparator(self.ec2_conn)

View File

@ -18,8 +18,6 @@ from collections import defaultdict
aws_region = 'us-east-1'
aws_endpoint = 'ec2.us-east-1.amazonaws.com'
aws_access_key_id = 'AKIAIZJDDRNNJUWZ3LXA'
aws_secret_access_key = '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'
port = 443
host = str(port) + ":" + aws_endpoint
secure = True