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 - VirtualBox
- Vagrant - Vagrant
###Instructions ###Instructions for Developer environment
1. Clone this repository: `git clone https://github.com/ThoughtWorksInc/OpenStack-EC2-Driver.git` 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. 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 3. `vagrant ssh` to ssh into the new machine
4. Use `vim /etc/nova/nova.conf` to edit the nova configuration so that 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 [DEFAULT]
use_local = True 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 5. Restart nova
- `~/devstack/rejoin-stack.sh` - `~/devstack/rejoin-stack.sh`
- go to the nova-cpu screen (`ctrl+a`, `6`) - go to the nova-cpu screen (`ctrl+a`, `6`)

View File

@@ -67,6 +67,10 @@ ec2driver_opts = [
cfg.BoolOpt('use_linked_clone', cfg.BoolOpt('use_linked_clone',
default=True, default=True,
help='Whether to use linked clone'), 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 CONF = cfg.CONF
@@ -140,17 +144,16 @@ class EC2Driver(driver.ComputeDriver):
self.creds = get_nova_creds() self.creds = get_nova_creds()
self.nova = client.Client(**self.creds) self.nova = client.Client(**self.creds)
region = RegionInfo(name=aws_region, endpoint=aws_endpoint) region = RegionInfo(name=aws_region, endpoint=aws_endpoint)
self.ec2_conn = ec2.EC2Connection(aws_access_key_id=aws_access_key_id, self.ec2_conn = ec2.EC2Connection(aws_access_key_id=CONF.ec2driver.ec2_access_key_id,
aws_secret_access_key=aws_secret_access_key, aws_secret_access_key=CONF.ec2driver.ec2_secret_access_key,
host=host, host=host,
port=port, port=port,
region=region, region=region,
is_secure=secure) is_secure=secure)
self.cloudwatch_conn = ec2.cloudwatch.connect_to_region( 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.security_group_lock = Lock()
self.rule_comparator = rule_comparator.RuleComparator(self.ec2_conn) 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_region = 'us-east-1'
aws_endpoint = 'ec2.us-east-1.amazonaws.com' aws_endpoint = 'ec2.us-east-1.amazonaws.com'
aws_access_key_id = 'AKIAIZJDDRNNJUWZ3LXA'
aws_secret_access_key = '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'
port = 443 port = 443
host = str(port) + ":" + aws_endpoint host = str(port) + ":" + aws_endpoint
secure = True secure = True