OpenStack中SWIFT对接测试

前端之家收集整理的这篇文章主要介绍了OpenStack中SWIFT对接测试前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我们部署好OPenStack以及Swift后,想使用开放接口对Swift进行对接,但是却找不到入口,下面就一步一步介绍一下如何使用租户,用户名和密码对接Swift。

首先,我们安装好SWIFT后,在命令行执行

nova list和keystone tenant-list都会显示错误,如下图:


是因为,我们还没有导出。

进入OPenStack主页,点Access&Security,右上角有个Download Openstack RC File,点击下载。


下载到部署Openstack的主机上,点击打开。


里面有租户,用户名和密码的内容修改之。改成以下:

  1. #!/bin/bash
  2.  
  3. # To use an OpenStack cloud you need to authenticate against the Identity
  4. # service named keystone,which returns a **Token** and **Service Catalog**.
  5. # The catalog contains the endpoints for all services the user/tenant has
  6. # access to - such as Compute,Image Service,Identity,Object Storage,Block
  7. # Storage,and Networking (code-named nova,glance,keystone,swift,# cinder,and neutron).
  8. #
  9. # *NOTE*: Using the 2.0 *Identity API* does not necessarily mean any other
  10. # OpenStack API is version 2.0. For example,your cloud provider may implement
  11. # Image API v1.1,Block Storage API v2,and Compute API v2.0. OS_AUTH_URL is
  12. # only for the Identity API served through keystone.
  13. export OS_AUTH_URL=http://192.168.111.161:5000/v2.0
  14.  
  15. # With the addition of Keystone we have standardized on the term **tenant**
  16. # as the entity that owns the resources.
  17. export OS_TENANT_ID=b69864c4cb0a44cfb98d4281c9739081
  18. export OS_TENANT_NAME="admin"
  19.  
  20. # In addition to the owning entity (tenant),openstack stores the entity
  21. # performing the action as the **user**.
  22. export OS_USERNAME="admin"
  23. export OS_PASSWORD="swift"
好了,现在你可以登录后台,新建一个文件,然后把上面的内容复制进去,执行久违的source,然后再次运行命令:
  1. [root@node-2 ~]# vi ~/openrc
  2. [root@node-2 ~]# source ~/openrc
  3. [root@node-2 ~]# nova list
  4.  
  5. [root@node-2 ~]# keystone tenant-list
  6. +----------------------------------+----------+---------+
  7. | id | name | enabled |
  8. +----------------------------------+----------+---------+
  9. | 6d0dff68ecd24215bd971a8d1935ba03 | admin | True |
  10. | d1f2d43d358743eda4e37bfd489c1163 | services | True |
  11. +----------------------------------+----------+---------+
  12. [root@node-2 ~]#

ok,搞定,接下来就用curl测试一下吧


成功返回token和URL

成功。

猜你在找的Swift相关文章