This patch is adding a function called parse_root_device_hints to the
utils.py module. This function is responsible for parsing the root
device hints dictionary from the node's properties attribute.
Both Ironic and Ironic Python Agent project have similar functions so
adding it to ironic-lib would make it easier to share code between both
projects and fix bugs in only one place.
Change-Id: Ida6d20d1fdb40e50fe33ffec1c953286d4cbc2b7
Partial-Bug: #1605631
Wipefs sometimes failed with errors like 'Device or resource busy',
include --force option to fix the problems.
Change-Id: Iad864d7ae9ab67286853f3c533a9c385ffe2cb05
Closes-Bug: #1590304
Closes-Bug: #1580169
This adds the keyword argument 'log_stdout' (Boolean) to utils.execute().
If set to True, it will log the stdout returned by executing the
command. By default, it is True.
This argument is used in ipa's (ironic-python-agent) copy of execute(),
and is being added here in preparation for changing ipa to use this
library's execute().
The docstrings associated with utils.execute() were updated to reflect
the copy in ipa.
Change-Id: I44148c6e9150c7afd3de7b0b59bedb4983d9a6a7
Partial-Bug: 1587199
Some of the mocked objects in the unit tests do not have
autospec=True specified. This patch adds them, so that the
tests are consistent.
autospec=True is useful because it creates mock objects
that have the same attributes and methods as the objects
they are replacing.
Change-Id: I49b3a2dd7694666f6f62d3557ccee19a582d5868
This patch adds metrics to ironic-lib, so that it can be used by both
Ironic and IPA. It implements a generic MetricLogger including timers,
counters, and gauges with their respective decorators and context
managers. Two default MetricLogger are included: NoopMetricLogger and
StatsdMetricLogger.
Change-Id: I8a62414e6c03acb6f3457f1b8f81c03a9d3a8576
Co-Authored-By: Josh Gachnang <josh@pcsforeducation.com>
Co-Authored-By: Jim Rollenhagen <jim@jimrollenhagen.com>
Co-Authored-By: Alex Weeks <alex.weeks@gmail.com>
Partial-Bug: #1526219
This removes support for the deprecated configuration
options in the [deploy] group: efi_system_partition_size,
dd_block_size, iscsi_verify_attempts. They are available
in the [disk_util] group.
The three configuration options in [disk_util] had originally
been in ironic code (the [deploy] group) and was moved in
Feb 2015 to this library. Ironic started using this library
in (early) Mitaka development cycle.
Change-Id: Ie8ee2aab69ef2f0d711b276f3538c832c3369f29
Ironic doesn't support local booting of images in BIOS boot mode
when the disk_label is GPT. The current changes creates BIOS Boot
partition when the disk_label is chosen as gpt. The partition size
is a configurable parameter.
Change-Id: Iade60da0316b8f1c0bf8ce4c79931c1105d19cec
Closes-bug: #1563291
This patch is updating the README file to clarify that only projects
under the Ironic governance should be consuming this library.
Change-Id: Ie1430c955e44311bbe5d60503ee146ce1601612e
--coverage-package-name option was no longer supported by 'testr'[1].
This commit replaces from 'testr' to 'test' as coverage option.
[1] https://review.openstack.org/#/c/217847/
Change-Id: I0e3e5e837ee2f7275c489502700e91c15c7d44aa
Add entry points to explore config options.
This could be used for oslo-config-generator.
Partial-Bug: #1564195
Change-Id: Ibf844b903340f834cca5cc4539ddd9cecbeda90a
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
The eventlet library is used in testing. Move it to
test-requirements.txt.
The greenlet library is not directly used. Remove it from
requirements.txt.
Make it more explicit which tests need the eventlet mock.
Change-Id: I117ec6a2ee4bb1a52e6de088cd1ddd5b0cce5efe
This fix differentiates between the partition names for
the baremetal and the iSCSI device names used by conductor.
This is required for supporting partition images for
ironic-python-agent and ironic agent drivers. The
ironic-python-agent should be able to
name the device partitions as /dev/sda1, /dev/sda2, etc.
Change-Id: I22bc29a39bf5c35f3eecb6d4e51cebd6aee0ce19
Partial-bug: 1526289
This patch is mocking the methods that uses "fuser" after writing the
partition table, since this is a unittest and the partition table is
written to a temporary file we don't need fuser to be checking whether
other process are accessing that file descriptor or not.
Closes-Bug: #1550438
Change-Id: I2a12d4fc2e7df4eb24a977ee6b1ff5b3ad479755
This patch is adding support for choosing the disk label that will be
used when partitoning the disk.
Theoretically [0] GPT is compatible with old BIOS (it maintains a
"protected MBR") allowing partitions > 2TB for BIOS when used. And EFI
can boot from MBR, so no big deal.
If the disk label parameter is not specified, Ironic will take the
decision on which disk label it should used based on the boot mode (uefi
or bios), the approach taken by the patch is quite simple: If the boot
mode is UEFI we use GPT, otherwise we use MBR.
[0] http://www.rodsbooks.com/gdisk/bios.html
Partial-Bug: #1548788
Change-Id: I307315b1b32c9bf0babd7e42d4e9bc2030884980
These packages aren't used and are remove from requirements:
argparse, Jinja2, oslo.middleware, oslo.serialization, PrettyTable,
psutl, and pycrypto.
Change-Id: Ibbe1e1c6c6934f6d13ba6c844837f2b2f66960da