CentOS 7
Sponsored Link

OpenStack Stein : Add VM Images2019/05/16

 
Add Virtual Machine images in Glance.
For example on here, create and add CentOS 7 virtual machine image.
[1]
Install KVM HyperVisor, refer to here.
It's unnecessarry to set Bridge networking on the section [2] of the link.
[2] Create CentOS 7 image on Glance Host.
# 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/centos7.img 10G
# install

[root@dlp ~(keystone)]#
virt-install \
--name centos7 \
--ram 2048 \
--disk path=/var/kvm/images/centos7.img,format=qcow2 \
--vcpus 2 \
--os-type linux \
--os-variant rhel7 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.iij.ad.jp/pub/linux/centos/7/os/x86_64/' \
--extra-args 'console=ttyS0,115200n8 serial'
Starting install...    
# installation starts
[2]
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]
* Install [cloud-init] package and enable [cloud-init] service, and also add a user whose name is [centos]
[3] Add the virtual image to Glance.
[root@dlp ~(keystone)]#
openstack image create "CentOS7" --file /var/kvm/images/centos7.img --disk-format qcow2 --container-format bare --public

+------------------+------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                          |
+------------------+------------------------------------------------------------------------------------------------+
| checksum         | 8b1e9f1c1537b56d06f85e095a8b7d52                                                               |
| container_format | bare                                                                                           |
| created_at       | 2019-05-14T15:35:33Z                                                                           |
| disk_format      | qcow2                                                                                          |
| file             | /v2/images/0d0bf9ae-9d4c-445f-b2e0-5b322dffa988/file                                           |
| id               | 0d0bf9ae-9d4c-445f-b2e0-5b322dffa988                                                           |
| min_disk         | 0                                                                                              |
| min_ram          | 0                                                                                              |
| name             | CentOS7                                                                                        |
| owner            | 183a5ed32a77427986038c176b605d73                                                               |
| properties       | os_hash_algo='sha512', os_hash_value='51caff867e345ae5aa23498dc9f2c4d.....', os_hidden='False' |
| protected        | False                                                                                          |
| schema           | /v2/schemas/image                                                                              |
| size             | 1459617792                                                                                     |
| status           | active                                                                                         |
| tags             |                                                                                                |
| updated_at       | 2019-05-14T15:35:42Z                                                                           |
| virtual_size     | None                                                                                           |
| visibility       | public                                                                                         |
+------------------+------------------------------------------------------------------------------------------------+

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

+--------------------------------------+---------+--------+
| ID                                   | Name    | Status |
+--------------------------------------+---------+--------+
| 0d0bf9ae-9d4c-445f-b2e0-5b322dffa988 | CentOS7 | active |
+--------------------------------------+---------+--------+
[4] By the way, if you got an image from internet, it's OK to simply add it like follows.
[root@dlp ~(keystone)]#
wget http://cloud-images.ubuntu.com/releases/18.04/release/ubuntu-18.04-server-cloudimg-amd64.img -P /var/kvm/images
[root@dlp ~(keystone)]#
openstack image create "Ubuntu1804" --file /var/kvm/images/ubuntu-18.04-server-cloudimg-amd64.img --disk-format qcow2 --container-format bare --public

+------------------+-------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                           |
+------------------+-------------------------------------------------------------------------------------------------+
| checksum         | 8f92c8890165448793cee1f03264165a                                                                |
| container_format | bare                                                                                            |
| created_at       | 2019-04-11T02:32:59Z                                                                            |
| disk_format      | qcow2                                                                                           |
| file             | /v2/images/21050ab6-dbd7-487f-abf2-cabbab507abe/file                                            |
| id               | 21050ab6-dbd7-487f-abf2-cabbab507abe                                                            |
| min_disk         | 0                                                                                               |
| min_ram          | 0                                                                                               |
| name             | Ubuntu1804                                                                                      |
| owner            | e52584cf60234bc090c7d437b8ca7b62                                                                |
| properties       | os_hash_algo='sha512', os_hash_value='3e1ef6f0d9f90a9a2c21e7c2976c1762e9...', os_hidden='False' |
| protected        | False                                                                                           |
| schema           | /v2/schemas/image                                                                               |
| size             | 343736320                                                                                       |
| status           | active                                                                                          |
| tags             |                                                                                                 |
| updated_at       | 2019-04-11T02:33:02Z                                                                            |
| virtual_size     | None                                                                                            |
| visibility       | public                                                                                          |
+------------------+-------------------------------------------------------------------------------------------------+
Matched Content