标签:
首先先使用“glance image-delete”命令删除所有镜像,释放磁盘空间。
停止glance服务:
service openstack-glance-api stop
service openstack-glance-registry stop
停止swift服务:
service openstack-swift-proxy stop
service openstack-swift-account stop
service openstack-swift-account-auditor stop
service openstack-swift-account-reaper stop
service openstack-swift-account-replicator stop
service openstack-swift-container stop
service openstack-swift-container-auditor stop
service openstack-swift-container-replicator stop
service openstack-swift-container-updater stop
service openstack-swift-object stop
service openstack-swift-object-auditor stop
service openstack-swift-object-replicator stop
service openstack-swift-object-updater stop
禁用swift服务:
chkconfig openstack-swift-proxy off
chkconfig openstack-swift-account off
chkconfig openstack-swift-account-auditor off
chkconfig openstack-swift-account-reaper off
chkconfig openstack-swift-account-replicator off
chkconfig openstack-swift-container off
chkconfig openstack-swift-container-auditor off
chkconfig openstack-swift-container-replicator off
chkconfig openstack-swift-container-updater off
chkconfig openstack-swift-object off
chkconfig openstack-swift-object-auditor off
chkconfig openstack-swift-object-replicator off
chkconfig openstack-swift-object-updater off
备份glance配置文件:
cp -a /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
cat /etc/glance/glance-api.conf.bak|grep -v ‘#‘|grep -v ‘^$‘>/etc/glance/glance-api.conf
[glance_store]
stores=glance.store.swift.Store,glance.store.http.Store
swift_store_auth_version=2
swift_store_auth_address=http://168.5.23.2:5000/v2.0/
swift_store_user=services:glance
swift_store_key=bF5x7NId
swift_store_container=glance
swift_store_create_container_on_put=True
swift_store_large_object_size=5120
default_store=swift
swift_store_endpoint_type=internalURL
改为:
[glance_store]
default_store=file
filesystem_store_datadir=/var/lib/glance/images
卸载挂载点并授权:
umount /var/lib/glance
rm -rf /var/lib/glance/*
mkdir -p /var/lib/glance/images
chown -R glance:glance /var/lib/glance
挂载NFS:
mount 168.5.22.100:/images /var/lib/glance/images
chown -R glance:glance /var/lib/glance/images
chmod 755 /var/lib/glance/images
修改fstab文件:
vi /etc/fstab
UUID=bb4264a8-3eb0-4ac1-93a2-0ef17821c40a /var/lib/glance xfs defaults 0 0
改为:
168.5.22.100:/images /var/lib/glance/images nfs defaults 0 0
查看glance用户密码:
cat /etc/glance/glance-api.conf|grep sql_connection
sql_connection=mysql://glance:6caYCZH8@168.5.23.2/glance?read_timeout=60
密码是:6caYCZH8
使用glance用户重建数据库:
mysql -u glance -p -e ‘drop database glance;‘
mysql -u glance -p -e ‘create database glance;‘
在任一节点:
su -s /bin/sh -c "glance-manage db sync" glance
在任一节点:
source openrc
keystone endpoint-delete 41dca7df60244d7a8b509e019560c1d9
keystone service-delete b7409203b63348d9acefe5463e3880e3
启动glance服务:
service openstack-glance-api start
service openstack-glance-registry start
测试上传镜像:
glance image-create --name "TestVM" --file /root/TestVM.img --disk-format qcow2 --container-format bare --is-public True --progress
标签:
原文地址:http://www.cnblogs.com/endoresu/p/5124266.html