by Anish
Posted on Sunday June 24
Openstack Image Service
The Image service (glance) enables users to discover, register, and retrieve virtual machine
Source the project credentials to gain access to project-only CLI commands:
. project-openrc
Download the Cirros for Testing Image
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
Upload the image to the Image service using the QCOW2 disk format, bare container format, and public visibility so all projects can access it:
openstack image create "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --public
Upload the image to the Image service using the vmdk disk format, ova container format, and public visibility so all projects can access it
openstack image create centos-7-repo-mirror --container-format ova --disk-format vmdk --file centos7-mirror-disk1.vmdk --public
Upload the image to the Image service using the ISO disk format, bare container format, and public visibility so all projects can access it
openstack image create rhel-workstation-7.3 --public --container-format bare --disk-format iso --file rhel-workstation-7.3-x86_64-dvd.iso --public
Openstack List Images
openstack image list
+--------------------------------------+-----------------------------+--------+
| ID | Name | Status |
+--------------------------------------+-----------------------------+--------+
| 50fc1d8b-7f7f-41d5-9ec8-8762d377a612 | CentOS-7-GenericCloud.qcow2 | active |
| 8758f8c4-f83b-4ecf-b833-9b6962bd894a | centos-7 | active |
| 817a63fc-b4e7-4e75-b230-5d27a78ee56a | centos-7-repo-mirror | active |
| f056158b-0750-4623-b42a-723dbedee99f | cirros | active |
| bee327db-797c-4014-8029-98ac7c21c6f1 | rhel-server-7.3-x86_64 | active |
| 61002bcf-c5bb-4c9e-81f5-b7ab184bddb7 | rhel-workstation-7.3 | active |
| 0b99acc1-b84b-46f3-a43a-aaf573a12a19 | rhel7-qcow2 | active |
+--------------------------------------+-----------------------------+--------+
Openstack delete Images
openstack image delete 50fc1d8b-7f7f-41d5-9ec8-8762d377a612
Openstack delete protected Images
openstack image set --unprotected 50fc1d8b-7f7f-41d5-9ec8-8762d377a612
openstack image delete 50fc1d8b-7f7f-41d5-9ec8-8762d377a612
Openstack glance upload image with default disk requirement
openstack image create rhel-workstation-7.3 --public --container-format bare --disk-format iso --file rhel-workstation-7.3-x86_64-dvd.iso --public --protected --min-disk 20
Glance Disks and Container Formats
Disk Format |
Container Format |
||
aki |
Amazon Kernel Package |
aki |
Amazon Kernel Package |
ami |
Amazon machine image |
ami |
Amazon machine image |
ari |
Amazon ramdisk Image |
ari |
Amazon ramdisk Image |
iso |
Optical disks |
bare |
The image does not have a container or metadata envelope. It is safe to specify bare as the container format if you are unsure. |
qcow2
|
Qemu Emulator |
Docker |
A docker container format.
|
raw
|
An unstructured disk image format Usually without Extenstions |
ova
|
An OVF package in a tarfile.
|
vdi |
Oracle VirtualBox |
ovf |
The OVF container format.
|
vhd |
Used by Oracle Virtual Box, vmWare,Xen |
|
|
vhdx |
Enhanced version of vhd format |
|
|
vmdk |
Common disk format |
|