Debian 12 bookworm
Sponsored Link

OpenStack Zed : Add VM images to Glance2023/06/27

 
Add Virtual Machine images to Glance.
[1]
Install KVM HyperVisor on Compute Host, refer to here.
It's unnecessary to set Bridge networking on the section [2] of the link.
[2] For example, Create a Virtual Machine image of Debian 12.
It uses Debian 12 installation ISO file for it on this example.
# 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/debian12.img 10G
# install

root@dlp ~(keystone)# virsh net-start default 
root@dlp ~(keystone)# virt-install \
--name debian12 \
--ram 4096 \
--disk path=/var/kvm/images/debian12.img,format=qcow2 \
--vcpus 2 \
--os-variant debian11 \
--network network=default \
--graphics none \
--console pty,target_type=serial \
--location /home/debian-12.0.0-amd64-DVD-1.iso \
--extra-args 'console=ttyS0,115200n8 serial' 

Starting install...    
# installation starts

# after finishing installation, configure guest system like follows

root@debian:~#
cat > /etc/apt/sources.list <<EOF
deb http://deb.debian.org/debian/ bookworm main non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates main non-free-firmware
deb http://deb.debian.org/debian/ bookworm-backports main non-free-firmware
EOF
root@debian:~#
apt update

root@debian:~#
apt -y install ssh cloud-init pollinate software-properties-common

root@debian:~#
vi /etc/default/grub
# line 40,41 : comment out

#
GRUB_TERMINAL=serial
#
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stopp=1"
root@debian:~#
update-grub
root@debian:~#
vi /etc/cloud/cloud.cfg
# line 13 : add it if you need

# only the case you'd like to allow SSH password authentication

ssh_pwauth: true
# line 91 : change it if you need

# only the case if you'd like to allow [debian] user to use SSH password auth

   default_user:
     name: debian
     lock_passwd: False
     gecos: Debian

root@debian:~#
vi /etc/network/interfaces
# comment out all except loopback interface

#
allow-hotplug enp1s0
#
iface enp1s0 inet dhcp
root@debian:~#
systemctl enable cloud-init ssh
# shutdown to finish settings

root@debian:~#
shutdown -h now
[3] Add the virtual image to Glance.
root@dlp ~(keystone)#
openstack image create "Debian12" --file /var/kvm/images/debian12.img --disk-format qcow2 --container-format bare --public

+------------------+------------------------------------------------------------------------------+
| Field            | Value                                                                        |
+------------------+------------------------------------------------------------------------------+
| container_format | bare                                                                         |
| created_at       | 2023-06-27T05:56:13Z                                                         |
| disk_format      | qcow2                                                                        |
| file             | /v2/images/9e7f953f-9918-453d-aeeb-def892492966/file                         |
| id               | 9e7f953f-9918-453d-aeeb-def892492966                                         |
| min_disk         | 0                                                                            |
| min_ram          | 0                                                                            |
| name             | Debian12                                                                     |
| owner            | 757625ae78404e38a8cfdd7c6d262860                                             |
| properties       | os_hidden='False', owner_specified.openstack.md5='', owner_specified.open... |
| protected        | False                                                                        |
| schema           | /v2/schemas/image                                                            |
| status           | queued                                                                       |
| tags             |                                                                              |
| updated_at       | 2023-06-27T05:56:13Z                                                         |
| visibility       | public                                                                       |
+------------------+------------------------------------------------------------------------------+

root@dlp ~(keystone)#
openstack image list

+--------------------------------------+----------+--------+
| ID                                   | Name     | Status |
+--------------------------------------+----------+--------+
| 9e7f953f-9918-453d-aeeb-def892492966 | Debian12 | 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/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img
root@dlp ~(keystone)#
openstack image create "Ubuntu2204" --file ubuntu-22.04-server-cloudimg-amd64.img --disk-format qcow2 --container-format bare --public

+------------------+--------------------------------------------------------------------------------+
| Field            | Value                                                                          |
+------------------+--------------------------------------------------------------------------------+
| container_format | bare                                                                           |
| created_at       | 2023-06-27T06:00:42Z                                                           |
| disk_format      | qcow2                                                                          |
| file             | /v2/images/e0a4b1f8-08fb-4de0-a273-7da551b2ab70/file                           |
| id               | e0a4b1f8-08fb-4de0-a273-7da551b2ab70                                           |
| min_disk         | 0                                                                              |
| min_ram          | 0                                                                              |
| name             | Ubuntu2204                                                                     |
| owner            | 757625ae78404e38a8cfdd7c6d262860                                               |
| properties       | os_hidden='False', owner_specified.openstack.md5='', owner_specified.openst... |
| protected        | False                                                                          |
| schema           | /v2/schemas/image                                                              |
| status           | queued                                                                         |
| tags             |                                                                                |
| updated_at       | 2023-06-27T06:00:42Z                                                           |
| visibility       | public                                                                         |
+------------------+--------------------------------------------------------------------------------+
Matched Content