Install & konfigurasi Openstack Newton Multinode di Ubuntu 16.04 – Part 4 (Glance– image service)

pada part4 ini kita akan membahas tentang glance sebagai image service, yang berfungsi utnuk membuat template yang akan dinstall pada vm, sehingga proses pembuatan vm sangat cepat, tanpa harus installasi terlebih dahulu.

semua konfigurasi image service ini ada di controller node

[CONTROLLER NODE]

sebelum kita mengkonfigurasi image service kita harus membuat database terlebih dahulu

  • Membuat database glance

login ke database server mariadb mengunakan root

root@controller:/home/server# mysql -u root -p
Enter password: password_root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 54
Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

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

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

MariaDB [(none)]> 

setelah itu buat database dengan nama “glance”

MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)

kemudian memberikan hak akses ke database glance

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'password_glance';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'password_glance';
Query OK, 0 rows affected (0.00 sec)

setelah itu keluar dari mariadb server, dan install komponen images servicenya

  • jalankan script admin-openrc untuk memberikan akses ke admin melalui CLI
root@controller:~# . admin-openrc 
  • kemudian membuat user glance
root@controller:~# openstack user create --domain default --password-prompt glance
User Password: password_glance
Repeat User Password: password_glance
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 180cc40b80934bfe8652b8c79e5f705d |
| name                | glance                           |
| password_expires_at | None                             |
+---------------------+----------------------------------+
  • kemudian memberikan role admin ke user glance dan service project
root@controller:~# openstack role add --project service --user glance admin

pada perintah diatas tidak menampilkan output

  • membuat entitas glance service
root@controller:~# openstack service create --name glance --description "Openstack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Openstack Image                  |
| enabled     | True                             |
| id          | ae70cddd840346df802f076caa1313dd |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
  • membuat API endpoint untuk image service
root@controller:~# openstack endpoint create --region RegionOne image public http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 64d24e1d99c540bda9cb93afe9ff7c03 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ae70cddd840346df802f076caa1313dd |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
root@controller:~# openstack endpoint create --region RegionOne image internal http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 97d1f31d991c449287b8affa16a257a5 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ae70cddd840346df802f076caa1313dd |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
root@controller:~# openstack endpoint create --region RegionOne image admin http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 75d6b580cc18412eb9713e5f150dfe21 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ae70cddd840346df802f076caa1313dd |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+

pembuatan API endpoint ini digunakan untuk memanfaatkan API glance dari internal, public maupun admin. sehingga API glance bisa dimanfaatkan dari eksternal.

setelah kita membuat user dan API endpoin untuk glance, maka selanjutnya kita akan menginstall glance

  • Install Package glance
root@controller:~# apt install glance

setelah itu edit file /etc/glance/glance-api.conf 

  • konfigurasi akses database pada bagian [database]
connection = mysql+pymysql://glance:password_glance@controller/glance
  • konfigurasi akses identity service  pada bagian [keystone_authtoken] dan [paste_deploy]
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = password_glance

[paste_deploy]

......
flavor = keyston
  • konfigurasi lokasi file image pada bagian [glance_store]
[glance_store]
...
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

kemudian save dan exit.

setelah itu edit file /etc/glance/glance-registry.conf

  • konfigurasi akses database pada bagian [database]
[database]
...
connection = mysql+pymysql://glance:password_glance@controller/glance
  • konfigurasi akses identity service  pada bagian [keystone_authtoken] dan [paste_deploy]
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = password_glance

[paste_deploy]
...
flavor = keystone

kemudian, save dan exit

  • kemudian jalankan perintah dibawah ini untuk mengisi database glance  ke mariadb
root@controller:~# su -s /bin/sh -c "glance-manage db_sync" glance
/usr/lib/python2.7/dist-packages/oslo_db/sqlalchemy/enginefacade.py:1171: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade
  expire_on_commit=expire_on_commit, _conf=conf)
2016-10-20 23:11:55.681 20329 INFO migrate.versioning.api [-] 0 -> 1... 
2016-10-20 23:11:55.685 20329 INFO glance.db.sqlalchemy.migrate_repo.schema [-] creating table images
2016-10-20 23:11:56.288 20329 INFO migrate.versioning.api [-] done
2016-10-20 23:11:56.288 20329 INFO migrate.versioning.api [-] 1 -> 2... 
2016-10-20 23:11:56.294 20329 INFO glance.db.sqlalchemy.migrate_repo.schema [-] creating table image_properties
2016-10-20 23:11:57.117 20329 INFO migrate.versioning.api [-] done
2016-10-20 23:11:57.118 20329 INFO migrate.versioning.api [-] 2 -> 3... 
2016-10-20 23:11:58.384 20329 INFO migrate.versioning.api [-] done
2016-10-20 23:11:58.385 20329 INFO migrate.versioning.api [-] 3 -> 4... 
2016-10-20 23:11:58.796 20329 INFO migrate.versioning.api [-] done
2016-10-20 23:11:58.796 20329 INFO migrate.versioning.api [-] 4 -> 5... 
2016-10-20 23:11:59.433 20329 INFO migrate.versioning.api [-] done
.........

jika ada yang erro, mungki ada yg salah pada configurasi sebelumnya

  • restart glance image service
root@controller:~# service glance-registry restart
root@controller:~# service glance-api restart

tahap selanjutnya adalah kita akan memverifikasi operasi yang telah kita config sebelumnya

kita akan mengunkan CirrOS (image linux yang berukuran kecil biasanya hanya untuk testing) yang akan kita terapkan di glance image service

  • jalankan script admin-openrc untuk memberikan akses ke admin melalui CLI
root@controller:~# . admin-openrc 
  • setelah itu kita download image nya
root@controller:~# wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
  • kemudian upload image ke glance image service mengunakan format disk QCOW2 dengan format bare container dan visibilityny public(bisa diliat semua user)
root@controller:~# openstack image create "cirros"   --file cirros-0.3.4-x86_64-disk.img   --disk-format qcow2 --container-format bare   --public
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                     |
| container_format | bare                                                 |
| created_at       | 2016-10-20T16:30:00Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/948617fa-0bd9-49f7-9b84-18b04a470f71/file |
| id               | 948617fa-0bd9-49f7-9b84-18b04a470f71                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros                                               |
| owner            | 75daa68a789a42aea06a375d8b9b0bdc                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 13287936                                             |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2016-10-20T16:30:00Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

*catatan : no id digenerete, jadi kemungkinan idnya beda

  • Mengkonfirmasi image yang sudah diupload
root@controller:~# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 948617fa-0bd9-49f7-9b84-18b04a470f71 | cirros | active |
+--------------------------------------+--------+--------+

cukup sekian dulu untuk installasi openstack newton part4 ini nanti kita akan lanjutkan pada part5 pembahasan nova compute

wassalam

About the author
Alan Adi Prastyo

Routecloud Networks

Information about Server, Linux and Computer Network.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Routecloud Networks.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.