351 Commits

Author SHA1 Message Date
Mathieu Mitchell
1c9ecbd8cb Allow shred zeroize option to be configured
Introduce a new parameter in driver_internal_info called
agent_erase_devices_zeroize to control the behavior of shred. This
parameter controls the --zero argument used when invoking shred.
Configuring this to false disabled the last pass of zeroes, leaving the
device with random data.

Change-Id: I7053034f5b5bc6737b535ee601e6fb71284d4a83
Partial-bug: #1568811
Depends-On: Ia7ea8d909df9ae86a6dbd68ba94746b171535eb8
2016-04-18 16:59:32 -04:00
Jenkins
cb604fbe7e Merge "Create helper function: create_hdparm_info()" 2016-04-12 15:47:11 +00:00
Jenkins
a630a921d3 Merge "Provide fallback from ATA erase to shredding" 2016-04-08 22:21:40 +00:00
John L. Villalovos
17b5e2e0e0 Create helper function: create_hdparm_info()
Create a helper function: create_hdparm_info() and use it in the unit
tests.

Also fix mispelling of 'indicative'

Change-Id: Ifa15fde72bc0ca6d925408c1dcafce85c192abb7
2016-04-08 14:23:27 -07:00
Julia Kreger
ed74a062c1 Provide fallback from ATA erase to shredding
Presently should the ATA erasure operation fails, IPA halts the
cleaning process and the node goes to CLEANFAIL state as a result.

This failure could be the result of a previous cleaning failure
that left drive security enabled, for which code has been added
in an attempt to address this case by attempting to unlock the
the drive.

In the event that an operator wishes to automatically fallback to
disk scrubbing operations, the capability has been added through
a driver_internal_info field "agent_continue_if_ata_erase_failed"
that can be set to True, however defaults to False keeping the
same behavior that IPA presently exhibits in the event of ATA
erase operations failing.

Partial-Bug: #1536695
Change-Id: I88edd9477f4f05aa55b2fe8efa4bbff1c5573bb1
2016-04-08 15:55:06 -04:00
Jenkins
2d8e139f03 Merge "Set modification time in tarfile of ramdisk logs" 2016-04-08 12:41:28 +00:00
Jenkins
6d8eaac8e3 Merge "Improve __str__ method of BaseCommandResult" 2016-04-07 22:42:36 +00:00
Jenkins
d783a01308 Merge "Wait for the interfaces to get IP addresses before inspection" 2016-04-06 17:29:36 +00:00
Dmitry Tantsur
3deb25a3ce Wait for the interfaces to get IP addresses before inspection
In the DIB build the DHCP code (provided by the dhcp-all-interfaces element)
races with the service starting IPA. It does not matter for deployment itself,
as we're waiting for the route to the Ironic API to appear. However, for
inspection it may result in reporting back all NIC's without IP addresses.
Inspection fails in this case.

This change makes inspection wait for *all* NIC's to get their IP addresses up
to a small timeout. The timeout is 60 seconds by default and can be changed
via the new ipa-inspection-dhcp-wait-timeout kernel option (0 to not wait).

After the wait inspection proceedes in any case, so the worst downside
is making inspection 60 seconds longer.

To avoid waiting for NIC's that are not even connected, this change extends the
NetworkInterface class with 'has_carrier' field.

Closes-Bug: #1564954
Change-Id: I5bf14de4c1c622f4bf6e3eadbe20c44759da5d66
2016-04-05 20:03:33 +02:00
Miles Gould
3f715a20fd Set modification time in tarfile of ramdisk logs
If we do not set this explicitly, tar will warn "journal: implausibly
old time stamp" when the user tries to untar the log files.

Change-Id: I4a5a1ffd4eeca9697cdcf16e02d3ff3c22d7132c
2016-04-04 17:29:16 +01:00
Jenkins
1121887d19 Merge "Fix incorrect formatting in the iSCSI extension" 2016-04-01 17:44:24 +00:00
Clif Houck
3cf5369cb6 Add docstrings to all functions in Agent standby extension
Change-Id: Ic8101a6b29dee4b79c2d7f3dc064e4c98a9a0741
Partial-Bug: 1367915
2016-03-31 11:44:50 -05:00
Dmitry Tantsur
e9dbf4acf2 Fix incorrect formatting in the iSCSI extension
Change-Id: I141c205dec838c64126106186a1352d032d8d987
2016-03-31 14:11:08 +02:00
Jay Faulkner
b176f29b3d Improve __str__ method of BaseCommandResult
Fixes nits raised in review for Change ID
I3ca0382f05e88700c56d3c7f4b4ecf7b8fc3bc0c

Remove useless id field, fix capitalization and grammar.

Change-Id: I7976993d1ac9354e035a5e7dba6ef8cc392537e3
2016-03-30 23:38:50 +00:00
Jenkins
698211b771 Merge "Add __str__ method to BaseCommandResult" 2016-03-30 18:46:15 +00:00
Julian Sy
d1060c0469 Add __str__ method to BaseCommandResult
Method was added so that logging could be more understandable

Change-Id: I3ca0382f05e88700c56d3c7f4b4ecf7b8fc3bc0c
Closes-Bug: #1506409
2016-03-29 16:54:48 +00:00
Haomeng, Wang
c83a968997 add new portal_port argument into iscsi.start_iscsi_target api
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
2016-03-24 13:32:42 +00:00
Jenkins
858c643777 Merge "Add disk_label support for partition images" 2016-03-23 10:53:35 +00:00
Jenkins
16265a6c8b Merge "iscsi: wipe part table before starting the target" 2016-03-22 19:21:06 +00:00
Gonéri Le Bouder
0b1f01db94 iscsi: wipe part table before starting the target
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
2016-03-22 13:28:21 -04:00
Nisha Agarwal
4ec49be8e2 Add disk_label support for partition images
This commit adds the disk_label support for partition
images. It also fixes the node_uuid info passed to the
ironic_lib.

Partial-Bug: 1560560
Change-Id: I8b8ef20787468c1b8dc6fbc0b8905abd285325e1
2016-03-22 16:59:38 +00:00
Jenkins
32d9ff9518 Merge "Fixes the agent message for uefi netboot for partition image" 2016-03-21 22:47:24 +00:00
Jenkins
c5531af3b3 Merge "Bind to interface routable to the ironic host, not a random one" 2016-03-21 19:17:48 +00:00
Jenkins
6b8ef9a854 Merge "Replace SYSRQ commands" 2016-03-21 18:51:50 +00:00
Nisha Agarwal
936b2e4c4a Fixes the agent message for uefi netboot for partition image
The agent returns "efi_system_partition_uuid=None" in the
status message for uefi netboot for partition images.
This commit fixes to remove this unwanted message
from the status message as efi partition is created only
for localboot.

Closes-bug: 1526289

Change-Id: I6376406cdde29493619f50b0a6cd8b6ce3784d6e
2016-03-21 18:11:32 +00:00
Jenkins
c3e9aca2c0 Merge " make enforce_type=True in CONF.set_override" 2016-03-21 17:25:46 +00:00
Dmitry Tantsur
6829d34c15 Bind to interface routable to the ironic host, not a random one
Binding to the first interface that has an IP address is error-prone: there is
no guarantee that ironic can reach us via this inteface. It is much safer to
detect the interface facing ironic and bind to it.

Unused LookupAgentInterfaceError exception is deleted.

The TinyIPA build also requires iptables dependency at build time to insert the
required kernel modules.

Closes-Bug: #1558956
Change-Id: I9586805e6c7f52a50834bc03efeb72d1faa6cb65
2016-03-21 14:21:12 +00:00
Lucas Alvares Gomes
cbd90c1c14 Replace SYSRQ commands
This patch is modifying the shutdown.sh script to not use SYSRQ when
performing power actions. SYSRQ has a similar effect to a hardware reset
button/power switch, which can be problematic after copying an image to
the disk (data loss) therefore, this patch is changing the script to use
soft power action via the poweroff and reboot commands.

SYSRQ was required before because the ironic-python-agent service was
running inside a docker container, but since we've moved it to run into
a chroot (when built with coreos) or on the ramdisk's OS (when built
with DIB) the SYSRQ actions are not needed anymore.

In many parts of Ironic we were considering the standby.{power_off,
reboot} methods of IPA to be soft actions, which they are not at
present. This patch is also fixing that assumption.

Change-Id: Ibe3a3f61a4a0e98b2c2501ad95154839933b4d7a
Closes-Bug: #1557450
2016-03-21 12:57:50 +00:00
Jenkins
4f1caf11e9 Merge "Add sync() command to the standby module" 2016-03-21 09:51:44 +00:00
Lucas Alvares Gomes
4b802c47b5 Add sync() command to the standby module
This patch is adding a new command called sync to the standby module of
IPA. The new command runs synchronously and it's responsible for
flushing file system buffers to the disks.

The initial intention for this command is to use it as part of the fix
for the bug #1512492 where some hardware/firmwares do have problems to
come back online after a soft ACPI power off, therefore we need to call
sync() to make sure all file system buffers have been synced and then
issue a hard power off (e.g via the BMC).

Partial-Bug: #1512492
Change-Id: I5cd1d1b821426e995dc584452494b93ab23917e0
2016-03-18 15:20:48 +00:00
Jenkins
2a778f39e6 Merge "Add support for partition images in agent driver." 2016-03-18 15:04:05 +00:00
Faizan Barmawer
944595a69d Add support for partition images in agent driver.
It also adds the ironic-lib in the requirements
list of the IPA package.

Partial-bug: 1526289
Depends-On: I22bc29a39bf5c35f3eecb6d4e51cebd6aee0ce19
Change-Id: I37908470484744bb720f741d378106d1cb1227a3
2016-03-18 08:21:01 +00:00
Jenkins
dcd1c8f19b Merge "Document hardware inventory sent to lookup and inspection" 2016-03-15 17:04:25 +00:00
Jenkins
c9f7c951dc Merge "Stop trying to log stdout when fetching logs during inspection" 2016-03-15 17:01:44 +00:00
Jenkins
21afeb4017 Merge "Fixes programmatic error in _install_grub()" 2016-03-12 01:13:22 +00:00
Nisha Agarwal
bb605784dd Fixes programmatic error in _install_grub()
The patch defines the variables before they are used in the
code.

Closes-bug: 1555547
Change-Id: I27c5e926cf4001211c4edd794a09b26559c63f71
2016-03-11 21:09:37 +00:00
Lucas Alvares Gomes
f09dce79af Fix programmatic error in heartbeat()
This patch is fixing a programmatic error in the heartbeat() method of
the APIClient() class. When 409 (Conflict) was returned from the the
Ironic API the code wasn't parsing the content of the response
correctly.

Change-Id: I01fbb8d866b2f94fe128d0bc40b69d05b5add1a3
Closes-Bug: #1556199
2016-03-11 16:58:28 +00:00
Dmitry Tantsur
58f86d0353 Stop trying to log stdout when fetching logs during inspection
Logging the whole journalctl output is not the best idea. Fortunately,
it does not work right now and fails with a traceback :)

This change adds a new log_stdout argument to utils.execute() and uses it in
the "logs" inspection collector.

Also do not log the logs while logging the collected data.

Change-Id: Ibc726ac2c4f5eb06c73ac4765bb400077b84a6cc
2016-03-08 16:31:18 +01:00
Zhenguo Niu
d25d94b316 Change to use WARNING level for heartbeat conflict errors
It's normal that ironic returns 409 Conflict from time to time, so
it's a bit confusing that we report this with Exception level and
traceback.

Change-Id: I1627c61facc3fadd0f5d9d324150e7d2833c7fbc
Closes-Bug: #1533113
2016-03-06 17:13:02 +08:00
Lucas Alvares Gomes
055998c812 Wait for udev to settle before listing the block devices
This patch is making the list_all_block_devices() method to wait for
udev to settle it's event queue prior to listing the devices.

Sometimes the ironic-python-agent service may start before all devices
were detected and end up erroring out because it couldn't find a
suitable disk for deployment.

Closes-Bug: #1551300
Change-Id: I1ae2062a711115a1ea14b79ae9ace7ddd2fff9d5
2016-03-02 10:54:51 +00:00
Jenkins
1971ad7023 Merge "Reduced restriction of parsing for dmidecode output" 2016-03-01 17:39:10 +00:00
Jenkins
2a71a94208 Merge "Replace all the 'self.log' calls with global LOG" 2016-02-29 16:05:09 +00:00
Dmitry Tantsur
1437e15a1b Allow enabling debug level via kernel cmdline
Adds a new kernel option "ipa-debug" which can be set to "1" or "true" to
enable debug logging.

Change-Id: Iafe9a9b8b718280920005726e0f7e69e3f0a320c
2016-02-26 12:34:20 +01:00
Zhenguo Niu
7fe40bb559 Replace all the 'self.log' calls with global LOG
Change-Id: Iae917e1139c8c95a1bad5466df8a607656b9de5c
2016-02-24 09:51:01 +08:00
twm2016
d66fa523bf Reduced restriction of parsing for dmidecode output
Changed implementation to strip tokens up until the first 'Size: '
string. This will allow for less parsing errors in the first
six lines of the following output:
"dmidecode --type 17 | grep Size" returns:
        Maximum Memory Module Size: 4096 MB
        Maximum Total Memory Size: 8192 MB
        Size: 2048 MB
        Size: 2048 MB

Added a condition in the exception handling to address the
issue of the bug on other outputs like:
        Installed Size: Not Installed
        Enabled Size: Not Installed
        Size: No Module Installed
        Size: 1024 MB

Common strings like "No Module Installed" and "Not Installed" are
normal. These two strings are hard coded in the before mentioned
comparison and when found are logged as warnings instead of errors.

Change-Id: If3475afcebfc7af7e9256b99924919557c4d909c
Closes-Bug: #1521202
2016-02-22 22:46:28 +00:00
Zhenguo Niu
c716293cbf Catch OSError as well to return a better error message
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
2016-02-22 15:10:57 +08:00
Dmitry Tantsur
c9674da220 Document hardware inventory sent to lookup and inspection
Also add a missing docstring to HardwareManager.list_hardware_info.

Change-Id: Iee3584320f0591398e7761513ff588efeb62886d
2016-02-18 13:32:43 +01:00
Jenkins
3bcda73ca0 Merge "Clear GPT and MBR data structures on disk before imaging" 2016-02-18 08:53:03 +00:00
Moshe Levi
52fc4f891f Update unit tests to use six.moves.builtins.open
Change-Id: I724a42d22d4c9011feb8aa09726e5186686f3729
2016-02-17 14:08:52 +02:00
Jenkins
6a1341d2c3 Merge "Replace backoff looping call with oslo_service provided version" 2016-02-16 20:38:37 +00:00