Fedora 21
Sponsored Link

OpenStack Juno : Add Images2015/01/06

 
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
+----+------+-------------+------------------+------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+----+------+-------------+------------------+------+--------+
+----+------+-------------+------------------+------+--------+
[2] For example, Create a Virtual Machine image of Fedora 21 for adding.
# create a directory for disk image

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

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

[root@dlp ~]#
virt-install \
--name fedora21 \
--ram 2048 \
--disk path=/var/kvm/images/fedora21.img,format=qcow2 \
--vcpus 2 \
--os-type linux \
--os-variant fedora21 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.riken.jp/Linux/fedora/releases/21/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="Fedora21" --is-public=true --disk-format=qcow2 --container-format=bare < /var/kvm/images/fedora21.img

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 29e24bd0037fb3ca1183f64ac75e4141     |
| container_format | bare                                 |
| created_at       | 2015-01-06T10:58:22                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 2285e45a-6423-4f9f-a1ac-1ea1d2c757ea |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Fedora21                             |
| owner            | ba9a9493fcd34512bf09108e455dc17e     |
| protected        | False                                |
| size             | 1629356032                           |
| status           | active                               |
| updated_at       | 2015-01-06T10:58:32                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+

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

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

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 1fde1b5712b25dd1710acca5779e7cca     |
| container_format | bare                                 |
| created_at       | 2015-01-06T11:14:06                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 32f8999d-4242-43b4-ad3c-9b0b705dedd3 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Ubuntu1410                           |
| owner            | ba9a9493fcd34512bf09108e455dc17e     |
| protected        | False                                |
| size             | 266535424                            |
| status           | active                               |
| updated_at       | 2015-01-06T11:14:09                  |
| virtual_size     | None                                 |
+------------------+--------------------------------------+
Matched Content