Running Openstack instances using python-boto

I am trying to run instances in the opensatck setup with multiple networks configured with python-boto.

But I got the following error,

EC2ResponseError: EC2ResponseError: 400 Bad Request <?xml version="1.0"?> <Response><Errors><Error><Code>NetworkAmbiguous</Code><Message>Multiple possible networks found, use a Network ID to be more specific.</Message></Error></Errors><RequestID>req-28b5a4e8-3838-4111-95db-337c5048716d</RequestID></Response>

My code is like here

 from boto import ec2 ostack = ec2.connection.EC2Connection( ec2_access_key, ec2_secret_key, is_secure=False, port=8773, region='nova', path='/services/Cloud' ) ostack.run_instances('ami-xxxxx', key_name='BotoTest') 

The above works fine for a single network configured on openstack.

Note: run_instances does not have a keyword argument for the network identifier.

Where did I make a mistake or how to fix it? or is this a bug in python-boto?

In gratitude.

+6
source share
2 answers

I believe this is not a boto error that was created to communicate with the AWS-API. Although most of the features of EC2-AWS work well with the EC2-OpenStack API, some functions are not implemented and they respond to an HTTP error of 500 or 400.

AWS uses VPC (Virtual Private Cloud) as a network and Availability Zone as a subnet. Both have a default setting that is executed if there is no additional specification when creating a new instance. But in OpenStack, I see no way to mark the network and subnet by default.

In my attempts, neither private_ip_address nor subnet_id works to specify the network / subnet in run_instances() , if there are more than one of them in OpenStack.

Edit: if you have only one network / subnet, the following code works fine with boto on trystack.org:

 import boto conn = boto.connect_ec2_endpoint("http://8.21.28.222:8773/services/Cloud",aws_access_key_id='...',aws_secret_access_key='...') new_instance = conn.run_instances("ami-00000020", key_name="trystack", security_groups=["default"], instance_type="m1.small") 
+2
source

You tried?

 from boto import ec2 ostack = ec2.connection.EC2Connection( ec2_access_key, ec2_secret_key, is_secure=False, port=8773, region='nova', path='/services/Cloud', debug=1 ) 

then

 ostack.run_instances('ami-xxxxx', subnet_id='your network id', key_name='BotoTest') 

Does Amazon use this for VPC networks? Do you use VPC?

0
source

All Articles