【问题标题】:Python-boto fails to create image from an instancePython-boto 无法从实例创建图像
【发布时间】:2014-01-17 05:13:05
【问题描述】:

Python-boto 无法创建正在运行的实例的快照(具有相同提供程序和相同实例的 python-novaclient 可以正常工作)。

输出在这里:奇怪的是消息“invalid value 'i-00001e17' for instanceId。”

>>> cc = EC2Connection(...)    # Normally working connection
>>>
>>> vm = cc.get_all_instances()[4].instances[0] # Get one of the running instances
send: 'POST /services/Cloud/ HTTP/1.1\r\nAccept-Encoding: ...'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: text/xml
header: Content-Length: 4753
header: Date: Thu, 16 Jan 2014 18:51:06 GMT
>>>
>>> vm.id  # Print the id
u'i-00001e17'
>>>
>>> cc.create_image(vm.id, "newSnapshot")  # THE PROBLEM: fails to create image
send: 'POST /services/Cloud/ HTTP/1.1\r\nAccept-Encoding:...'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Content-Type: text/xml
header: Content-Length: 303
header: Date: Thu, 16 Jan 2014 18:51:29 GMT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/boto/ec2/connection.py", line 422, in create_image
    img = self.get_object('CreateImage', params, Image, verb='POST')
  File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 1139, in get_object
    raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0"?>
<Response><Errors><Error><Code>InvalidParameterValue</Code><Message>Invalid value &apos;i-00001e17&apos; for instanceId. Instance does not have a volume attached at root (/dev/vda)</Message></Error></Errors><RequestID>req-0fd661c5-8ab1-4520-9c95-31f22b8354f1</RequestID></Response>
>>>

系统:Ubuntu 13.04,Python 版本:2.7.4,boto 版本:2.19.0。

如有任何想法,我将不胜感激。

【问题讨论】:

  • 错误消息显示Instance does not have a volume attached at root (/dev/vda)。听起来它不是 EBS 支持的实例。
  • 感谢您的提示,我会调查的。但是 - 你知道为什么 OpenStack 本地客户端会做这项工作吗(我试过了)?
  • 对不起,我不知道。是否可以在两者中打开调试日志并比较正在发出的实际请求?
  • 好主意,会这样做,谢谢。

标签: python amazon-ec2 boto


【解决方案1】:

确保 EBS 驱动器在控制台中具有名称 /dev/vda。你在使用 OpenStack 还是什么?它看起来不像 EC2。

【讨论】:

  • 是的,它是 OpenStack,但它具有 EC2 兼容的访问权限。
  • OpenStack 支持 EC2 API,但它不是 100% 兼容的,请记住这一点
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-26
  • 2015-08-16
  • 1970-01-01
  • 2011-07-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多