han8809 发表于 2016-1-8 15:01:47

openstack安装笔记 glance(二)

安装glance

yum install -y openstack-glanceopenstack-utilspython-kombu python-anyjson
# keystone service-create --name glance --type image--description "Glance Image Service hao"
+-------------+----------------------------------+
|   Property|            Value               |
+-------------+----------------------------------+
| description |   Glance Image Service hao   |
|      id   | 5e6ba168faa34da88610f9eb5dc18d0d |
|   name    |            glance            |
|   type    |            image               |
+-------------+----------------------------------+
#

service加了一条数据

keystone endpoint-create --service glance --publicurl"http://192.168.1.233:9292" --adminurl "http://192.168.1.233:9292" --internalurl "http://192.168.1.233:9292" --region beijing
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+-------------+----------------------------------+
|   Property|            Value               |
+-------------+----------------------------------+
|   adminurl|    http://172.16.21.233:9292   |
|      id   | 2093ea5cdfe047f0bfb75dc42b7f11ee |
| internalurl |    http://172.16.21.233:9292   |
|publicurl|    http://172.16.21.233:9292   |
|    region   |             beijing            |
|service_id | 5e6ba168faa34da88610f9eb5dc18d0d |
+-------------+----------------------------------+
#

endpoint表又加来三条数据
配置文件在
/etc/glance/glance-api.conf   等一堆

openstack-config --set /etc/glance/glance-api.confDEFAULT sql_connection mysql://glance:glance@172.16.21.233/glance
openstack-config --set /etc/glance/glance-registry.confDEFAULT sql_connection mysql://glance:glance@172.16.21.233/glance
openstack-config --set /etc/glance/glance-api.confpaste_deploy flavor keystone
openstack-config --set /etc/glance/glance-api.confkeystone_authtoken auth_host 172.16.21.233
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name admin
openstack-config --set /etc/glance/glance-api.confkeystone_authtoken admin_user admin
openstack-config --set /etc/glance/glance-api.confkeystone_authtoken admin_password openstack
openstack-config --set /etc/glance/glance-registry.confpaste_deploy flavor keystone
openstack-config --set /etc/glance/glance-registry.confkeystone_authtoken auth_host 172.16.21.233
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name admin
openstack-config --set /etc/glance/glance-registry.confkeystone_authtoken admin_user admin
openstack-config --set /etc/glance/glance-registry.confkeystone_authtoken admin_password openstack
openstack-config --set /etc/glance/glance-api.conf DEFAULT notifier_strategy noop


初始化数据库

openstack-db --init --service glance --password glance --rootpw openstack

migrate_version默认有一条数据,其他都没有
运行命令时还是需要

cat keystone_admin
export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=http://172.16.21.233:35357/v2.0/
export PS1='[\u@\h \W(keystone_admin)]\$ '
. keystone_admin


权限修改

chown -R glance:glance /etc/glance
chown -R glance:glance /var/lib/glance
chown -R glance:glance /var/log/glance
启动
chkconfig openstack-glance-api on
chkconfig openstack-glance-registry on
service openstack-glance-api start
service openstack-glance-registry start
source /root/keystone_admin


列出image列表

glance image-list
+----+------+-------------+------------------+------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+----+------+-------------+------------------+------+--------+
+----+------+-------------+------------------+------+--------+
#



glance image-create --name "hao cirros" --disk-format qcow2 --container-format bare --is-public true --file cirros-0.3.1-x86_64-disk.img
+------------------+--------------------------------------+
| Property         | Value                              |
+------------------+--------------------------------------+
| checksum         | d972013792949d0d3ba628fbe8685bce   |
| container_format | bare                                 |
| created_at       | 2015-02-04T11:58:34                  |
| deleted          | False                              |
| deleted_at       | None                                 |
| disk_format      | qcow2                              |
| id               | 0edf3e62-8af7-4046-a2d0-4afc89684307 |
| is_public      | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | hao cirros                           |
| owner            | c5cac2c737b0401b90e07a0542fa42c4   |
| protected      | False                              |
| size             | 13147648                           |
| status         | active                               |
| updated_at       | 2015-02-04T11:58:34                  |
| virtual_size   | None                                 |
+------------------+--------------------------------------+
#

文件存到了
/var/lib/glance/images/0edf3e62-8af7-4046-a2d0-4afc89684307
image_locations和images插入了两条数据
查看

glance image-list
+--------------------------------------+------------+-------------+------------------+----------+--------+
| ID                                 | Name       | Disk Format | Container Format | Size   | Status |
+--------------------------------------+------------+-------------+------------------+----------+--------+
| 0edf3e62-8af7-4046-a2d0-4afc89684307 | hao cirros | qcow2       | bare             | 13147648 | active |
+--------------------------------------+------------+-------------+------------------+----------+--------+
#
页: [1]
查看完整版本: openstack安装笔记 glance(二)