Fedora 23
Sponsored Link

OpenStack Kilo : Add VM Images2015/11/12

 
Add Virtual Machine images in Glance.
[1] Load environment variables first.
[root@dlp ~]#
unset OS_TOKEN OS_URL

[root@dlp ~]#
vi ~/keystonerc
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=adminpassword
export OS_AUTH_URL=http://10.0.0.30:35357/v3
export PS1='[\u@\h \W(keystone)]\$ '
[root@dlp ~]#
chmod 600 ~/keystonerc

[root@dlp ~]#
source ~/keystonerc

[root@dlp ~(keystone)]#
echo "source ~/keystonerc " >> ~/.bash_profile
# display status (it's OK if no errors are shown)

[root@dlp ~(keystone)]#
glance image-list
+----+------+-------------+------------------+------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+----+------+-------------+------------------+------+--------+
+----+------+-------------+------------------+------+--------+
[2] For example, Create a Virtual Machine image of Fedora 23.
# create a directory for disk image

[root@dlp ~(keystone)]#
mkdir -p /var/kvm/images
# create a disk image

[root@dlp ~(keystone)]#
qemu-img create -f qcow2 /var/kvm/images/fedora23.img 10G
# install

[root@dlp ~(keystone)]#
virt-install \
--name fedora23 \
--ram 2048 \
--disk path=/var/kvm/images/fedora23.img,format=qcow2 \
--vcpus 2 \
--os-type linux \
--os-variant fedora22 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/23/Server/x86_64/os/' \
--extra-args 'console=ttyS0,115200n8 serial'
Starting install...    
# installation starts
[3]
After installation, change settings in virtual machine like follows and shutdown it.
* delete or comment out the line "HWADDR" and "UUID" in /etc/sysconfig/network-scripts/ifcfg-eth0
* set "dhcp" for "BOOTPROTO" in /etc/sysconfig/network-scripts/ifcfg-eth0
[4] Add the virtual image to Glance.
[root@dlp ~(keystone)]#
glance image-create --name="Fedora23" --is-public=true --disk-format=qcow2 --container-format=bare < /var/kvm/images/fedora23.img

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 70e71990c3578af4715e0ce2b842577f     |
| container_format | bare                                 |
| created_at       | 2015-11-13T16:24:14.000000           |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | c5386add-42ae-457a-9e59-62051d986064 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Fedora23                             |
| owner            | 90543cc39f274925985200d669e305d7     |
| protected        | False                                |
| size             | 1760690176                           |
| status           | active                               |
| updated_at       | 2015-11-13T16:24:24.000000           |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

[root@dlp ~(keystone)]#
glance image-list

+-----------+----------+-------------+------------------+------------+--------+
| ID        | Name     | Disk Format | Container Format | Size       | Status |
+-----------+----------+-------------+------------------+------------+--------+
| c5386add- | Fedora23 | qcow2       | bare             | 1760690176 | active |
+-----------+----------+-------------+------------------+------------+--------+
[5] By the way, if you got an image fron internet, it's OK to simply add it like follows.
root@dlp:~#
wget http://cloud-images.ubuntu.com/releases/14.04.3/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img -P /var/kvm/images
root@dlp:~#
glance image-create --name="Ubuntu1404" --is-public=true --disk-format=qcow2 --container-format=bare < /var/kvm/images/ubuntu-14.04-server-cloudimg-amd64-disk1.img

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 4263306b9755eade84578f8ca27f8164     |
| container_format | bare                                 |
| created_at       | 2015-11-13T16:29:26.000000           |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 2f6c4997-ff72-40b6-9a17-3694b0eda925 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Ubuntu1404                           |
| owner            | 90543cc39f274925985200d669e305d7     |
| protected        | False                                |
| size             | 258671104                            |
| status           | active                               |
| updated_at       | 2015-11-13T16:29:29.000000           |
| virtual_size     | None                                 |
+------------------+--------------------------------------+
Matched Content