使用python-博托启动OpenStack的实例 [英] Launch Openstack Instances using python-boto

查看:372
本文介绍了使用python-博托启动OpenStack的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发动对opensatck设置与使用python-博托配置了多个网络的实例。

I am trying to launch instances on opensatck setup with multiple networks configured using python-boto.

但我得到了下面的错误,

But I got following error,

EC2ResponseError:EC2ResponseError:400错误的请求 &LT; XML版本=1.0&GT?; <Response><Errors><Error><$c$c>NetworkAmbiguous</$c$c><Message>Multiple发现可能的网络,使用网络ID更specific.</Message></Error></Errors><RequestID>req-28b5a4e8-3838-4111-95db-337c5048716d</RequestID></Response>

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>

我的code是喜欢这里,

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')

以上是做工精细的配置为OpenStack的单一网络。

The above is working fine for single network configured to openstack.

注:run_instances没有关键字参数用于网络ID

Note: run_instances doesn't have keyword argument for network-id.

我在哪里犯了错或如何解决呢?或者是在python-博托错误?

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

进展表示感谢。

推荐答案

我认为,这不是博托,这是建立与AWS-API进行沟通的问题。虽然大多数的EC2-AWS功能的工作很好地与EC2-的OpenStack API,有些功能还没有实现,并回敬一个HTTP错误500或400。

I believe that this isn't a bug of boto, which was built to communicate with the AWS-API. While most of the EC2-AWS functionality work well with the EC2-OpenStack API, some features are not implemented and are answered with a HTTP-Error 500 or 400.

AWS使用VPC(虚拟私有云)网络和一个可用区的子网。既具有默认设置,其被取如果没有建立一个新的实例时进一步规范。但在OpenStack的,我不能看到一种可能性,标志着网络和子网的默认设置。

AWS use the VPC (Virtual Private Cloud) as Network and an Availability Zone as Subnet. Both have a default setting, which is taken if there is no further specification when creating a new instance. But in OpenStack I can't see a possibility to mark a Network and a Subnet as default.

在我的努力,无论是 private_ip_address subnet_id 工程指定网络/子网上的 run_instances()如果有一个以上的在OpenStack的。

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

编辑:如果你只有一个网络/子网,以下code正常工作与博托在trystack.org:

if you only have one network/subnet, the following code works fine with boto at 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")

这篇关于使用python-博托启动OpenStack的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆