Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 2. Managing images
The Image service (glance) provides discovery, registration, and delivery services for disk and server images. It provides the ability to copy or snapshot a server image, and immediately store it. You can use stored images as templates to commission new servers quickly and more consistently than installing a server operating system and individually configuring services.
2.1. Creating images Copier lienLien copié sur presse-papiers!
To create images, you can use Red Hat Enterprise Linux (RHEL) Kernel-based Virtual Machine (KVM) guest images, or you can manually create Red Hat OpenStack Platform (RHOSP) compatible images in the QCOW2 format by using RHEL ISO files or Windows ISO files.
2.1.1. Use a KVM guest image with Red Hat OpenStack Platform Copier lienLien copié sur presse-papiers!
You can use one of the following ready Red Hat Enterprise Linux (RHEL) Kernel-based Virtual Machine (KVM) guest QCOW2 images:
These images are configured with cloud-init and must take advantage of EC2-compatible metadata services for provisioning SSH keys to function correctly.
Ready Windows KVM guest QCOW2 images are not available.
For KVM guest images:
-
The
rootaccount in the image is deactivated, butsudoaccess is granted to a special user namedcloud-user. -
There is no
rootpassword set for this image.
The root password is locked in /etc/shadow by placing !! in the second field.
For a Red Hat OpenStack Platform (RHOSP) instance, generate an SSH keypair from the RHOSP dashboard or command line, and use that key combination to perform an SSH public authentication to the instance as root user.
When you launch the instance, this public key is injected to it. You can then authenticate by using the private key that you download when you create the keypair.
2.1.2. Create custom Red Hat Enterprise Linux or Windows images Copier lienLien copié sur presse-papiers!
To create custom Red Hat Enterprise Linux (RHEL) or Windows images, ensure that you have the following prerequistes in place.
Prerequisites
- A Linux host machine to create an image. This can be any machine on which you can install and run the Linux packages, except for the undercloud or the overcloud.
The advanced-virt repository is enabled:
sudo subscription-manager repos --enable=advanced-virt-for-rhel-8-x86_64-rpms
$ sudo subscription-manager repos --enable=advanced-virt-for-rhel-8-x86_64-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
virt-managerapplication is installed to have all packages necessary to create a guest operating system:sudo dnf module install -y virt
$ sudo dnf module install -y virtCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
libguestfs-toolspackage is installed to have a set of tools to access and modify virtual machine images:sudo dnf install -y libguestfs-tools-c
$ sudo dnf install -y libguestfs-tools-cCopy to Clipboard Copied! Toggle word wrap Toggle overflow - A RHEL 9 or 8 ISO file or a Windows ISO file. For more information about RHEL ISO files, see RHEL 9.0 Binary DVD or RHEL 8.6 Binary DVD. If you do not have a Windows ISO file, see the Microsoft Evaluation Center to download an evaluation image.
-
A text editor, if you want to change the
kickstartfiles (RHEL only).
If you install the libguestfs-tools package on the undercloud, disable iscsid.socket to avoid port conflicts with the tripleo_iscsid service on the undercloud:
sudo systemctl disable --now iscsid.socket
$ sudo systemctl disable --now iscsid.socket
2.1.3. Creating a Red Hat Enterprise Linux 9 image Copier lienLien copié sur presse-papiers!
Manually create a Red Hat OpenStack Platform (RHOSP) compatible image in the QCOW2 format by using a Red Hat Enterprise Linux (RHEL) 9 ISO file.
You must run all commands with the [root@host]# on your host machine.
Procedure
Start the installation by using
virt-install:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace the values in angle brackets
<>with the correct values for your RHEL 9 image.This command launches an instance and starts the installation process.
NoteIf the instance does not launch automatically, run the
virt-viewercommand to view the console:virt-viewer <rhel9>
[root@host]# virt-viewer <rhel9>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configure the instance:
- At the initial Installer boot menu, select Install Red Hat Enterprise Linux 9.
- Choose the appropriate Language and Keyboard options.
- When prompted about which type of devices your installation uses, select Auto-detected installation media.
- When prompted about which type of installation destination, select Local Standard Disks. For other storage options, select Automatically configure partitioning.
- Choose the Basic Server install, which installs an SSH server.
- For network and host name, select eth0 for network and choose a host name for your device. The default host name is localhost.localdomain.
Enter a password in the Root Password field and enter the same password again in the Confirm field.
- Result
- The installation process completes and the Complete! screen is displayed.
- After the installation is complete, reboot the instance and log in as the root user.
Update the
/etc/sysconfig/network-scripts/ifcfg-eth0file so that it contains only the following values:TYPE=Ethernet DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp NM_CONTROLLED=no
TYPE=Ethernet DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp NM_CONTROLLED=noCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Reboot the machine.
Register the machine with the Content Delivery Network.
sudo subscription-manager register sudo subscription-manager attach --pool=Valid-Pool-Number-123456 sudo subscription-manager repos --enable=rhel-9-server-rpms
# sudo subscription-manager register # sudo subscription-manager attach --pool=Valid-Pool-Number-123456 # sudo subscription-manager repos --enable=rhel-9-server-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Update the system:
dnf -y update
# dnf -y updateCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
cloud-initpackages:dnf install -y cloud-utils-growpart cloud-init
# dnf install -y cloud-utils-growpart cloud-initCopy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/etc/cloud/cloud.cfgconfiguration file and add the following content undercloud_init_modules:- resolv-conf
- resolv-confCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
resolv-confoption automatically configures theresolv.conffile when an instance boots for the first time. This file contains information related to the instance such asnameservers,domain, and other options.Add the following line to
/etc/sysconfig/networkto avoid issues when accessing the EC2 metadata service:NOZEROCONF=yes
NOZEROCONF=yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow To ensure that the console messages appear in the Log tab on the dashboard and the
nova console-logoutput, add the following boot option to the/etc/default/grubfile:GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
grub2-mkconfigcommand:grub2-mkconfig -o /boot/grub2/grub.cfg
# grub2-mkconfig -o /boot/grub2/grub.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output is as follows:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deregister the instance so that the resulting image does not contain the subscription details for this instance:
subscription-manager repos --disable=* subscription-manager unregister dnf clean all
# subscription-manager repos --disable=* # subscription-manager unregister # dnf clean allCopy to Clipboard Copied! Toggle word wrap Toggle overflow Power off the instance:
poweroff
# poweroffCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reset and clean the image by using the
virt-sysprepcommand so that it can be used to create instances without issues:virt-sysprep -d <rhel9>
[root@host]# virt-sysprep -d <rhel9>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reduce the image size by converting any free space within the disk image back to free space within the host:
virt-sparsify \ --compress <rhel9.qcow2> <rhel9-cloud.qcow2>
[root@host]# virt-sparsify \ --compress <rhel9.qcow2> <rhel9-cloud.qcow2>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command creates a new
<rhel9-cloud.qcow2>file in the location from where the command is run.NoteYou must manually resize the partitions of instances based on the image in accordance with the disk space in the flavor that is applied to the instance.
The <rhel9-cloud.qcow2> image file is ready to be uploaded to the Image service. For more information about uploading this image to your RHOSP deployment, see Uploading an image.
2.1.4. Creating a Red Hat Enterprise Linux 8 image Copier lienLien copié sur presse-papiers!
Manually create a Red Hat OpenStack Platform (RHOSP) compatible image in the QCOW2 format by using a Red Hat Enterprise Linux (RHEL) 8 ISO file.
You must run all commands with the [root@host]# on your host machine.
Procedure
Start the installation by using
virt-install:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace the values in angle brackets
<>with the correct values for your RHEL 8 image.This command launches an instance and starts the installation process.
NoteIf the instance does not launch automatically, run the
virt-viewercommand to view the console:virt-viewer <rhel86-cloud-image>
[root@host]# virt-viewer <rhel86-cloud-image>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configure the instances:
At the initial Installer boot menu, select Install or upgrade an existing system and follow the installation prompts. Accept the defaults.
The disk installer provides an option to test your installation media before installation. Select OK to run the test or Skip to proceed without testing.
- Choose the appropriate Language and Keyboard options.
- When prompted about which type of devices your installation uses, select Basic Storage Devices.
-
Choose a host name for your device. The default host name is
localhost.localdomain. -
Set the timezone and
rootpassword. - Based on the space on the disk, choose the type of installation you want from the options in the Which type of installation would you like? window.
- Choose the Basic Server install, which installs an SSH server.
- The installation process completes and the Congratulations, your Red Hat Enterprise Linux installation is complete screen is displayed.
-
Reboot the instance and log in as the
rootuser. Update the
/etc/sysconfig/network-scripts/ifcfg-eth0file so that it contains only the following values:TYPE=Ethernet DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp NM_CONTROLLED=no
TYPE=Ethernet DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp NM_CONTROLLED=noCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Reboot the machine.
Register the machine with the Content Delivery Network:
sudo subscription-manager register sudo subscription-manager attach --pool=Valid-Pool-Number-123456 sudo subscription-manager repos --enable=rhel-8-server-rpms
# sudo subscription-manager register # sudo subscription-manager attach --pool=Valid-Pool-Number-123456 # sudo subscription-manager repos --enable=rhel-8-server-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Update the system:
dnf -y update
# dnf -y updateCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
cloud-initpackages:dnf install -y cloud-utils-growpart cloud-init
# dnf install -y cloud-utils-growpart cloud-initCopy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/etc/cloud/cloud.cfgconfiguration file and add the following content undercloud_init_modules.- resolv-conf
- resolv-confCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
resolv-confoption automatically configures theresolv.conffile when an instance boots for the first time. This file contains information related to the instance such asnameservers,domain, and other options.To prevent network issues, create
/etc/udev/rules.d/75-persistent-net-generator.rules:echo "#" > /etc/udev/rules.d/75-persistent-net-generator.rules
# echo "#" > /etc/udev/rules.d/75-persistent-net-generator.rulesCopy to Clipboard Copied! Toggle word wrap Toggle overflow This prevents the
/etc/udev/rules.d/70-persistent-net.rulesfile from being created. If the/etc/udev/rules.d/70-persistent-net.rulesfile is created, networking might not function correctly when you boot from snapshots because the network interface is created aseth1instead ofeth0and the IP address is not assigned.Add the following line to
/etc/sysconfig/networkto avoid issues when accessing the EC2 metadata service:NOZEROCONF=yes
NOZEROCONF=yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow To ensure that the console messages appear in the Log tab on the dashboard and the
nova console-logoutput, add the following boot option to the/etc/grub.conffile:console=tty0 console=ttyS0,115200n8
console=tty0 console=ttyS0,115200n8Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deregister the virtual machine so that the resulting image does not contain the same subscription details for this instance:
subscription-manager repos --disable=* subscription-manager unregister dnf clean all
# subscription-manager repos --disable=* # subscription-manager unregister # dnf clean allCopy to Clipboard Copied! Toggle word wrap Toggle overflow Power off the instance:
poweroff
# poweroffCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reset and clean the image by using the
virt-sysprepcommand so that it can be used to create instances without issues:virt-sysprep -d <rhel86-cloud-image>
[root@host]# virt-sysprep -d <rhel86-cloud-image>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reduce the image size by using the
virt-sparsifycommand. This command converts any free space within the disk image back to free space within the host:virt-sparsify \ --compress <rhel86.qcow2> <rhel86-cloud.qcow2>
[root@host]# virt-sparsify \ --compress <rhel86.qcow2> <rhel86-cloud.qcow2>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command creates a new
<rhel86-cloud.qcow2>file in the location from where the command is run.NoteYou must manually resize the partitions of instances based on the image in accordance with the disk space in the flavor that is applied to the instance.
The <rhel86-cloud.qcow2> image file is ready to be uploaded to the Image service. For more information about uploading this image to your RHOSP deployment, see Uploading an image.
2.1.5. Creating a Windows image Copier lienLien copié sur presse-papiers!
Manually create a Red Hat OpenStack Platform (RHOSP) compatible image in the QCOW2 format by using a Windows ISO file.
You must run all commands with the [root@host]# on your host machine.
Procedure
Start the installation by using
virt-install:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace the following values of the
virt-installparameters:-
<name>— the name that the Windows instance has. -
<size>— disk size in GB. -
<path>— the path to the Windows installation ISO file. <RAM>— the requested amount of RAM in MB.NoteThe
--os-type=windowsparameter ensures that the clock is configured correctly for the Windows guest, and enables its Hyper-V enlightenment features. You must also setos_type=windowsin the image metadata before uploading the image to the Image service (glance).
-
The
virt-installcommand saves the guest image as/var/lib/libvirt/images/<name>.qcow2by default. If you want to keep the guest image elsewhere, change the parameter of the--diskoption:--disk path=<filename>,size=<size>
--disk path=<filename>,size=<size>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<filename>with the name of the file that stores the instance image, and optionally its path. For example,path=win8.qcow2,size=8creates an 8 GB file namedwin8.qcow2in the current working directory.TipIf the guest does not launch automatically, run the
virt-viewercommand to view the console:virt-viewer <name>
[root@host]# virt-viewer <name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about how to install Windows, see the relevant Microsoft documentation.
-
To allow the newly installed Windows system to use the virtualized hardware, you might need to install VirtIO drivers. To do so, install the image by attaching it as a CD-ROM drive to the Windows instance. To install the
virtio-winpackage, you must add the VirtIO ISO image to the instance, and install the VirtIO drivers. For more information, see Installing KVM paravirtualized drivers for Windows virtual machines in Configuring and managing virtualization. To complete the configuration, download and execute Cloudbase-Init on the Windows system. At the end of the installation of Cloudbase-Init, select the Run Sysprep and Shutdown checkboxes. The
Syspreptool makes the guest unique by generating an OS ID, which is used by certain Microsoft services.ImportantRed Hat does not provide technical support for Cloudbase-Init. If you encounter an issue, see Contact Cloudbase Solutions.
When the Windows system shuts down, the <name>.qcow2 image file is ready to be uploaded to the Image service. For more information about uploading this image to your RHOSP deployment, see Uploading an image.
2.1.5.1. Metadata properties Copier lienLien copié sur presse-papiers!
The Compute service (nova) has deprecated support for using libosinfo data to set default device models. Instead, use the following image metadata properties to configure the optimal virtual hardware for an instance:
-
os_distro -
os_version -
hw_cdrom_bus -
hw_disk_bus -
hw_scsi_model -
hw_vif_model -
hw_video_model -
hypervisor_type
For more information about these metadata properties, see Image configuration parameters.
2.1.6. Create an image for UEFI Secure Boot Copier lienLien copié sur presse-papiers!
When the overcloud contains UEFI Secure Boot Compute nodes, you can create a Secure Boot instance image that cloud users can use to launch Secure Boot instances.
Procedure
Create a new image for UEFI Secure Boot:
openstack image create --file <base_image_file> uefi_secure_boot_image
$ openstack image create --file <base_image_file> uefi_secure_boot_imageCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<base_image_file>with an image file that supports UEFI and the GUID Partition Table (GPT) standard, and includes an EFI system partition.
-
Replace
If the default machine type is not
q35, then set the machine type toq35:openstack image set --property hw_machine_type=q35 uefi_secure_boot_image
$ openstack image set --property hw_machine_type=q35 uefi_secure_boot_imageCopy to Clipboard Copied! Toggle word wrap Toggle overflow Specify that the instance must be scheduled on a UEFI Secure Boot host:
openstack image set \ --property hw_firmware_type=uefi \ --property os_secure_boot=required \ uefi_secure_boot_image
$ openstack image set \ --property hw_firmware_type=uefi \ --property os_secure_boot=required \ uefi_secure_boot_imageCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2. Uploading an image Copier lienLien copié sur presse-papiers!
Upload an image to the Red Hat OpenStack Platform (RHOSP) Image service (glance).
Procedure
Use the
glance image-createcommand with thepropertyoption to upload an image.For example:
glance image-create --name <NAME> \ --is-public true --disk-format qcow2 \ --container-format bare \ --file <IMAGE_FILE> \ --property <IMAGE_METADATA>$ glance image-create --name <NAME> \ --is-public true --disk-format qcow2 \ --container-format bare \ --file <IMAGE_FILE> \ --property <IMAGE_METADATA>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
For a list of
glance image-createcommand options, see Image service (glance) command options. - For a list of property keys, see Image configuration parameters.
-
For a list of
2.3. Updating an image Copier lienLien copié sur presse-papiers!
Update an image.
Procedure
Use the
glance image-updatecommand with thepropertyoption to update an image.For example:
glance image-update IMG-UUID \ --property architecture=x86_64$ glance image-update IMG-UUID \ --property architecture=x86_64Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
For a list of
glance image-updatecommand options, see Image service (glance) command options. - For a list of property keys, see Image configuration parameters.
-
For a list of
2.4. Importing an image Copier lienLien copié sur presse-papiers!
You can import images to the Image service (glance) by using one of the following two methods:
-
Use
web-downloadto import an image from a URI. -
Use
glance-directto import an image from a local file system.
The web-download method is enabled by default. The cloud administrator configures import methods. You can run the glance import-info command to list available import options.
2.4.1. Import an image from a remote URI Copier lienLien copié sur presse-papiers!
You can use the web-download method to copy an image from a remote URI.
Create an image and specify the URI of the image to import:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<CONTAINER FORMAT>with the container format that you are setting set for your image (None, ami, ari, aki, bare, ovf, ova, docker). -
Replace
<DISK-FORMAT>with the disk format that you are setting set for your image (None, ami, ari, aki, vhd, vhdx, vmdk, raw, qcow2, vdi, iso, ploop). -
Replace
<NAME>with a descriptive name for your image. -
Replace
<URI>with the URI of your image.
-
Replace
You can check the availability of the image by using the
glance image-show <IMAGE_ID>command.-
Replace
<IMAGE_ID>with the ID you provided during image creation.
-
Replace
The Image service web download method uses a two-stage process to perform the import:
-
The
web downloadmethod creates an image record. -
The
web downloadmethod retrieves the image from the specified URI.
The URI is subject to optional denylist and allowlist filtering.
The Image Property Injection plugin may inject metadata properties to the image. These injected properties determine which compute nodes the image instances are launched on.
2.4.2. Import an image from a local volume Copier lienLien copié sur presse-papiers!
The glance-direct method creates an image record, which generates an image ID. After the image is uploaded to the Image service from a local volume, it is stored in a staging area and is made active after it passes any configured checks. The glance-direct method requires a shared staging area when used in a highly available (HA) configuration.
Image uploads that use the glance-direct method can fail in a HA environment if a common staging area is not present. In a HA active-active environment, API calls are distributed to the Image service controllers. The download API call can be sent to a different controller than the API call to upload the image.
The glance-direct method uses three different calls to import an image:
-
glance image-create -
glance image-stage -
glance image-import
You can use the glance image-create-via-import command to perform all three of these calls in one command:
glance image-create-via-import \
--container-format <CONTAINER FORMAT> \
--disk-format <DISK-FORMAT> \
--name <NAME> \
--file </PATH/TO/IMAGE>
$ glance image-create-via-import \
--container-format <CONTAINER FORMAT> \
--disk-format <DISK-FORMAT> \
--name <NAME> \
--file </PATH/TO/IMAGE>
-
Replace
<CONTAINER FORMAT>,<DISK-FORMAT>,<NAME>, and</PATH/TO/IMAGE>with the relevant values for your image.
After the image moves from the staging area to the back-end location, the image is listed. However, it might take some time for the image to become active.
You can check the availability of the image by using the glance image-show <IMAGE_ID> command.
-
Replace
<IMAGE_IDwith the ID you provided during image creation.
2.5. Deleting an image Copier lienLien copié sur presse-papiers!
Procedure
Use the
glance image-deletecommand to delete one or more images:glance image-delete <IMAGE_ID> [<IMAGE_ID> ...]
$ glance image-delete <IMAGE_ID> [<IMAGE_ID> ...]Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace <IMAGE_ID> with the ID of the image you want to delete.
NoteThe
glance image-deletecommand permanently deletes the image and all copies of the image, as well as the image instance and metadata.
2.6. Hiding or unhiding an image Copier lienLien copié sur presse-papiers!
You can hide public images from normal listings presented to users. For instance, you can hide obsolete CentOS 7 images and show only the latest version to simplify the user experience. Users can discover and use hidden images.
To hide an image:
glance image-update <image_id> --hidden 'true'
glance image-update <image_id> --hidden 'true'
To create a hidden image, add the --hidden argument to the glance image-create command.
To unhide an image:
glance image-update <image_id> --hidden 'false'
glance image-update <image_id> --hidden 'false'
Show hidden images
To list hidden images:
glance image-list --hidden 'true'
glance image-list --hidden 'true'
2.7. Enabling image conversion Copier lienLien copié sur presse-papiers!
You can upload a QCOW2 image to the Image service (glance) by enabling the GlanceImageImportPlugins parameter. You can then convert the QCOW2 image to RAW format.
Image conversion is automatically enabled when you use Red Hat Ceph Storage RADOS Block Device (RBD) to store images and boot Nova instances.
To enable image conversion, create an environment file that contains the following parameter value. Include the new environment file with the -e option in the openstack overcloud deploy command:
parameter_defaults: GlanceImageImportPlugins:'image_conversion'
parameter_defaults:
GlanceImageImportPlugins:'image_conversion'
Use the Image service command-line client for image management.
2.7.1. Converting an image to RAW format Copier lienLien copié sur presse-papiers!
Red Hat Ceph Storage can store, but does not support using, QCOW2 images to host virtual machine (VM) disks.
When you upload a QCOW2 image and create a VM from it, the compute node downloads the image, converts the image to RAW, and uploads it back into Ceph, which can then use it. This process affects the time it takes to create VMs, especially during parallel VM creation.
For example, when you create multiple VMs simultaneously, uploading the converted image to the Ceph cluster might impact already running workloads. The upload process can starve those workloads of IOPS and impede storage responsiveness.
To boot VMs in Ceph more efficiently (ephemeral back end or boot from volume), the glance image format must be RAW.
Procedure
Converting an image to RAW might yield an image that is larger in size than the original QCOW2 image file. Run the following command before the conversion to determine the final RAW image size:
qemu-img info <image>.qcow2
qemu-img info <image>.qcow2Copy to Clipboard Copied! Toggle word wrap Toggle overflow Convert an image from QCOW2 to RAW format:
qemu-img convert -p -f qcow2 -O raw <original qcow2 image>.qcow2 <new raw image>.raw
qemu-img convert -p -f qcow2 -O raw <original qcow2 image>.qcow2 <new raw image>.rawCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.7.1.1. Configuring disk formats in the Image service (glance) Copier lienLien copié sur presse-papiers!
You can the configure the Image service (glance) to enable or reject disk formats by using the GlanceDiskFormats parameter.
Procedure
-
Log in to the undercloud host as the
stackuser. Source the undercloud credentials file:
source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Include the
GlanceDiskFormatsparameter in an environment file, for example,glance_disk_formats.yaml:parameter_defaults: GlanceDiskFormats: - <disk_format>parameter_defaults: GlanceDiskFormats: - <disk_format>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, use the following configuration to enable only RAW and ISO disk formats:
parameter_defaults: GlanceDiskFormats: - raw - iso
parameter_defaults: GlanceDiskFormats: - raw - isoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use the following example configuration to reject QCOW2 disk images:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Include the environment file that contains your new configuration in the
openstack overcloud deploycommand with any other environment files that are relevant to your environment:openstack overcloud deploy --templates \ -e <overcloud_environment_files> \ -e <new_environment_file> \ …
$ openstack overcloud deploy --templates \ -e <overcloud_environment_files> \ -e <new_environment_file> \ …Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<overcloud_environment_files>with the list of environment files that are part of your deployment. -
Replace
<new_environment_file>with the environment file that contains your new configuration.
-
Replace
For more information about the disk formats available in RHOSP, see Image configuration parameters.
2.7.2. Storing an image in RAW format Copier lienLien copié sur presse-papiers!
With the GlanceImageImportPlugins parameter enabled, run the following command to store a previously created image in RAW format:
-
For
--name, replaceNAMEwith the name of the image; this is the name that will appear inglance image-list. -
For
--uri, replacehttp://server/image.qcow2with the location and file name of the QCOW2 image.
This command example creates the image record and imports it by using the web-download method. The glance-api downloads the image from the --uri location during the import process. If web-download is not available, glanceclient cannot automatically download the image data. Run the glance import-info command to list the available image import methods.