CentOS Stream 8
Sponsored Link

OpenStack Victoria : Add VM Images2021/03/23

 
Add Virtual Machine images in Glance.
For example on here, add a CentOS Stream 8 virtual machine image.
[1]
Install KVM HyperVisor, refer to here.
It's unnecessarry to set Bridge networking on the section [2] of the link.
Fyrthermore, Install VM management tools, refer to here.
[2] Create a CentOS Stream 8 image on Glance service Host.
Download the ISO image of CentOS Stream 8 first into a directory before it.
# 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/centos-st8.img 10G
# install

[root@dlp ~(keystone)]#
virt-install \
--name centos-st8 \
--ram 4096 \
--disk path=/var/kvm/images/centos-st8.img,format=qcow2 \
--vcpus 2 \
--os-variant centos-stream8 \
--network network=default \
--graphics none \
--console pty,target_type=serial \
--location /home/CentOS-Stream-8-x86_64-20201203-dvd1.iso \
--extra-args 'console=ttyS0,115200n8 serial'
Starting install...
# after installing OS, login to the VM and configure necessary settings

CentOS Stream 8
Kernel 4.18.0-240.el8.x86_64 on an x86_64

Activate the web console with: systemctl enable --now cockpit.socket

localhost login: root

# replace the interface name [enp1s0] to your own environment

[root@localhost ~]#
useradd centos

[root@localhost ~]#
passwd centos

[root@localhost ~]#
vi /etc/sysconfig/network-scripts/ifcfg-enp1s0
# disable the [UUID] line and also set [dhcp] for [BOOTPROTO] line

#UUID="3ebe29b4-b7a3-49d6-997a-ee8b78749840"

BOOTPROTO=dhcp

[root@localhost ~]#
dnf -y install cloud-init openssh-server

[root@localhost ~]#
vi /etc/cloud/cloud.cfg
# line 5 : if you'd like to allo SSH password auth, change to [1]
ssh_pwauth:   1

# line 57, 58 : change to [centos] as default user
# if you'd like to allow SSH password auth to the user, chage like follows
system_info:
  default_user:
    name: centos
    lock_passwd: false

[root@localhost ~]#
systemctl enable cloud-init sshd

[root@localhost ~]#
shutdown -h now

[3] Add the virtual image to Glance.
[root@dlp ~(keystone)]#
openstack image create "CentOS-Stream-8" --file /var/kvm/images/centos-st8.img --disk-format qcow2 --container-format bare --public

+------------------+-------------------------------------------------------------------------------+
| Field            | Value                                                                         |
+------------------+-------------------------------------------------------------------------------+
| container_format | bare                                                                          |
| created_at       | 2021-03-23T02:16:16Z                                                          |
| disk_format      | qcow2                                                                         |
| file             | /v2/images/4d7293af-be5b-471b-9507-2a32f1955b11/file                          |
| id               | 4d7293af-be5b-471b-9507-2a32f1955b11                                          |
| min_disk         | 0                                                                             |
| min_ram          | 0                                                                             |
| name             | CentOS-Stream-8                                                               |
| owner            | b9bf51c6436a4c5aa7a2df05688afb49                                              |
| properties       | os_hidden='False', owner_specified.openstack.md5='', owner_specified.ope..... |
| protected        | False                                                                         |
| schema           | /v2/schemas/image                                                             |
| status           | queued                                                                        |
| tags             |                                                                               |
| updated_at       | 2021-03-23T02:16:16Z                                                          |
| visibility       | public                                                                        |
+------------------+-------------------------------------------------------------------------------+

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

+--------------------------------------+-----------------+--------+
| ID                                   | Name            | Status |
+--------------------------------------+-----------------+--------+
| 4d7293af-be5b-471b-9507-2a32f1955b11 | CentOS-Stream-8 | 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/20.04/release/ubuntu-20.04-server-cloudimg-amd64.img -P /var/kvm/images
[root@dlp ~(keystone)]#
openstack image create "Ubuntu2004-Official" --file /var/kvm/images/ubuntu-20.04-server-cloudimg-amd64.img --disk-format qcow2 --container-format bare --public

+------------------+----------------------------------------------------------------------------------------------+
| Field            | Value                                                                                        |
+------------------+----------------------------------------------------------------------------------------------+
| checksum         | be096b5b3c1a28f9416deed0253ad3e2                                                             |
| container_format | bare                                                                                         |
| created_at       | 2020-06-04T03:43:24Z                                                                         |
| disk_format      | qcow2                                                                                        |
| file             | /v2/images/ecfb5b90-eb90-436e-b853-16ede5f55bda/file                                         |
| id               | ecfb5b90-eb90-436e-b853-16ede5f55bda                                                         |
| min_disk         | 0                                                                                            |
| min_ram          | 0                                                                                            |
| name             | Ubuntu2004-Official                                                                          |
| owner            | 3227cdd34d5c4d9c97eeb8f0dfdf5d0e                                                             |
| properties       | os_hash_algo='sha512', os_hash_value='1cbc97f05e9de86ea571dd154b855dd217de51905367e9599c1... |
| protected        | False                                                                                        |
| schema           | /v2/schemas/image                                                                            |
| size             | 533856256                                                                                    |
| status           | active                                                                                       |
| tags             |                                                                                              |
| updated_at       | 2020-06-04T03:43:27Z                                                                         |
| visibility       | public                                                                                       |
+------------------+----------------------------------------------------------------------------------------------+
Matched Content