openstack安装--glance

阅读更多
创建glance数据库
mysql -u root -p
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
flush privileges

创建glance用户
openstack user create --domain default --password-prompt glance


在service-project下为glance用户创建admin角色
openstack role add --project service --user glance admin


创建glance服务
openstack service create --name glance --description "OpenStack Image service" image


Create the Image service API endpoints:
openstack endpoint create --region RegionOne  image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
 openstack endpoint create --region RegionOne image admin http://controller:9292


安装glance相关的packages
yum install openstack-glance python-glance python-glanceclient



vim /etc/glance/glance-api.conf(已经存在的文件)
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS

[paste_deploy]
...
flavor = keystone

[glance_store]
...
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

[DEFAULT]
...
notification_driver = noop
[DEFAULT]
...
verbose = True  //可选配置,我没选



vim /etc/glance/glance-registry.conf
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS

[paste_deploy]
...
flavor = keystone

[DEFAULT]
...
notification_driver = noop
[DEFAULT]
...
verbose = True //可选



同步glance数据库,同步之前glance数据库里无任何内容,同步之后有n张表
su -s /bin/sh -c "glance-manage db_sync" glance //之前要手动建glance数据库


启动并设置glance服务开机启动

systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service



增加环境变量
echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh


source admin-openrc.sh

验证glance服务是否安装成功
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
 glance image-create --name "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress
glance image-list

glance命令
[root@station140 ~(keystone_admin)]# glance help  | grep image  
              [--os-image-url OS_IMAGE_URL] [-U OS_IMAGE_URL]  
              [--os-image-api-version OS_IMAGE_API_VERSION]  
    add                 DEPRECATED! Use image-create instead.  
    delete              DEPRECATED! Use image-delete instead.  
    details             DEPRECATED! Use image-list instead.  
    image-create        Create a new image.  
    image-delete        Delete specified image(s).  
    image-download      Download a specific image.  
    image-list          List images you can access.  
    image-members       DEPRECATED! Use member-list instead.  
    image-show          Describe a specific image.  
    image-update        Update a specific image.  
    index               DEPRECATED! Use image-list instead.  
    member-create       Share a specific image with a tenant.  
    member-delete       Remove a shared image from a tenant.  
    member-images       DEPRECATED! Use member-list instead.  
    member-list         Describe sharing permissions by image or tenant.  
    show                DEPRECATED! Use image-show instead.  
    update              DEPRECATED! Use image-update instead.
 

你可能感兴趣的:(openstack)