Python-boto无法从实例创建图像

时间:2014-01-16 18:59:09

标签: python amazon-ec2 boto

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

输出在这里:奇怪的是消息“无效值'i-00001e17'为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。

我会感激任何想法。

1 个答案:

答案 0 :(得分:0)

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