ironic-python-agent/ironic_python_agent/tests/unit
Will Szumski aaf76e2cfb rework ATA secure erase
hdparm versions prior to 9.51 interpret the value, NULL, as a
password with string value: "NULL".

Example output of hdparm with NULL password:

    [root@localhost ~]# hdparm --user-master u --security-unlock NULL /dev/sda
    security_password="NULL"

    /dev/sda:
    Issuing SECURITY_UNLOCK command, password="NULL", user=user
    SECURITY_UNLOCK: Input/output error

Example output of hdparm with "" as password:

    [root@localhost ~]# hdparm --user-master u --security-unlock "" /dev/sda
    security_password=""

    /dev/sda:
     Issuing SECURITY_UNLOCK command, password="", user=user

Note the values of security_password in the output above. The output
was observed on a CentOS 7 system, which ships hdparm 9.43 in the
offical repositories.

This change attempts to unlock the drive with the empty string if an
unlock with NULL was unsucessful.

Issuing a security-unlock will cause a state transition from SEC4
(security enabled, locked, not frozen) to SEC5 (security enabled,
unlocked, not frozen). In order to check that a password unlock attempt
was successful it makes sense to check that the drive is in the unlocked
state (a necessary condition for SEC5). Only after all unlock attempts
fail, do we consider the drive out of our control.

The conditions to check the drive is in the right state have been
adjusted to ensure that the drive is in the SEC5 state prior to issuing
a secure erase. Previously, on the "recovery from previous fail" path,
the security state was asserted to be "not enabled" after an unlock -
this could never have been the case.

A good overview of the ATA security states can be found here:

  http://www.admin-magazine.com/Archive/2014/19/Using-the-ATA-security-features-of-modern-hard-disks-and-SSDs

Change-Id: Ic24b706a04ff6c08d750b9e3d79eb79eab2952ad
Story: 2001762
Task: 12161
Story: 2001763
Task: 12162
2018-05-16 13:18:15 +00:00
..
extensions Merge "Do not try unmounting the EFI partition if it was not mounted" 2017-12-15 08:40:16 +00:00
hardware_managers mlnx hardware_manager: get mac address using netifaces 2018-03-11 12:50:08 +02:00
__init__.py Add base for IPA functional tests 2015-08-18 16:19:47 +00:00
base.py Fix issue with double mocking of utils.execute functions 2017-12-01 07:42:02 -08:00
test_agent.py Follow-up patch for rescue extension for CoreOS 2018-01-30 19:00:13 +00:00
test_api.py Prevent tests' unmocked access to utils.execute() 2017-05-15 10:48:43 +10:00
test_base.py Fix issue with double mocking of utils.execute functions 2017-12-01 07:42:02 -08:00
test_dmi_inspector.py Collect processor, memory and BIOS output of dmidecode - follow-up 2017-07-27 07:30:54 -07:00
test_encoding.py Prevent tests' unmocked access to utils.execute() 2017-05-15 10:48:43 +10:00
test_errors.py Prevent tests' unmocked access to utils.execute() 2017-05-15 10:48:43 +10:00
test_hardware.py rework ATA secure erase 2018-05-16 13:18:15 +00:00
test_inspector.py Clean up deprecated items in the inspection code 2017-09-19 14:05:13 +02:00
test_ironic_api_client.py Include IPA Version during heartbeat 2017-12-07 12:16:06 +00:00
test_multi_hardware.py Prevent tests' unmocked access to utils.execute() 2017-05-15 10:48:43 +10:00
test_multi_hardware_clean_steps.py Fix waiting for target disk to appear 2017-10-16 15:39:25 +02:00
test_netutils.py [LLDP] Skip NICs that say they are ready but are unreadable. 2017-11-28 17:25:43 +00:00
test_numa_inspector.py Have unit tests all derive from our base unit test class 2017-10-18 11:06:30 -07:00
test_utils.py Improve the catching of calls to 'execute' related functions 2017-10-23 08:44:23 -07:00