OpenStack Epoxy : Add VM images to Glance2025/04/23 |
Add Virtual Machine images to Glance. |
|
[1] | For example, Create a Virtual Machine image of ubuntu 24.04. |
# download the official disk image root@dlp ~(keystone)# wget http://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img
# 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 ubuntu-24.04-server-cloudimg-amd64.img 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 96 : change # only the case if you'd like to allow [ubuntu] user to use SSH password auth
system_info:
# This will affect which distro class gets used
distro: ubuntu
# Default user name + that default users groups (if added/used)
default_user:
name: ubuntu
lock_passwd: False
gecos: Ubuntu
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 "Ubuntu2404" --file ubuntu-24.04-server-cloudimg-amd64.img --disk-format qcow2 --container-format bare --public +------------------+-----------------------------------------------------------+ | Field | Value | +------------------+-----------------------------------------------------------+ | checksum | f177e12285dddbf1e6b5cfbaceeb8dc5 | | container_format | bare | | created_at | 2025-04-22T11:04:04Z | | disk_format | qcow2 | | file | /v2/images/f1c2157b-e54b-42c2-a09d-885d21b7aa72/file | | id | f1c2157b-e54b-42c2-a09d-885d21b7aa72 | | min_disk | 0 | | min_ram | 0 | | name | Ubuntu2404 | | owner | 5039718bba1c4de9bb4b792bedfb358d | | properties | os_hash_algo='sha512', os_hash_value='5d0625aa5b24a67fc16 | | | 954fdbe0e9add61c7fef9e7f6640211349ffa9763d8b825a699568ba9 | | | 72053f6b5e0f5ef7ae22f59df187133d4c88afc058241b7672d9', | | | os_hidden='False', owner_specified.openstack.md5='', | | | owner_specified.openstack.object='images/Ubuntu2404', | | | owner_specified.openstack.sha256='', stores='fs' | | protected | False | | schema | /v2/schemas/image | | size | 612499456 | | status | active | | tags | | | updated_at | 2025-04-22T11:04:07Z | | virtual_size | 3758096384 | | visibility | public | +------------------+-----------------------------------------------------------+root@dlp ~(keystone)# openstack image list +--------------------------------------+------------+--------+ | ID | Name | Status | +--------------------------------------+------------+--------+ | f1c2157b-e54b-42c2-a09d-885d21b7aa72 | Ubuntu2404 | active | +--------------------------------------+------------+--------+ |
Sponsored Link |