Glance - Image asennus

controller.foo.bar

1. Ladataan admin-tunnuksen ympäristömuuttujat.

# . ./adminrc.sh

2. Luodaan Glance-tunnus.

# keystone user-create --name glance --pass glance
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | f44ed68d9817415182ea6d19cdc0ba6a |
|   name   |             glance               |
| username |             glance               |
+----------+----------------------------------+

3. Lisätään Glance-tunnukselle admin-rooli ja lisätään tunnus service tenant-ryhmään.

# keystone user-role-add --user glance --tenant service --role admin
(Tämä komento ei tulosta mitään)

4. Luodaan Glance-service ja servicen tyypiksi image.

# keystone service-create --name glance --type image --description "OpenStack Image Service"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Image Service      |
|   enabled   |               True               |
|      id     | e7bdf6613abe47dbaaa9b7cd27139313 |
|     name    |             glance               |
|     type    |              image               |
+-------------+----------------------------------+

5. Luodaan Glancen endpoint.

# keystone endpoint-create --service-id $(keystone service-list | awk '/ image / {print $2}') \
--publicurl http://10.0.0.11:9292 --internalurl http://10.0.0.11:9292 \
--adminurl http://10.0.0.11:9292 --region regionOne
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |      http://10.0.0.11:9292       |
|      id     | 59ba4542e2a3437fafca662c31cfd347 |
| internalurl |      http://10.0.0.11:9292       |
|  publicurl  |      http://10.0.0.11:9292       |
|    region   |            regionOne             |
|  service_id | e7bdf6613abe47dbaaa9b7cd27139313 |
+-------------+----------------------------------+

6. Asennetaan Glance.

# apt-get install glance python-glanceclient

7. Muokataan /etc/glance/glance-api.conf -tiedostoa.

[DEFAULT]
...
notification_driver = noop

[database]
...
connection = mysql://glance:glancedb@10.0.0.11/glance

[keystone_authtoken]
...
auth_uri = http://10.0.0.11:5000/v2.0
identity_uri = http://10.0.0.11:35357
admin_tenant_name = service
admin_user = glance
admin_password = glance
 
[paste_deploy]
...
flavor = keystone

[glance_store]
...
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

8. Muokataan /etc/glance/glance-registry.conf -tiedostoa:

[database]
...
connection = mysql://glance:glancedb@10.0.0.11/glance
    	
[keystone_authtoken]
...
auth_uri = http://10.0.0.11:5000/v2.0
identity_uri = http://10.0.0.11:35357
admin_tenant_name = service
admin_user = glance
admin_password = glance
  
[paste_deploy]
...
flavor = keystone

9. Synkronoidaan Glance-tietokanta.

# glance-manage db_sync

10. Uudelleenkäynnistetään Glance-palvelu.

# service glance-registry restart
# service glance-api restart

11. Luodaan images-hakemisto, ladataan Cirros-distron levykuva ja luodaan Glance-image.

# mkdir /tmp/images
# wget -P /tmp/images http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img

# . ./adminrc

# glance image-create --name "cirros-0.3.3-x86_64" \
--file /tmp/images/cirros-0.3.3-x86_64-disk.img \
--disk-format qcow2 --container-format bare --is-public True --progress
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 133eae9fb1c98f45894a4e60d8736619     |
| container_format | bare                                 |
| created_at       | 2016-10-06T09:20:16                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 990913ad-4629-4404-9181-b58722f7b2f2 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros-0.3.3-x86_64                  |
| owner            | 4ad9732718a74c85b914ba96551e430b     |
| protected        | False                                |
| size             | 13200896                             |
| status           | active                               |
| updated_at       | 2016-10-06T09:20:16                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

12. Testataan Glancen toimivuus listaamalla juuri luotu image.

# glance image-list
+--------------------------------------+---------------------+-------------+------------------+----------+--------+
| ID                                   | Name                | Disk Format | Container Format | Size     | Status |
+--------------------------------------+---------------------+-------------+------------------+----------+--------+
| 990913ad-4629-4404-9181-b58722f7b2f2 | cirros-0.3.3-x86_64 | qcow2       | bare             | 13200896 | active |
+--------------------------------------+---------------------+-------------+------------------+----------+--------+