openstack

openstack - glance 설치

sysman 2021. 1. 18. 16:25

 

[root@controller conf]# mysql -u root -p

MariaDB [(none)]> CREATE DATABASE glance; MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

 

[root@controller ~]# cat ~/keystonerc
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=keystone
export OS_AUTH_URL=http://192.168.100.110:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2

 

[root@controller conf]# source ~/keystonerc

 

[root@controller conf]# openstack user create --domain default --project service --password-prompt glance

User Password: glance
Repeat User Password: glance

 

[root@controller conf]# openstack role add --project service --user glance admin
[root@controller conf]# openstack service create --name glance --description "openstack Image" image

[root@controller conf]# openstack endpoint create --region RegionOne image public http://192.168.100.110:9292

[root@controller conf]# openstack endpoint create --region RegionOne image internal http://192.168.100.110:9292

[root@controller conf]# openstack endpoint create --region RegionOne image admin http://192.168.100.110:9292

[root@controller conf]# openstack endpoint list

[root@controller conf]# yum install -y openstack-glance

 

[root@controller conf]# vi /etc/glance/glance-api.conf

[database]
connection = mysql+pymysql://glance:glance@192.168.100.110/glance

 

[keystone_authtoken]
www_authenticate_uri = http://192.168.100.110:5000
auth_url = http://192.168.100.110:5000
memcached_servers = 192.168.100.110:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance

 

[paste_deploy]
flavor = keystone

 

[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

 

[root@controller conf]# vi /etc/glance/glance-registry.conf

[database]
connection = mysql+pymysql://glance:glance@192.168.100.110/glance

 

[keystone_authtoken]
www_authenticate_uri = http://192.168.100.110:5000
auth_url = http://192.168.100.110:5000
memcached_servers = 192.168.100.110:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance

 

[paste_deploy]
flavor = keystone

 

[root@controller conf]# su -s /bin/bash -c "glance-manage db_sync" glance

...

Database is synced successfully.

 

[root@controller conf]# systemctl enable openstack-glance-api openstack-glance-registry

[root@controller conf]# systemctl start openstack-glance-api openstack-glance-registry

 

 

====================

확인

 

관리자 인증

[root@controller conf]# source ~/keystonerc

파일받기

[root@controller conf]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img

이미지 등록

[root@controller ~]# openstack image create "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --public

 

포트open 확인

[root@controller ~]# lsof -i tcp:9292

[root@controller ~]# lsof -i tcp:9191

 

이미지 리스트 확인

[root@controller ~]# openstack image list

[root@controller ~]# ls -l /var/lib/glance/images/

[root@controller ~]# glance --version

이미지 상세확인

[root@controller ~]# glance image-show e553....d08f

 

이미지 비활성화 

[root@controller ~]# glance image-deactivate e55...08f
[root@controller ~]# openstack image list

이미지 재활성화

[root@controller ~]# glance image-reactivate e55...08f
[root@controller ~]# openstack image list

이미지 삭제

[root@controller ~]# glance image delete cirros

 

glance 로그 확인

[root@controller ~]# ls -l /var/log/glance   

 

 

참고 : it00.tistory.com/17?category=808035

 

 

============================================

 

error 증상

[root@controller ~]# openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-forma bare --public

Error finding address for http://192.168.100.110:9292/v2/schemas/image: HTTPConnectionPool(host='192.168.100.110', port=9292):Max retries exceeded with url: /v2/schemas/image (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 030e4810>: Failed to establish a new connection: [Errno 111] Connection refused',))

 

확인 

9292 포트가 활성화 안되어 있음

 

솔루션

패키지 문제로 재설치 함

'openstack' 카테고리의 다른 글

openstack- horizon 설치  (0) 2021.01.18
openstack - nova 설치  (0) 2021.01.18
openstack - keystone 설치  (0) 2021.01.16
openstack - host vm setting  (0) 2021.01.12
openstack - ubuntu 16.04 devstack 설치  (0) 2021.01.12