Adds a new module for two qemu-img wrappers that are used both by Ironic
and IPA. The remaining functions in disk_utils are only used by IPA and,
since most of them require root, can no longer be used in the
post-rootwrap Ironic any more. They should be moved to IPA eventually.
Change-Id: I3364a58b52a3e57c2f52356a6496865b749e74a8
This is the path where ironic searches for rootwrap filter files by
default.
This is important because ironic itself is going to remove [1] its
copy of the ironic-lib.filters file.
[1] https://review.opendev.org/#/c/684270
Change-Id: I2241bfd11c66fb84b8840ab76563af52fe93e5ad
Previously it was checked using blkid -t LABEL=config-2, but
this was not finding the partition, causing that images with a
pre-existing config-drive partition had an extra one created
by ironic.
Switched to using the 'lsblk' command and parsing the output of that to
get the information on the partition.
Change-Id: Ic5228ce91d1a133fd846ceb7be547a227292dd38
Closes-Bug: #1654269
Depends-On: I3676cd8e5c5e61fe4e3f67ab9e121c4cd0cd599b
This will work for UEFI only or BIOS only images. It will not
work for hybrid images; which are capable of boot from BIOS
and UEFI boot mode.
Partial-Bug: #1493328
Change-Id: I4c517f63d620b5a9de31ecb2d7c209776d5ded48
destroy_disk_metadata should destroy a bit more data than expected if we
want to be sure grub won't conflict with remaining bits of filesystem.
grub probes the hard drive to find remaining partition or filesystem. If
it find something, it will refuse to install itself on the disk.
By using wipefs instead of dd, we not only erase the MBR and partition
table but also all trace of filesystem, raid or partition-table signatures
(magic strings). This without extra Python code.
wipefs is part of util-linux which is available on all the Linux
distribution.
References:
https://review.openstack.org/#/c/284347/https://bugzilla.redhat.com/show_bug.cgi?id=1310883
Partial-Bug: 1550604
Change-Id: I39637e22c344703ad48fc271f6f866aa018bbdd1
ironic-lib will use the command set in the new 'root_helper' conf parameter to execute
commands as root user. If this configuration paramter is not specified,
ironic-lib will execute commands with run_as_root=False. This configuration
is not set by default.
'rootwrap_config' and 'rootwrap_helper_cmd' configs are deleted, since
they are replaced by the new 'root_helper' config.
This fix also delivers a sample ironic-lib.filters file, which should be used
with rootwrap command.
Change-Id: I61ef7c15237c995e9d4cc85095ac48a30a8f6c7d
Closes-bug: #1515943