When we added software raid support, we started calling bootloader
installation. As time went on, we ehnanced that code path for non
RAID cases in order to ensure that UEFI nvram was setup
for the instance to boot properly.
Somewhere in this process, we missed a possible failure case where
the iscsi client tgtadm may return failures. Obviously, the correct
path is to not call iscsi teardown if we don't need to.
Since it was always semi-opportunistic teardown, we can't blindly
catch any error, and if we started iSCSI and failed to tear the
connection down, we might want to still fail, so this change
moves the logic over to use a flag on the agent object which
one extension to set the flag and the other to read it and take
action based upon that.
Change-Id: Id3b1ae5e59282f4109f6246d5614d44c93aefa7c
Story: 2007937
Task: 40395
In some cases, where the rts library is not installed, IPA
was recently changed to try and tear down the local side of
the iscsi connection by trying to tear down bond and target
being offered. The whole attempt with this is to ensure that
no disk locks are in place which can prevent partition table
updates.
Since we added this logic, in some cases these commands can
fail and cause the deployment process to fail when it would
have otherwise succeeded. As such, suppress the errors.
Change-Id: I0e04936ad337b394dd68e9b0396a9f1203218f9f
With raid, we were able to observe a condition where
the file is still open for non-exlcusive access which
blocks the software raid from being shutdown... which
is realistically needed to force a rescan in that case.
Change-Id: I8dbfae091267f8af5340ff5ebeebcba375d05542
The _execute helper was catching OSError, except it
was expecting the same attributes as ProcessExecutionError,
which is incorrect.
Added a separate catch and unit test to ensure that we
at least properly catch and convert the error instead of
raising an error about an attribute that does not exist.
Change-Id: Id47715a5657478e4d9dd10ea7f360b1ededa27de
Closes-Bug: #1715466
The following files added utf-8 encoding but never used. So we can
removes them at all.
ironic_python_agent/extensions/image.py
ironic_python_agent/extensions/iscsi.py
ironic_python_agent/tests/unit/extensions/test_image.py
ironic_python_agent/tests/unit/extensions/test_iscsi.py
Change-Id: Ifc98faf025ee81f885ea58d9203037c6357ea7f2
In Python 2.6 it was required to use {0}, {1}...{n} when using the
string format function. In Python 2.7 and Python 3 it it not required.
Change {N} to {} in code.
This brings the code in style alignment with other projects like
ironic and ironic-lib.
Change-Id: I81c4bb67b0974f73905f14b589b3dd0a7131650d
Depends-On: I8f0e5405f3e2d6e35418c73f610ac6b779dd75e5
Per Doug's email[0], 'warnerrors' in setup.cfg hasn't actually been
working for some time now, and we've piled up a few warnings. Fix these
before a pbr release to unbreak it gets pushed out and breaks our doc
builds.
[0] http://lists.openstack.org/pipermail/openstack-dev/2016-June/097849.html
Change-Id: I6576a56234918febb21e7e4860544eb952123c09
Currently we hardcode the iSCSI port to its default. With this
patch, we added new portal_port argument into iscsi.start_iscsi_target
api, cover both lio and tgt two iscsi target operations.
And for IPA client and driver code change, will commit more patch to
cover.
Change-Id: I6da20487ccba6cbac04d36b8643afdd1e3920b12
Partial-Bug: #1523829
If the local disk has already a partition table, it must be clean up
before the disk is exposed through iscsi. Otherwise this disk partition
can create a conflict during the grub installation.
How reproducible:
1. Inject an image on the root disk, like for example ipxe.usb or ipxe.iso
2. Try to deploy a system on the node using Ironic
3. The node is properly deployed but the grub installation has failed
with the following error:
attempting to install grub to a disk with multiple partition labels
A simple sgdisk -Z /dev/vdX is not enough because grub-install will
inspect the disk and will still detect a remaining partition.
This commit makes use of the ironic-lib to do the clean up of the disk.
The additional review Id59fa5a06b9115c0f9afc09aae95daaac97e2fac increase
the amount of data to wipe.
References:
https://bugzilla.redhat.com/show_bug.cgi?id=1310883
Partial-Bug: 1550604
Change-Id: Ie68cb6296c782e904d40f6e9de0faa52ab2af2bf
When neither tgt nor linux-io are available, we only get error
message like 'No such file or directory', this situation should
be detected and return a better error instead.
Change-Id: I334717a1a8a728aa6da6024ff9fc6d817399a41f
Closes-Bug: #1540958
The iSCSI extension now tries to use Linux-IO first (via rtslib)
and falls back to tgtd if Linux-IO can't be used (e.g. in the CoreOS-based
image which uses containers).
Change-Id: I9cc7a30d9c93c445a66d183146e9260c2b096d33
Closes-Bug: #1504562
The intention of the iscsi extension _wait_for_iscsi_daemon function
is to wait till the tgtd process boots completely before running any
iscsi commands through the tgtadm command line utility. The tgtd
process utilises a unix socket for communication with the user and the
_wait_for_iscsi_daemon function asserts the tgtd process status based
on the socket presence. The socket name/path to use is not specified
by iscsi extension configuration but rather falls-back to a
(system-wide) default value[1]. Since tgtd version 1.0.60, this path
changed from /var/run/tgtd.ipc_abstract_namespace to
/var/run/tgtd/socket[2] and now causes a false-negative while waiting
for the tgtd process to boot[3].
This patch follows implementation suggestion from the bug report[3] to
avoid relying on the socket presence but rather to check the tgtd
status by trying to communicate through the tgtadm tool.
[1] https://github.com/openstack/ironic-python-agent/blob/
5bbb9ded082f2cfde5e8877e9f33294eb93a5fb7/
ironic_python_agent/extensions/iscsi.py#L47 [2]
https://github.com/fujita/tgt/commit/
d1aa4dcfd691c9409dbad5db49ce6754ce9c1b5a
[3] https://bugs.launchpad.net/ironic-python-agent/+bug/1505923
Closes-Bug: #1505923
Change-Id: If3284e0b441fe6c2da507640c08a4bbefd9dad2b
This fixes a ValueError exception that would occur if
log debug was enabled in IPA.
Change-Id: Id95f291dd77d69e7d4dd4f945c6c151db7a0646b
Closes-bug: #1503354