이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Appendix C. Whole Disk Images
The main overcloud image is a flat partition image. This means it contains no partitioning information or bootloader on the images itself. The director uses a seperate kernel and ramdisk when booting and creates a basic partitioning layout when writing the overcloud image to disk. However, you can create a whole disk image, which includes a partitioning layout and bootloader.
C.1. Creating Whole Disk Images 링크 복사링크가 클립보드에 복사되었습니다!
Creating a whole disk image from the overcloud-full.qcow2 flat partition image involves the following steps:
-
Open the
overcloud-fullflat partition as a base for our whole disk image. - Create a new whole disk image with the desired size. This example uses a 10 GB image.
-
Create partitions and volumes on the whole disk image. Create as many partitions and volumes necessary for your desired whole disk image. This example creates an isolated partition for
bootand logical volumes for the other content in the filesystem. - Create the initial filesystems on the partitions and volumes.
- Mount flat partition filesystem and copy content to the right partitions on the whole disk image.
-
Generate the
fstabcontent and save it to/etc/fstabon the whole disk image. - Unmount all the filesystems.
-
Mount the partitions on the whole disk image only. Start with the root partition mounted at
/and mount the other partition in their respective directories. -
Install the bootloader using shell commands to execute
grub2-installandgrub2-mkconfigon the whole disk image. This installs thegrub2bootloader in the whole disk image. -
Update
dracutto provide support for logical volume management - Unmount all the filesystems and close the image
Manually Creating a Whole Disk Image
A recommended tool for creating images is guestfish, which you install using the following command:
sudo yum install -y guestfish
$ sudo yum install -y guestfish
Once installed, run the guestfish interactive shell:
For more information on using guestfish see "The Guestfish Shell" in the Virtualization Deployment and Administration Guide for Red Hat Enterprise Linux 7.
C.2. Automatically Creating a Whole Disk Image 링크 복사링크가 클립보드에 복사되었습니다!
The following Python script uses the guestfish library to automatically generate the whole disk image.
Save this script as a executable file on the undercloud and run it as the stack user:
./whole-disk-image.py
$ ./whole-disk-image.py
This automatically creates the whole disk image from the flat partition image. Once the whole disk image creation completes, replace the old overcloud-full.qcow2 image:
mv ~/images/overcloud-full.qcow2 ~/images/overcloud-full-old.qcow2 cp ~/images/overcloud-full-partitioned.qcow2 ~/images/overcloud-full.qcow2
$ mv ~/images/overcloud-full.qcow2 ~/images/overcloud-full-old.qcow2
$ cp ~/images/overcloud-full-partitioned.qcow2 ~/images/overcloud-full.qcow2
You can now upload the whole disk image along with your other images.
C.3. Encrypting Volumes on Whole Disk Images 링크 복사링크가 클립보드에 복사되었습니다!
You can also use guestfish to encrypt volumes on your whole disk image. This requires using the luks-format subcommand, which erases the current volume and creates an encrypted volume.
The following Python script opens the overcloud-full-partitioned.qcow2 image created previously, removes the current home volume (which is empty), and replaces it with an encrypted home volume:
This script also:
-
Creates a key (
random_content) -
Regenerates the
/etc/fstabfile with the new encrypted volume -
Saves the encryption key at
/root/home_keyfile -
Generates a
crypttabfile to automatically decrypt the volume using the/root/home_keyfile)
Use this script as an example to create encrypted volumes as part of your whole disk image creation process.
C.4. Uploading Whole Disk Images 링크 복사링크가 클립보드에 복사되었습니다!
To upload a whole disk image, use the --whole-disk-image option with the image upload command. For example:
openstack overcloud image upload --whole-disk --image-path /home/stack/images
$ openstack overcloud image upload --whole-disk --image-path /home/stack/images
This command uploads the images from /home/stack/images but treats the overcloud-full.qcow2 file as a whole disk image. This means you must rename the desired whole disk image to overcloud-full.qcow2 before running the image upload command.