¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 715°Ç
   
OpenStack JUNO - Ubuntu 14.04 #03 Glance(À̹ÌÁö)
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2015-02-24 (È­) 11:45 Á¶È¸ : 4144
                                
Glance INSTALL
 glance-api : À̹ÌÁö°Ë»ö, ÀúÀåµîÀ» À§ÇØ À̹ÌÁö API È£ÃâÀ» ¹Þ¾ÆµéÀδÙ.
 glance-registry : À̹ÌÁö¿¡ ´ëÇØ ¸ÞŸµ¥ÀÌÅ͸¦ ¹Þ¾Æ ó¸®, ÀúÀåÇÏ¸ç ¸ÞŸµ¥ÀÌÅÍ´Â Å©±â¿Í Á¾·ùµîÀÇ Ç׸ñÀ» Æ÷ÇÔÇÕ´Ï´Ù.

¼³Ä¡ÀÌÈÄ glance ÀúÀå¼Ò À̹ÌÁö¸¦ °ü¸®Çϴµ¥... qemu ¸í·É¾î°¡ ÇÊ¿äÇÑ°æ¿ì°¡ ÀÖÀ¸´Ï ÇÊ¿ä¿¡ µû¶ó¼­ ¾Æ·¡ ÆÐÅ°Áöµµ ¼³Ä¡
root@controller:~# apt-get -y install qemu-kvm kpartx

glance µ¥ÀÌŸº£À̽º ¹× À¯Àú»ý¼º
root@controller:~# mysql -u root -pXXXXXXXXXXXXXXX
mysql> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'XXXXXXXXXXXXXXX';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'XXXXXXXXXXXXXXX';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

Identity Server ¿¡ Image Service(glance) µî·Ï
root@controller:~# source /root/admin-openrc.sh
root@controller:~# keystone user-create --name=glance --pass=XXXXXXXXXXXXXXX --email=newbd@smileserv.com
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |       newbd@smileserv.com        |
| enabled  |               True               |
|    id    | ee85fd8a6dbd462ebf3990a6694cd607 |
|   name   |              glance              |
| username |              glance              |
+----------+----------------------------------+

root@controller:~# keystone user-role-add --user=glance --tenant=service --role=admin

root@controller:~# keystone service-create --name=glance --type=image --description="OpenStack Image Service"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Image Service      |
|   enabled   |               True               |
|      id     | 9e14aaf3359340c7ad1cfc2e543ca998 |
|     name    |              glance              |
|     type    |              image               |
+-------------+----------------------------------+

root@controller:~# keystone endpoint-create --service-id=$(keystone service-list | awk '/ image / {print $2}') --publicurl=http://115.XXX.XXX.6:9292 --internalurl=http://115.XXX.XXX.6:9292 --adminurl=http://115.XXX.XXX.6:9292
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |     http://115.XXX.XXX.6:9292     |
|      id     | abbd365470e842c78e7df711dd65a5c9 |
| internalurl |     http://115.XXX.XXX.6:9292     |
|  publicurl  |     http://115.XXX.XXX.6:9292     |
|    region   |            regionOne             |
|  service_id | 9e14aaf3359340c7ad1cfc2e543ca998 |
+-------------+----------------------------------+

root@controller:~# (keystone service-list | awk '/ image / {print $2}')
9e14aaf3359340c7ad1cfc2e543ca998

root@controller:~# apt-get -y install glance python-glanceclient


¼öÁ¤ 
root@controller:~# vim /etc/glance/glance-api.conf
[database]
#sqlite_db = /var/lib/glance/glance.sqlite
connection = mysql://glance:XXXXXXXXXXXXXXX@115.XXX.XXX.6/glance

[DEFAULT]
...
rpc_backend = rabbit
rabbit_host = 115.XXX.XXX.6
rabbit_password = XXXXXXXXXXXXXXX

[keystone_authtoken]
auth_uri = http://115.XXX.XXX.6:5000/v2.0
auth_host = 115.XXX.XXX.6
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = XXXXXXXXXXXXXXX

[paste_deploy]
...
flavor=keystone


¼öÁ¤ 
root@controller:~# vim /etc/glance/glance-registry.conf
[database]
#sqlite_db = /var/lib/glance/glance.sqlite
connection = mysql://glance:XXXXXXXXXXXXXXX@115.XXX.XXX.6/glance

[DEFAULT]
...
rpc_backend = rabbit
rabbit_host = 115.XXX.XXX.5
rabbit_password = XXXXXXXXXXXXXXX

[keystone_authtoken]
...
auth_uri = http://115.XXX.XXX.6:5000/v2.0
auth_host = 115.XXX.XXX.6
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = XXXXXXXXXXXXXXX

[paste_deploy]
flavor=keystone


glance µ¥ÀÌŸº£À̽º »ý¼º
root@controller:~# glance-manage db_sync
root@controller:~# ls -l /var/lib/mysql/glance/
total 160
-rw-rw---- 1 mysql mysql   61  2¿ù 24 11:39 db.opt
-rw-rw---- 1 mysql mysql 8862  2¿ù 24 13:24 image_locations.frm
-rw-rw---- 1 mysql mysql 8864  2¿ù 24 13:24 image_members.frm
-rw-rw---- 1 mysql mysql 8818  2¿ù 24 13:24 image_properties.frm
-rw-rw---- 1 mysql mysql 8788  2¿ù 24 13:24 image_tags.frm
-rw-rw---- 1 mysql mysql 9180  2¿ù 24 13:24 images.frm
-rw-rw---- 1 mysql mysql 8804  2¿ù 24 13:24 metadef_namespace_resource_types.frm
-rw-rw---- 1 mysql mysql 8884  2¿ù 24 13:24 metadef_namespaces.frm
-rw-rw---- 1 mysql mysql 8842  2¿ù 24 13:24 metadef_objects.frm
-rw-rw---- 1 mysql mysql 8760  2¿ù 24 13:24 metadef_properties.frm
-rw-rw---- 1 mysql mysql 8710  2¿ù 24 13:24 metadef_resource_types.frm
-rw-rw---- 1 mysql mysql 8666  2¿ù 24 13:24 migrate_version.frm
-rw-rw---- 1 mysql mysql 8668  2¿ù 24 13:24 task_info.frm
-rw-rw---- 1 mysql mysql 8856  2¿ù 24 13:24 tasks.frm

root@controller:~# service glance-registry restart
glance-registry stop/waiting
glance-registry start/running, process 7426

root@controller:~# service glance-api restart
glance-api stop/waiting
glance-api start/running, process 7443

root@controller:~# rm -f /var/lib/glance/glance.sqlite


À̹ÌÁöµî·Ï
OpenStack ¸Þ´º¾ó»ó¿¡¼­´Â °¡ÀåÀ̹ÌÁö ½ÎÀÌÁî°¡ ÀûÀº CIrros À̹ÌÁö·Î µî·ÏµÇ´Â ¹æ¹ýÀ¸·Î ¸í½ÃµÇ¾îÀÖ½À´Ï´Ù.
Cirros ´Â Ŭ¶ó¿ìµå¼­ºñ½º³»¿¡¼­ ½ÇÇàÀ» Àü¹®ÀûÀ¸·Î ÀûÀº ¿ë·®¿¡ OS ÀÔ´Ï´Ù.

root@controller:~# mkdir /tmp/images
root@controller:~# cd /tmp/images
root@controller:/tmp/images# wget http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img
root@controller:/tmp/images# source /root/admin-openrc.sh

root@controller:/tmp/images# glance image-create --name "cirros-0.3.2-x86_64" --file cirros-0.3.2-x86_64-disk.img --disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 64d7c1cd2b6f60c92c14662941cb7913     |
| container_format | bare                                 |
| created_at       | 2015-02-24T05:12:00                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 14cb4b95-07c2-478a-88a6-fa1e7931f828 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros-0.3.2-x86_64                  |
| owner            | 1cf650d0c8ea4b8b93ee38b1bb3cea76     |
| protected        | False                                |
| size             | 13167616                             |
| status           | active                               |
| updated_at       | 2015-02-24T05:12:01                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

»ý¼ºµÈ À̹ÌÁö¿¡ ±âº»°æ·Î´Â /var/lib/glance/images/ ÀÔ´Ï´Ù.
root@controller:/var/lib/glance/images# ls
14cb4b95-07c2-478a-88a6-fa1e7931f828

root@controller:/tmp/images# glance image-list
+--------------------------------------+---------------------+-------------+------------------+----------+--------+
| ID                                   | Name                | Disk Format | Container Format | Size     | Status |
+--------------------------------------+---------------------+-------------+------------------+----------+--------+
| 14cb4b95-07c2-478a-88a6-fa1e7931f828 | cirros-0.3.2-x86_64 | qcow2       | bare             | 13167616 | active |
+--------------------------------------+---------------------+-------------+------------------+----------+--------+


Ubuntu ±âº» Ŭ¶ó¿ìµå À̹ÌÁö µî·Ï (http://cloud-images.ubuntu.com/)
root@controller:/tmp/images# wget http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img

root@controller:/tmp/images# qemu-img info trusty-server-cloudimg-amd64-disk1.img 
image: trusty-server-cloudimg-amd64-disk1.img
file format: qcow2
virtual size: 2.2G (2361393152 bytes)
disk size: 245M
cluster_size: 65536
Format specific information:
    compat: 0.10

root@controller:/tmp/images# glance image-create --name "Ubuntu14.04_cloud-images" --file trusty-server-cloudimg-amd64-disk1.img --disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | cf0fc236ad04ee6066852ca759a7ade9     |
| container_format | bare                                 |
| created_at       | 2015-02-26T05:41:43                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | a86622c9-a876-4fbc-825f-6f80a2fb8354 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Ubuntu14.04_cloud-images             |
| owner            | 1cf650d0c8ea4b8b93ee38b1bb3cea76     |
| protected        | False                                |
| size             | 256705024                            |
| status           | active                               |
| updated_at       | 2015-02-26T05:41:45                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

root@controller:/tmp/images# glance image-list
+--------------------------------------+--------------------------+-------------+------------------+-----------+--------+
| ID                                   | Name                     | Disk Format | Container Format | Size      | Status |
+--------------------------------------+--------------------------+-------------+------------------+-----------+--------+
| 14cb4b95-07c2-478a-88a6-fa1e7931f828 | cirros-0.3.2-x86_64      | qcow2       | bare             | 13167616  | active |
| a86622c9-a876-4fbc-825f-6f80a2fb8354 | Ubuntu14.04_cloud-images | qcow2       | bare             | 256705024 | active |
+--------------------------------------+--------------------------+-------------+------------------+-----------+--------+

root@controller:/tmp/images# ls -l /var/lib/glance/images/
total 263552
-rw-r----- 1 glance glance  13167616  2¿ù 24 14:12 14cb4b95-07c2-478a-88a6-fa1e7931f828
-rw-r----- 1 glance glance 256705024  2¿ù 26 14:41 a86622c9-a876-4fbc-825f-6f80a2fb8354

:: ´ë½Ãº¸µå¸¦ ÀÌ¿ëÇؼ­ VM ÀνºÅϽº »ý¼º
cloud-images.ubuntu.com¿¡¼­ ¹èÆ÷µÇ´Â À̹ÌÁö´Â compute ³ëµå¿¡¼­¸¸ Á¢±Ù°¡´É
root@ubuntu:~# ssh -lroot 192.168.145.3
Please login as the user "ubuntu" rather than the user "root".

root@ubuntu:~# ssh -lubuntu 192.168.145.3            
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-45-generic x86_64)


½º¸¶Àϼ­ºê Ŭ¶ó¿ìµå ¹èÆ÷¿ë À̹ÌÁö µî·Ï
À̹ÌÁö´Â FTP¸¦ ÅëÇØ /tmp/images µð·ºÅ丮·Î ´Ù¿î·Îµå
root@controller:/tmp/images# wget http://mirror.cloudv.kr/Openstack_images/Centos_6.6_64bit.qcow2

root@controller:/tmp/images# glance image-create --name "CentOS6.6 SMILESERV-IMG" --file Centos_6.6_64bit.qcow2 --disk-format qcow2 --container-format bare --is-public True --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 578f975bc18009a9fe12f5e211e38db0     |
| container_format | bare                                 |
| created_at       | 2015-02-26T06:58:23                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | a4373411-7dff-4083-aa9a-6e94b3f2944d |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | CentOS6.6 SMILESERV-IMG         |
| owner            | 1cf650d0c8ea4b8b93ee38b1bb3cea76     |
| protected        | False                                |
| size             | 2822307840                           |
| status           | active                               |
| updated_at       | 2015-02-26T06:59:27                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

root@controller:/tmp/images# glance image-list
+--------------------------------------+------------------------------+-------------+------------------+------------+--------+
| ID                                   | Name                         | Disk Format | Container Format | Size       | Status |
+--------------------------------------+------------------------------+-------------+------------------+------------+--------+
| 14cb4b95-07c2-478a-88a6-fa1e7931f828 | cirros-0.3.2-x86_64          | qcow2       | bare             | 13167616   | active |
| a86622c9-a876-4fbc-825f-6f80a2fb8354 | Ubuntu14.04_cloud-images     | qcow2       | bare             | 256705024  | active |
| a4373411-7dff-4083-aa9a-6e94b3f2944d | CentOS6.6 SMILESERV-IMG | qcow2       | bare             | 2822307840 | active |
+--------------------------------------+------------------------------+-------------+------------------+------------+--------+

root@controller:/tmp/images# ls -l /var/lib/glance/images/
total 3019716
-rw-r----- 1 glance glance   13167616  2¿ù 24 14:12 14cb4b95-07c2-478a-88a6-fa1e7931f828
-rw-r----- 1 glance glance 2822307840  2¿ù 26 15:59 a4373411-7dff-4083-aa9a-6e94b3f2944d
-rw-r----- 1 glance glance  256705024  2¿ù 26 14:41 a86622c9-a876-4fbc-825f-6f80a2fb8354

:: ´ë½Ãº¸µå¸¦ ÀÌ¿ëÇؼ­ VM ÀνºÅϽº »ý¼º


À̹ÌÁö ¾÷µ¥ÀÌÆ®¿ë Àӽûý¼º µð·ºÅ丮 »èÁ¦
root@controller:/tmp/images# cd /root
root@controller:~# rm -r /tmp/images

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.