OpenStack Havana - Add Virtual Machine images2013/11/22 |
Add Virtual Machine images in Glance.
|
|
[1] | Load environment variables first. |
root@dlp:~# unset SERVICE_TOKEN root@dlp:~# unset SERVICE_ENDPOINT
root@dlp:~#
vi ~/keystonerc
export OS_USERNAME=admin
export OS_PASSWORD=adminpassword export OS_TENANT_NAME=admin export OS_AUTH_URL=http://10.0.0.30:35357/v2.0/ export PS1='\u@\h \W(keystone)\$ '
root@dlp:~#
chmod 600 ~/keystonerc root@dlp:~# source ~/keystonerc root@dlp ~(keystone)# echo "source ~/keystonerc " >> ~/.bash_profile
# confirm status (it's OK if no errors are shown) root@dlp ~(keystone)# glance image-list
|
[2] | For example, Create a Virtual Machine image of Ubuntu 13.10 for adding. |
# create a disk image root@dlp ~(keystone)# qemu-img create -f qcow2 /var/kvm/images/ubuntu1310.img 10G
# install root@dlp ~(keystone)# virt-install \
Starting install...
-n Ubuntu1310 \ -r 2048 \ --disk path=/var/kvm/images/ubuntu1310.img,format=qcow2 \ --vcpus=2 \ --os-type linux \ --os-variant=ubuntusaucy \ --nographics \ --location='http://jp.archive.ubuntu.com/ubuntu/dists/saucy/main/installer-amd64/' \ --extra-args='console=tty0 console=ttyS0,115200n8 serial' # installation starts |
[3] |
After installation, change settings in virtual machine like follows and shutdown it.
* Install openssh-server. * Remove /etc/udev/rules.d/70-persistent-net.rules if it exists |
[4] | Add the virtual image to Glance. |
root@dlp ~(keystone)# glance image-create --name="Ubuntu13.10" --is-public=true --disk-format=qcow2 --container-format=bare < /var/kvm/images/ubuntu1310.img +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 98fd560db7caa33f2bfe6e86c75a7c7e | | container_format | bare | | created_at | 2013-11-22T04:26:23 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | 424a8c60-8cde-4601-9cdf-65da03062ab4 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | Ubuntu13.10 | | owner | efa4897fa0314da9b983d20ceaf81a96 | | protected | False | | size | 1960181760 | | status | active | | updated_at | 2013-11-22T04:26:53 | +------------------+--------------------------------------+root@dlp ~(keystone)# glance image-list +------------+-------------+-------------+------------------+------------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +------------+-------------+-------------+------------------+------------+--------+ | 424a8c60-8 | Ubuntu13.10 | qcow2 | bare | 1960181760 | active | +------------+-------------+-------------+------------------+------------+--------+ |
[5] | By the way, if you got an image fron internet, it's OK to simplt add it like follows. |
root@dlp:~#
root@dlp:~# wget http://cloud-images.ubuntu.com/releases/13.10/release/ubuntu-13.10-server-cloudimg-amd64-disk1.img -P /var/kvm/images
glance image-create --name="Ubuntu1310" --is-public=true --disk-format=qcow2 --container-format=bare < /var/kvm/images/ubuntu-13.10-server-cloudimg-amd64-disk1.img +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | eef6cffa7f1c680afb7bc0405d932f06 | | container_format | bare | | created_at | 2013-11-17T10:30:03 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | d83b4aa3-15fd-498b-977d-c7081bcda264 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | Ubuntu1310 | | owner | 3d7997a116ac48a4b72ff63327418e42 | | protected | False | | size | 242941952 | | status | active | | updated_at | 2013-11-17T10:30:06 | +------------------+--------------------------------------+ |
Sponsored Link |