1、创建glance用户并授权
[[email protected] ~]# source admin-openrc.sh [[email protected] ~]# openstack user create --domain default --password=glance glance +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | default | | enabled | True | | id | 9bf74a8f70b34886b89e8510eb21e5ab | | name | glance | +-----------+----------------------------------+ [[email protected] ~]# openstack role add --project service --user glance admin
2、创建glance服务及apipoint
[[email protected] ~]# openstack service create --name glance --description "OpenStack Image service" image +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Image service | | enabled | True | | id | 63fa06d39ec049348a4381bd9f2d52d3 | | name | glance | | type | image | +-------------+----------------------------------+ [[email protected] ~]# openstack endpoint create --region RegionOne image public http://172.16.80.130:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 6a716435ec7b4d7b8593f02a4bd89a57 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 63fa06d39ec049348a4381bd9f2d52d3 | | service_name | glance | | service_type | image | | url | http://172.16.80.130:9292 | +--------------+----------------------------------+ [[email protected] ~]# openstack endpoint create --region RegionOne image internal http://172.16.80.130:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | fcf98c96b25d4da5a1bf68ffafeaf832 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 63fa06d39ec049348a4381bd9f2d52d3 | | service_name | glance | | service_type | image | | url | http://172.16.80.130:9292 | +--------------+----------------------------------+ [[email protected] ~]# openstack endpoint create --region RegionOne image admin http://172.16.80.130:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 03cbb947b93e43ea936ee6c54db63275 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 63fa06d39ec049348a4381bd9f2d52d3 | | service_name | glance | | service_type | image | | url | http://172.16.80.130:9292 | +--------------+----------------------------------+
3、安装配置glance
[[email protected] ~]# yum install openstack-glance python-glance python-glanceclient -y [[email protected] glance]# grep -n ‘^[a-z]‘ /etc/glance/glance-api.conf 363:verbose=True 491:notification_driver = noop 538:connection=mysql://glance:[email protected]/glance 642:default_store=file 701:filesystem_store_datadir=/var/lib/glance/images/ 974:uth_uri = http://172.16.80.130:5000 975:auth_url = http://172.16.80.130:35357 976:auth_plugin = password 977:project_domain_id = default 978:user_domain_id = default 979:project_name = service 980:username = glance 981:password = glance 1484:flavor=keystone [[email protected] glance]# grep -n ‘^[a-z]‘ /etc/glance/glance-registry.conf 188:verbose=True 316:notification_driver = noop 363:connection=mysql://glance:[email protected]/glance 763:uth_uri = http://172.16.80.130:5000 764:auth_url = http://172.16.80.130:35357 765:auth_plugin = password 766:project_domain_id = default 767:user_domain_id = default 768:project_name = service 769:username = glance 770:password = glance 1255:flavor=keystone
4、初始化glance数据库并检查配置
[[email protected] glance]# su -s /bin/sh -c "glance-manage db_sync" glance [[email protected] glance]# mysql -e "use glance;show tables;" +----------------------------------+ | Tables_in_glance | +----------------------------------+ | artifact_blob_locations | | artifact_blobs | | artifact_dependencies | | artifact_properties | | artifact_tags | | artifacts | | image_locations | | image_members | | image_properties | | image_tags | | images | | metadef_namespace_resource_types | | metadef_namespaces | | metadef_objects | | metadef_properties | | metadef_resource_types | | metadef_tags | | migrate_version | | task_info | | tasks | +----------------------------------+
5、启动glance服务
[[email protected] glance]# systemctl enable openstack-glance-api.service > openstack-glance-registry.service Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service. [[email protected] glance]# [[email protected] glance]# systemctl start openstack-glance-api.service > openstack-glance-registry.service [[email protected] glance]# netstat -lntup|egrep "9191|9292" tcp 0 0 0.0.0.0:9191 0.0.0.0:* LISTEN 96237/python2 tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 96236/python2
6、验证glance服务
[[email protected] ~]# echo "export OS_IMAGE_API_VERSION=2" > | tee -a admin-openrc.sh demo-openrc.sh export OS_IMAGE_API_VERSION=2 [[email protected] ~]# [[email protected] ~]# source admin-openrc.sh [[email protected] ~]# wget [[email protected] ~]# glance image-create --name "cirros" > --file cirros-0.3.4-x86_64-disk.img > --disk-format qcow2 --container-format bare > --visibility public --progress [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | ee1eca47dc88f4879d8a229cc70a07c6 | | container_format | bare | | created_at | 2016-10-29T21:54:17Z | | disk_format | qcow2 | | id | 6772deca-7b31-4f97-affa-668518b22972 | | min_disk | 0 | | min_ram | 0 | | name | cirros | | owner | 8a3b7f9f1b2c4f7eaf7780d268e672d1 | | protected | False | | size | 13287936 | | status | active | | tags | [] | | updated_at | 2016-10-29T21:54:19Z | | virtual_size | None | | visibility | public | +------------------+--------------------------------------+ [[email protected] ~]# [[email protected] ~]# [[email protected] ~]# glance image-list +--------------------------------------+--------+ | ID | Name | +--------------------------------------+--------+ | 6772deca-7b31-4f97-affa-668518b22972 | cirros | +--------------------------------------+--------+
时间: 2024-11-08 17:26:34