Thursday, December 4, 2025

OpenStack Epoxy : Add VM images to Glance

 

OpenStack Epoxy : Add VM images to Glance

 

Add Virtual Machine images to Glance.

[1]For example, Create a Virtual Machine image of Debian 13.
# download the official disk image

root@dlp ~(keystone)# 
wget https://cloud.debian.org/images/cloud/trixie/latest/debian-13-generic-amd64.qcow2
# if you'd like to change settings in the image, configure like follows
# mount disk image

root@dlp ~(keystone)# 
modprobe nbd

root@dlp ~(keystone)# 
qemu-nbd --connect=/dev/nbd0 debian-13-generic-amd64.qcow2

root@dlp ~(keystone)# 
mount /dev/nbd0p1 /mnt

root@dlp ~(keystone)# 
vi /mnt/etc/cloud/cloud.cfg
# line 13 : add
# this is for only the case you want to allow SSH password authentication

ssh_pwauth: true
# line 99 : change
# only the case if you'd like to allow [debian] user to use SSH password auth

system_info:
   # This will affect which distro class gets used
   distro: debian
   # Default user name + that default users groups (if added/used)
   default_user:
     name: debian
     lock_passwd: False
     gecos: Debian

root@dlp ~(keystone)# 
umount /mnt

root@dlp ~(keystone)# 
qemu-nbd --disconnect /dev/nbd0p1

/dev/nbd0p1 disconnected
# add image to Glance

root@dlp ~(keystone)# 
openstack image create "Debian13" --file debian-13-generic-amd64.qcow2 --disk-format qcow2 --container-format bare --public

+------------------+-----------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                     |
+------------------+-----------------------------------------------------------------------------------------------------------+
| checksum         | 3e490aff0c7113d2668e46090cf5aaea                                                                          |
| container_format | bare                                                                                                      |
| created_at       | 2025-08-27T00:19:31Z                                                                                      |
| disk_format      | qcow2                                                                                                     |
| file             | /v2/images/33def798-3361-483b-9de1-8c2c6e1c840c/file                                                      |
| id               | 33def798-3361-483b-9de1-8c2c6e1c840c                                                                      |
| min_disk         | 0                                                                                                         |
| min_ram          | 0                                                                                                         |
| name             | Debian13                                                                                                  |
| owner            | d5ba291bfcdc4f8982cf5c28922f56be                                                                          |
| properties       | os_hash_algo='sha512', os_hash_value='6826f96ea23da9966aee2a0706e70b66e306fcfc3ccddbf3f122352527af04c2c7f |
|                  | 9af2568c53d08c29a18d52d3ae430fa7fbc5720e899fd992f611290a0ecca', os_hidden='False',                        |
|                  | owner_specified.openstack.md5='', owner_specified.openstack.object='images/Debian13',                     |
|                  | owner_specified.openstack.sha256='', stores='fs'                                                          |
| protected        | False                                                                                                     |
| schema           | /v2/schemas/image                                                                                         |
| size             | 433192960                                                                                                 |
| status           | active                                                                                                    |
| tags             |                                                                                                           |
| updated_at       | 2025-08-27T00:19:33Z                                                                                      |
| virtual_size     | 3221225472                                                                                                |
| visibility       | public                                                                                                    |
+------------------+-----------------------------------------------------------------------------------------------------------+

root@dlp ~(keystone)# 
openstack image list

+--------------------------------------+----------+--------+
| ID                                   | Name     | Status |
+--------------------------------------+----------+--------+
| 33def798-3361-483b-9de1-8c2c6e1c840c | Debian13 | active |
+--------------------------------------+----------+--------+
Matched Content

No comments:

Post a Comment