본문 바로가기
IT/그 외 IT

[OpenStack] 3. Glance 설정

by 초록술 2022. 5. 31.
반응형

 

1. Keystone에 Glance 사용자 설정

# glance 사용자 생성

root@nw1 ~(keystone)# openstack user create --domain default --project service --password 'glance 패스워드 설정' glance
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | 8151371422324a2a80f19fd8ac988808 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 7c4c962a70d348abb2964f0f5e219f9a |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

 

# glance admin 역할 추가
root@nw1 ~(keystone)# openstack role add --project service --user glance admin

 

# glance 서비스 엔티티 생성
root@nw1 ~(keystone)# openstack service create --name glance --description "OpenStack Image service" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image service          |
| enabled     | True                             |
| id          | a84b2a283afd4c5fad91a9e81f20b61a |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+

# Glance API 호스트 설정(서버 IP로 변경 필요)
root@nw1 ~(keystone)# export controller=192.168.105.191

 

# 이미지 서비스 API endpoint 생성
root@nw1 ~(keystone)# openstack endpoint create --region RegionOne image public http://$controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 5fea28329e4445da96d3198295b23fb7 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a84b2a283afd4c5fad91a9e81f20b61a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://192.168.105.191:9292      |
+--------------+----------------------------------+


root@nw1 ~(keystone)# openstack endpoint create --region RegionOne image internal http://$controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | c7775cf46a8241cea75bc1a529653fa0 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a84b2a283afd4c5fad91a9e81f20b61a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://192.168.105.191:9292      |
+--------------+----------------------------------+


root@nw1 ~(keystone)# openstack endpoint create --region RegionOne image admin http://$controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b18e8eebc9b145c79bb8a02cd0494a08 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a84b2a283afd4c5fad91a9e81f20b61a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://192.168.105.191:9292      |
+--------------+----------------------------------+

 

 

 

2. DB에 Glance 데이터베이스 추가

glance database를 추가 및 권한 부여

 

root@nw1 ~(keystone)# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 54
Server version: 10.3.34-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database glance;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> grant all privileges on glance.* to glance@'localhost' identified by 'Glance DB 패스워드 설정';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> grant all privileges on glance.* to glance@'%' identified by 'Glance DB 패스워드 설정';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit
Bye

 

 

 

3. Glance 설치

apt -y install glance

 

 

4. Glance 구성

root@nw1 ~(keystone)# mv /etc/glance/glance-api.conf /etc/glance/glance-api.conf.org
root@nw1 ~(keystone)# vi /etc/glance/glance-api.conf

# 아래 내용 insert
[DEFAULT]
bind_host = 0.0.0.0

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

[database]
# MariaDB connection info
connection = mysql+pymysql://glance:Glance DB 패스워드@192.168.105.191/glance

# keystone auth info
[keystone_authtoken]
www_authenticate_uri = http://192.168.105.191:5000
auth_url = http://192.168.105.191:5000
memcached_servers = 192.168.105.191:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
# glance 사용자 생성 시 사용한 패스워드
password = glance 패스워드

[paste_deploy]
flavor = keystone

 

 

root@nw1 ~(keystone)# chmod 640 /etc/glance/glance-api.conf
root@nw1 ~(keystone)# chown root:glance /etc/glance/glance-api.conf
root@nw1 ~(keystone)# su -s /bin/bash glance -c "glance-manage db_sync"
2022-05-26 06:19:09.511 36467 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
2022-05-26 06:19:09.511 36467 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
2022-05-26 06:19:09.520 36467 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
2022-05-26 06:19:09.520 36467 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> liberty, liberty initial
INFO  [alembic.runtime.migration] Running upgrade liberty -> mitaka01, add index on created_at and updated_at columns of 'images' table
INFO  [alembic.runtime.migration] Running upgrade mitaka01 -> mitaka02, update metadef os_nova_server
INFO  [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_expand01, add visibility to images
INFO  [alembic.runtime.migration] Running upgrade ocata_expand01 -> pike_expand01, empty expand for symmetry with pike_contract01
INFO  [alembic.runtime.migration] Running upgrade pike_expand01 -> queens_expand01
INFO  [alembic.runtime.migration] Running upgrade queens_expand01 -> rocky_expand01, add os_hidden column to images table
INFO  [alembic.runtime.migration] Running upgrade rocky_expand01 -> rocky_expand02, add os_hash_algo and os_hash_value columns to images table
INFO  [alembic.runtime.migration] Running upgrade rocky_expand02 -> train_expand01, empty expand for symmetry with train_contract01
INFO  [alembic.runtime.migration] Running upgrade train_expand01 -> ussuri_expand01, empty expand for symmetry with ussuri_expand01
INFO  [alembic.runtime.migration] Running upgrade ussuri_expand01 -> wallaby_expand01, add image_id, request_id, user columns to tasks table"
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
...
root@nw1 ~(keystone)# systemctl restart glance-api
root@nw1 ~(keystone)# systemctl enable glance-api
Synchronizing state of glance-api.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable glance-api

 

 

 

 

 

 

 

https://www.server-world.info/en/note?os=Ubuntu_20.04&p=openstack_xena&f=5 

 

Ubuntu 20.04 LTS : OpenStack Xena : Configure Glance : Server World

root@dlp ~(keystone)# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 44 Server version: 10.3.31-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type

www.server-world.info

 

반응형

'IT > 그 외 IT' 카테고리의 다른 글

[OpenStack] 5. Nova 구성(1)  (0) 2022.06.02
[OpenStack] 4. VM image 설치  (0) 2022.06.01
[OpenStack] 2. Keystone 설정  (0) 2022.05.30
[OpenStack] 1. Openstack Xena 설치  (0) 2022.05.28
[MariaDB] ubuntu MariaDB Server 기본 설치  (0) 2022.05.27

댓글