Swift   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用Swift作为Glance后端存储大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

原文链接 http://thornelabs.net/2014/08/03/use-openstack-swift-as-a-backend-store-for-glance.html By default, OpenStack Glance saves images and OpenStack Instance snapshots on the local filesystem  in /var

原文链接http://thornelabs.net/2014/08/03/use-openstack-swift-as-a-backend-store-for-glance.html@H_419_2@


@H_419_2@

By default,OpenStack Glance saves images and OpenStack Instance snapshots on the local filesystem@H_419_2@


@H_419_2@

in@H_419_2@/var/lib/glance/images/@H_419_2@.@H_419_2@

However,if you have a Swift Cluster,you can just as easily use it to save images and snapshots instead of the@H_419_2@

local@H_419_2@filesystem where Glance is running.@H_419_2@

Begin by logging into the node running the Glance services (probably your controller node also running Keystone)@H_419_2@

as root and source your OpenStack credentials (this is typically a file named@H_419_2@openrc@H_419_2@).@H_419_2@


@H_419_2@

source ~/openrc

Verify the userglance@H_419_2@is part of tenantservice@H_419_2@with roleadmin@H_419_2@.@H_419_2@


@H_419_2@

keystone user-role-list --user glance --tenant service

One of the roles returned should beadmin@H_419_2@.@H_419_2@

Open/etc/glance/glance-api.conf@H_419_2@and comment out the following two lines:@H_419_2@

##### DEFAULT OPTIONS ##### #default_store = file #filesystem_store_datadir = /var/lib/glance/images/

With/etc/glance/glance-api.conf@H_419_2@still open,append the following lines to theDEFAULT OPTIONS@H_419_2@section (be@H_419_2@

sure@H_419_2@to set the values inside@H_419_2@< >@H_419_2@to match your environment):@H_419_2@


@H_419_2@

default_store = swift
swift_store_auth_address = http://<IP_OF_KEYSTONE>:35357/v2.0/
swift_store_user = service:glance
swift_store_key = <VALUE OF __admin_password__ ATTRIBUTE IN __/etc/glance/glance-api.conf__>
swift_store_create_container_on_put = True

With the configuration changes in place,restart the Glance services.@H_419_2@

If you are runningCentOS/RHEL@H_419_2@:@H_419_2@

service openstack-glance-api restart service openstack-glance-registry restart

If you are runningUbuntu@H_419_2@:@H_419_2@

service glance-api restart service glance-registry restart

Now you should be able to upload an image to Glance through the Horizon Dashboard or using the glance@H_419_2@

command and instead of it being saved to@H_419_2@/var/lib/glance/images@H_419_2@,it will be saved in a Swift Container@H_419_2@


@H_419_2@

called@H_419_2@glance@H_419_2@in the@H_419_2@service@H_419_2@account.@H_419_2@

Verify nothing is saved in/var/lib/glance/images@H_419_2@by simply running@H_419_164@ls /var/lib/glance/images(if you did not@H_419_2@

delete any existing Glance Images,they will still be there).@H_419_2@

Once the Horizon Dashboard or theglance image-listreports the image isactive@H_419_2@,you can verify the images@H_419_2@

are in Swift by running the following command (be sure to set the values inside< >@H_419_2@to match your environment):@H_419_2@

swift --os-auth-url http://<IP_OF_KEYSTONE>:5000/v2.0 --os-tenant-name service --os-username glance --os-password <PASSWORD USED IN swift_store_key ABOVE> list glance

大佬总结

以上是大佬教程为你收集整理的使用Swift作为Glance后端存储全部内容,希望文章能够帮你解决使用Swift作为Glance后端存储所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: