我试图将Boto(版本2.38)S3连接到我的Openstack(Juno)云并列出容器(存储桶)。
这是Python 2.7和swift3中间件(https://github.com/stackforge/swift3)。
我使用的是管理员帐户,这也是我制作的帐户,所以它不应该是权限问题。
我可以建立ec2连接并列出所有图像。
我也无法获得个人水桶。试图检索的那个有一个对象,我可以在Openstack仪表板中看到,也可以用python-swiftclient列出。
任何建议都将不胜感激!
import boto
import boto.s3.connection
from boto.s3.connection import OrdinaryCallingFormat
import logging
logging.basicConfig(filename="boto.log", level=logging.DEBUG)
A_KEY = '<access_key>'
S_KEY = '<secret_key>'
s3_conn = boto.connect_s3(
aws_access_key_id=A_KEY,
aws_secret_access_key=S_KEY,
port=8080,
host='<host>',
is_secure=False,
path='/swift/v1',
validate_certs=False,
calling_format=boto.s3.connection.OrdinaryCallingFormat())
s3_conn.get_all_buckets()
###############################################
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/macleanal/Development/cl2/lib/python2.7/site-packages/boto/s3/connection.py", line 445, in get_all_buckets
xml.sax.parseString(body, h)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/__init__.py", line 49, in parseString
parser.parse(inpsrc)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 110, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/xmlreader.py", line 125, in parse
self.close()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 225, in close
self.feed("", isFinal = 1)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 217, in feed
self._err_handler.fatalError(exc)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/handler.py", line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0: no element found
#################################################
b = s3_conn.get_bucket('Test')
#################################################
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/macleanal/Development/cl2/lib/python2.7/site-packages/boto/s3/connection.py", line 502, in get_bucket
return self.head_bucket(bucket_name, headers=headers)
File "/Users/macleanal/Development/cl2/lib/python2.7/site-packages/boto/s3/connection.py", line 549, in head_bucket
response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 204 No Content
日志:
Thu, 01 Oct 2015 13:43:48 GMT
/swift/v1/
DEBUG:boto:Signature:
AWS <access_key>
DEBUG:boto:Final headers: {'Date': 'Wed, 30 Sep 2015 20:46:39 GMT', 'Content-Length': '0', 'Authorization': u'AWS <access_key>', 'User-Agent': 'Boto/2.38.0 Python/2.7.10 Darwin/14.5.0'}
DEBUG:boto:Response headers: [('date', 'Wed, 30 Sep 2015 20:45:32 GMT'), ('content-type', 'text/plain; charset=utf-8'), ('server', 'Apache/2.4.7 (Ubuntu)')]
/swift/v1/Test/
DEBUG:boto:Signature:
AWS <access_key>
DEBUG:boto:Final headers: {'Date': 'Thu, 01 Oct 2015 13:43:48 GMT', 'Content-Length': '0', 'Authorization': u'AWS <access_key>', 'User-Agent': 'Boto/2.38.0 Python/2.7.10 Darwin/14.5.0'}
DEBUG:boto:Response headers: [('x-container-object-count', '1'), ('server', 'Apache/2.4.7 (Ubuntu)'), ('x-container-bytes-used-actual', '4096'), ('x-container-bytes-used', '1652'), ('x-container-read', '.r:*'), ('date', 'Thu, 01 Oct 2015 13:42:39 GMT'), ('content-type', 'text/plain; charset=utf-8')]
答案 0 :(得分:0)
通过使用Swift对象存储重新部署我们的开发云,这不再是一个问题。对象存储的Ceph与Boto S3 API不兼容。