OpenStack Add Images to Glance

Learn to upload, configure, and manage cloud images in OpenStack Glance using CLI commands for local files and URLs.

OpenStack Add Images to Glance

Upload images to Glance using the openstack image create command with the appropriate disk and container formats.

Prerequisites

  • OpenStack 2024.2 (Dalmatian) with Glance active.
  • Source admin credentials (source admin-openrc.sh).
  • Image files available locally or via URL.

Step 1: Download Cloud Images

wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
wget https://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2
wget https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img

Step 2: Upload an Image

openstack image create \
  --disk-format qcow2 \
  --container-format bare \
  --public \
  --file jammy-server-cloudimg-amd64.img \
  "Ubuntu 22.04"

Step 3: Upload via URL

openstack image create \
  --disk-format qcow2 \
  --container-format bare \
  --public \
  --uri https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img \
  "Ubuntu 22.04 (web)"

Step 4: Set Image Properties

openstack image set \
  --property hw_scsi_model=virtio-scsi \
  --property hw_disk_bus=scsi \
  --property hw_qemu_guest_agent=yes \
  --property os_type=linux \
  --property os_distro=ubuntu \
  --property os_version=22.04 \
  --min-disk 10 \
  --min-ram 512 \
  "Ubuntu 22.04"

Step 5: Manage Images

openstack image list
openstack image list --public
openstack image list --long
openstack image show "Ubuntu 22.04"
openstack image delete "Ubuntu 22.04"
openstack image add project "Ubuntu 22.04" <target-project-id>
openstack image set --accept "Ubuntu 22.04"

Step 6: Create Images from Running Instances

openstack server image create --name "web-server-snapshot" my-vm
openstack image list --long

Troubleshooting

  • Upload hangs: Check /var/log/glance/glance-api.log and storage capacity.
  • Image stuck in queued: Verify Glance backend config and network.
  • VM fails to boot: Confirm --disk-format matches the file.
  • Permission denied: Verify image visibility and project membership.