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
1 2 3 4 5 6 7 8 9 10 11 |
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”
1 2 |
MariaDB [(none)]> CREATE DATABASE glance; Query OK, 1 row affected (0.00 sec) |
kemudian memberikan hak akses ke database glance
1 2 3 4 |
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
1 |
root@controller:~# . admin-openrc |
- kemudian membuat user glance
1 2 3 4 5 6 7 8 9 10 11 12 |
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
1 |
root@controller:~# openstack role add --project service --user glance admin |
pada perintah diatas tidak menampilkan output
- membuat entitas glance service
1 2 3 4 5 6 7 8 9 10 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
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
1 |
root@controller:~# apt install glance |
setelah itu edit file /etc/glance/glance-api.conf
- konfigurasi akses database pada bagian [database]
1 |
connection = mysql+pymysql://glance:password_glance@controller/glance |
- konfigurasi akses identity service pada bagian [keystone_authtoken] dan [paste_deploy]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[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]
1 2 3 4 5 |
[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]
1 2 3 |
[database] ... connection = mysql+pymysql://glance:password_glance@controller/glance |
- konfigurasi akses identity service pada bagian [keystone_authtoken] dan [paste_deploy]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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
1 2 |
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
1 |
root@controller:~# . admin-openrc |
- setelah itu kita download image nya
1 |
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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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
1 2 3 4 5 6 |
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
System Engineer
Komentar