
VM 이미지를 저장하고 관리하는 서비스
주요 기능
- VM 이미지(디스크 이미지) 저장, 검색, 배포
- 다양한 이미지 포맷(QCOW2, RAW 등) 지원
- 이미지 메타데이터 관리
연계
- Nova와 연동되어 VM인스턴스 생성 시 필요한 이미지 제공
- Keystone을 통해 인증 및 권한 관리
- Horizon을 통해 이미지 관리 기능
mysql
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'openstack';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'openstack';
exit
. admin-openrc
openstack user create --domain default --password-prompt glance
User Password: openstack
Repeat User Password: openstack
openstack role add --project service --user glance admin
openstack service create --name glance \
--description "OpenStack Image" image
openstack endpoint create --region RegionOne \
image public http://con01:9292
openstack endpoint create --region RegionOne \
image internal http://con01:9292
openstack endpoint create --region RegionOne \
image admin http://con01:9292
apt install glance
cp glance-api.conf glance-api.conf.v0
/nfs/sed.sh glance-api.conf
vi /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:openstack@con01/glance
[keystone_authtoken]
www_authenticate_uri = http://con01:5000
auth_url = http://con01:5000
memcached_servers = con01:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = openstack
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[oslo_limit]
auth_url = http://con01:5000
auth_type = password
user_domain_id = default
username = glance
system_scope = all
password = openstack
endpoint_id = b8413daaa1ed4c15a7d045f7a4a74182 # 확인 후 수정
region_name = RegionOne
openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+-----------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-----------------------+
| 072670f45b4144afb23e240ec3c6c22f | RegionOne | keystone | identity | True | public | http://con01:5000/v3/ |
| 5a13028059e04a64b0bd87c49921913b | RegionOne | glance | image | True | internal | http://con01:9292 |
| 5e982d2b988c4c56beba065779ca6452 | RegionOne | keystone | identity | True | internal | http://con01:5000/v3/ |
| a5c4bfd233f2496ca05a6100da33fa5b | RegionOne | glance | image | True | admin | http://con01:9292 |
| b8413daaa1ed4c15a7d045f7a4a74182 | RegionOne | glance | image | True | public | http://con01:9292 |
| cca95e640a134b3288b3206e9c4855dd | RegionOne | keystone | identity | True | admin | http://con01:5000/v3/ |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-----------------------+
openstack role add --user glance --user-domain Default --system all reader
su -s /bin/sh -c "glance-manage db_sync" glance
service glance-api restart
cd /nfs/
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
# 안되면
curl -o cirros-0.4.0-x86_64-disk.img -L "https://github.com/cirros-dev/cirros/releases/download/0.4.0/cirros-0.4.0-x86_64-disk.img"
glance image-create --name "cirros" \
--file cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--visibility=public
# 사용 권장 X
glance image-list
# openstack 사용
openstack image list