Before Installation
Add repository
root@glance:~$ apt-get install -y python-software-properties root@glance:~$ add-apt-repository ppa:openstack-ubuntu-testing/folsom-trunk-testing root@glance:~$ add-apt-repository ppa:openstack-ubuntu-testing/folsom-deps-staging root@glance:~$ apt-get update && apt-get -y dist-upgrade
Hostname Setting
最簡單的方式是在 /etc/hosts 內設定會用到的 hostname172.17.123.12 rabbitmq 172.17.123.12 mysql 172.17.123.12 cinder 172.17.123.13 keystone 172.17.123.14 swift-proxy 172.17.123.16 glance
MySQL Setting
在 MySQL 內加入一個新的 database, 如果 MySQL 和 Glance 在同一台 Server 上, 記得也要設定從 localhost 登入的權限及密碼mysql> CREATE DATABASE glance; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec)
在 Glance 這邊記得也要裝 mysql-client, 然後可以測試看看能不能連線成功
root@glance:~$ sudo apt-get install mysql-client python-mysqldb root@glance:~$ mysql -h 172.17.123.12 -u glance -ppassword Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 236 Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
Environment Variable Setting
編輯一個設定檔: novarc, 設定一些等下會用到的區域變數, 並且匯到 .bashrc 之中, 下次再進來就不需要重新設定root@glance:~$ cat novarc export OS_TENANT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=password export OS_AUTH_URL="http://keystone:5000/v2.0/" export SERVICE_ENDPOINT="http://keystone:35357/v2.0" export SERVICE_TOKEN=password root@glance:~$ source novarc root@glance:~$ echo "source novarc">>.bashrc
Keystone Setting
把 endpoint 的網址設定好root@glance:~$ apt-get install python-keystoneclient root@glance:~$ keystone endpoint-list +----------------------------------+-----------+-----------------------------------------------+-----------------------------------------------+----------------------------------------+ | id | region | publicurl | internalurl | adminurl | +----------------------------------+-----------+-----------------------------------------------+-----------------------------------------------+----------------------------------------+ | 580b71d126804c5197b91c79fd74a330 | RegionOne | http://keystone:5000/v2.0 | http://keystone:5000/v2.0 | http://keystone:35357/v2.0 | | 5ef55e38e5c54477bd659d4185d0a776 | RegionOne | http://glance:9292/v2 | http://glance:9292/v2 | http://glance:9292/v2 | | 6c788747593d475f831b6ff128bde995 | RegionOne | http://cinder:8776/v1/$(tenant_id)s | http://cinder:8776/v1/$(tenant_id)s | http://cinder:8776/v1/$(tenant_id)s | | 95e16e71a8f04ac68ae401df5284ce3e | RegionOne | http://swift-proxy:8080/v1/AUTH_$(tenant_id)s | http://swift-proxy:8080/v1/AUTH_$(tenant_id)s | http://swift-proxy:8080/v1 | +----------------------------------+-----------+-----------------------------------------------+-----------------------------------------------+----------------------------------------+
CEPH Installation
Optional, 如果只是要存在 local filesystem 或是 Swift Server, 就不必安裝這個root@glance:~$ wget -q -O - https://raw.github.com/ceph/ceph/master/keys/release.asc | apt-key add - OK # 手動增加一個 ceph.list 在 /etc/apt/sources.list.d 下 root@glance:/etc/apt/sources.list.d$ cat ceph.list deb http://ceph.newdream.net/debian/ precise main deb-src http://ceph.newdream.net/debian/ precise main root@glance:~$ apt-get update root@glance:~$ apt-get install -y ceph python-ceph root@glance:~$ dpkg -l | grep ceph ii ceph 0.48.2argonaut-1precise distributed storage and file system ii ceph-common 0.48.2argonaut-1precise common utilities to mount and interact with a ceph storage cluster ii ceph-fs-common 0.48.2argonaut-1precise common utilities to mount and interact with a ceph file system ii ceph-fuse 0.48.2argonaut-1precise FUSE-based client for the Ceph distributed file system ii ceph-mds 0.48.2argonaut-1precise metadata server for the ceph distributed file system ii libcephfs1 0.48.2argonaut-1precise Ceph distributed file system client library ii python-ceph 0.48.2argonaut-1precise Python libraries for the Ceph distributed filesystem # 安裝好之後, 就把你的 ceph cluster 的設定檔 copy 到 /etc/ceph 下, 正常就可以使用 # 至於怎麼安裝 ceph cluster 就請到 ceph 的官網去看囉~ root@glance:~$ ceph -s health HEALTH_OK monmap e1: 3 mons at {wistor-003=172.17.123.92:6789/0,wistor-006=172.17.123.94:6789/0,wistor-007=172.17.123.95:6789/0}, election epoch 10, quorum 0,1,2 wistor-003,wistor-006,wistor-007 osdmap e24: 23 osds: 23 up, 23 in pgmap v2242: 4416 pgs: 4416 active+clean; 8362 MB data, 156 GB used, 19850 GB / 21077 GB avail mdsmap e1: 0/0/1 up # 記得產生一個 pool, 取名為 images root@glance:~$ rados mkpool images successfully created pool images
Glance Installation
Install Package
root@glance:~$ apt-get install glance The following NEW packages will be installed: glance glance-api glance-common glance-registry libjs-sphinxdoc libjs-underscore libxslt1.1 libyaml-0-2 python-amqplib python-anyjson python-boto python-dateutil python-decorator python-eventlet python-formencode python-gevent python-glance python-glanceclient python-greenlet python-iso8601 python-jsonschema python-keystone python-keystoneclient python-kombu python-lxml python-migrate python-openid python-passlib python-paste python-pastedeploy python-pastescript python-prettytable python-requests python-routes python-scgi python-setuptools python-sqlalchemy python-sqlalchemy-ext python-support python-swiftclient python-tempita python-warlock python-webob python-xattr python-yaml root@glance:~$ dpkg -l | grep glance ii glance 2012.2+git201209250330~precise-0ubuntu1 OpenStack Image Registry and Delivery Service - Daemons ii glance-api 2012.2+git201209250330~precise-0ubuntu1 OpenStack Image Registry and Delivery Service - API ii glance-common 2012.2+git201209250330~precise-0ubuntu1 OpenStack Image Registry and Delivery Service - Common ii glance-registry 2012.2+git201209250330~precise-0ubuntu1 OpenStack Image Registry and Delivery Service - Registry ii python-glance 2012.2+git201209250330~precise-0ubuntu1 OpenStack Image Registry and Delivery Service - Python library ii python-glanceclient 1:0.5.1.8.cdc06d9+git201210051430~precise-0ubuntu1 Client library for Openstack glance server. root@glance:~$ rm /var/lib/glance/glance.sqlite
Configuration
glance-api.conf
- default_store 預設是 filesystem, 在這裡我們把它改成 rbd
- sql server 改成是 mysql
- 設定 keystone_authtoken
- 設定 paste_deploy 的 flavor 選項
... # Which backend scheme should Glance use by default is not specified # in a request to add a new image to Glance? Known schemes are determined # by the known_stores option below. # Default: 'file' #default_store = filesystem default_store = rbd # List of which store classes and store class locations are # currently known to glance at startup. #known_stores = glance.store.filesystem.Store, # glance.store.http.Store, # glance.store.rbd.Store, # glance.store.s3.Store, # glance.store.swift.Store, ... # SQLAlchemy connection string for the reference implementation # registry server. Any valid SQLAlchemy connection string is fine. # See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine #sql_connection = sqlite:////var/lib/glance/glance.sqlite sql_connection = mysql://glance:password@mysql/glance ... [keystone_authtoken] auth_host = keystone auth_port = 35357 auth_protocol = http #admin_tenant_name = %SERVICE_TENANT_NAME% #admin_user = %SERVICE_USER% #admin_password = %SERVICE_PASSWORD% admin_tenant_name = service admin_user = glance admin_password = password [paste_deploy] # Name of the paste configuration file that defines the available pipelines #config_file = glance-api-paste.ini # Partial name of a pipeline in your paste configuration file with the # service name removed. For example, if your paste section name is # [pipeline:glance-api-keystone], you would configure the flavor below # as 'keystone'. flavor = keystone
glance-registry.conf
- sql server 改成是 mysql
- 設定 keystone_authtoken
- 設定 paste_deploy 的 flavor 選項
... # SQLAlchemy connection string for the reference implementation # registry server. Any valid SQLAlchemy connection string is fine. # See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine # sql_connection = sqlite:////var/lib/glance/glance.sqlite sql_connection = mysql://glance:password@mysql/glance ... [keystone_authtoken] auth_host = keystone auth_port = 35357 auth_protocol = http #admin_tenant_name = %SERVICE_TENANT_NAME% #admin_user = %SERVICE_USER% #admin_password = %SERVICE_PASSWORD% admin_tenant_name = service admin_user = glance admin_password = password [paste_deploy] # Name of the paste configuration file that defines the available pipelines #config_file = glance-registry-paste.ini # Partial name of a pipeline in your paste configuration file with the # service name removed. For example, if your paste section name is # [pipeline:glance-registry-keystone], you would configure the flavor below # as 'keystone'. flavor = keystone
重啟 glance
root@glance:~$ glance-manage version_control 0 root@glance:~$ glance-manage db_sync root@glance:~$ service glance-api restart && service glance-registry restart
Upload Image
root@glance:~$ wget http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img root@glance:~$ glance image-create --name Ubuntu-Precise --is-public true --container-format ovf --disk-format qcow2 < precise-server-cloudimg-amd64-disk1.img +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | c09f658c9f07f7dacdf75dd9e6610b29 | | container_format | ovf | | created_at | 2012-10-10T02:52:13 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | fdc49609-6047-426c-a382-75928c0deb17 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | Ubuntu-Precise | | owner | eefa301a6a424e7da3d582649ad0e59e | | protected | False | | size | 232718336 | | status | active | | updated_at | 2012-10-10T02:52:20 | +------------------+--------------------------------------+ root@glance:~$ glance image-list +--------------------------------------+--------+-------------+------------------+------------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+--------+-------------+------------------+------------+--------+ | fdc49609-6047-426c-a382-75928c0deb17 | Ubuntu | qcow2 | ovf | 232718336 | active | +--------------------------------------+--------+-------------+------------------+------------+--------+ root@glance:~$ rbd -p images list fdc49609-6047-426c-a382-75928c0deb17 root@glance:~$ rbd -p images info fdc49609-6047-426c-a382-75928c0deb17 rbd image 'fdc49609-6047-426c-a382-75928c0deb17': size 221 MB in 27 objects order 23 (8192 KB objects) block_name_prefix: rb.0.1a05.4885c754 parent: (pool -1)再加入 openstack 上的示範 http://docs.openstack.org/trunk/openstack-compute/install/apt/content/images-verifying-install.html
root@glance:~$ wget http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz root@glance:~$ tar -zxvf ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz ttylinux-uec-amd64-12.1_2.6.35-22_1-floppy ttylinux-uec-amd64-12.1_2.6.35-22_1.img ttylinux-uec-amd64-12.1_2.6.35-22_1-initrd ttylinux-uec-amd64-12.1_2.6.35-22_1-loader ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz root@glance:~$ glance add name="tty-linux-kernel" disk_format=aki container_format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz Added new image with ID: e504fcf2-fdbd-4d15-be1c-49e24dd28458 root@glance:~$ glance add name="tty-linux-ramdisk" disk_format=ari container_format=ari < ttylinux-uec-amd64 -12.1_2.6.35-22_1-loader Added new image with ID: 5897d530-b625-4b7c-91eb-56313cf2741c # 要記得把 kernel_id, ramdisk_id 改掉 root@glance:~$ glance add name="tty-linux" disk_format=ami container_format=ami kernel_id=e504fcf2-fdbd-4d15-be1c-49e24dd28458 ramdisk_id=5897d530-b625-4b7c-91eb-56313cf2741c < ttylinux-uec-amd64-12.1_2.6.35-22_1.img Added new image with ID: ad46b050-a03e-4d31-bc60-84f81806853b root@glance:~$ glance image-list +--------------------------------------+-------------------+-------------+------------------+------------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+-------------------+-------------+------------------+------------+--------+ | 5897d530-b625-4b7c-91eb-56313cf2741c | tty-linux-ramdisk | ari | ari | 96629 | active | | ad46b050-a03e-4d31-bc60-84f81806853b | tty-linux | ami | ami | 25165824 | active | | e504fcf2-fdbd-4d15-be1c-49e24dd28458 | tty-linux-kernel | aki | aki | 4404752 | active | | fdc49609-6047-426c-a382-75928c0deb17 | Ubuntu | qcow2 | ovf | 232718336 | active | +--------------------------------------+-------------------+-------------+------------------+------------+--------+
2012/10/26 補充:
其它格式的上傳設定
http://docs.openstack.org/developer/glance/formats.html
root@nova:~$ kvm-img convert -f qcow2 -O raw precise-cloudimg.img1 precise-cloudimg.raw root@nova:~$ glance image-create --name Ubuntu-Precise-Raw --is-public true --container-format bare --disk-format raw < ./precise-cloudimg.raw +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | db5504e488d761ac0cf7c0e490aba85f | | container_format | bare | | created_at | 2012-10-26T02:46:36 | | deleted | False | | deleted_at | None | | disk_format | raw | | id | 80f477f8-af7b-4261-9d8e-c4cdb27260e7 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | Ubuntu-Precise-Raw | | owner | eefa301a6a424e7da3d582649ad0e59e | | protected | False | | size | 2147483648 | | status | active | | updated_at | 2012-10-26T02:47:40 | +------------------+--------------------------------------+
沒有留言:
張貼留言