Improving unit tests for _do_sync_power_state

Improve the unit tets coverage, and tightening up existing
tests surrounding the _do_sync_power_state method.

Change-Id: I9fd4c4c42936fcf8fc4f36bf35b6e691c495b8b0
Closes-bug: #1297404
Update IronicHostManager tests to better match how code works

This is the first in a series of patches to prepare Ironic for the
removal of capabilities in Nova HostManager.

IronicHostManager used to rely on capabilities info to decide which
host state class to use, VM or baremetal. This has been broken since
host capabilities reporting were removed in Nova, resulting in Nova
HostState class always being used.

IronicBareMetal tests make use of an internal Nova HostManager variable
in a way that hides the fact that IronicNodeState class is no longer
used. This patch rewrites tests to better reflect how Ironic/Nova code
now works and prepares for further changes that needs to land in Ironic
before Nova HostManager capabilities can be removed.

Change-Id: I795eaed58f6587585d89366d8f1e521588866a58
Partial-Bug: #1260265
Add missing stats to IronicNodeState

This is the second in a series of patches to prepare Ironic for the
removal of capabilities in Nova HostManager.

IronicHostManager used to rely on capabilities info to decide which
host state class to use, VM or baremetal. This has been broken since
host capabilities reporting were removed in Nova, resulting in Nova
HostState class always being used.

Before IronicNodeState class can be used again, it must be updated to
store host stats as this is needed by ComputeCapabilitiesFilter to
correctly filter hosts or this filter will return no hosts.

Change-Id: I1661107883722bf14a488842373fd3027dc7a62c
Partial-Bug: #1260265
Fix host manager node detection logic

This is the last in a series of patches to prepare Ironic for the
removal of capabilities in Nova HostManager.

IronicHostManager used to rely on capabilities info to decide which
host state class to use, VM or baremetal. This has been broken since
host capabilities reporting were removed in Nova, resulting in Nova
HostState class always being used.

This patch fixes the detection logic in IronicHostManager to correctly
choose IronicHostState class for use with baremetal nodes. Tests are
added to verify that the correct class is used for both vm and
baremetal nodes.

In reality, the new detection logic will not start to deliver the
correct HostState class until the Nova HostManager change has landed.

Change-Id: Ifa47d721835cfea87e9d0bce87c7853dd6724b98
Closes-Bug: #1260265
Fix utils.execute() for consistency with Oslo code

Oslo processutils.execute() can use non-string command line
arguments, they convert to strings internally.
This patch fix utils.execute(), non-string arguments can be
used as in Oslo execute without error.

Change-Id: I4f640582375b244e23a6641c3b94157c49c8ee3b
Use .png instead of .gif images

This replaces the two image files used in the Admin Guide, "Introduction
to Ironic" page. The images were in .gif and are being replaced with
their .png counterparts, because .png is a better format.

Change-Id: Iec831d37f58f4e159b0cfc197bac5dad433d32cf
Replace mknod() with chmod()

Using mknod() can be troublesome on Macs since the underlying system
call requires super-user privileges. Since its main use here
is to set the mode of the file (the subsequent call to open() is
enough to create it), we remove it and replace it with the less
troublesome chmod().

Partial-Bug: #1329077

Change-Id: I30c767792f44d27c6c0179474112015c5ab9bac3
Enforce a minimum time between all IPMI commands

This patch enforces the min_command_interval option, which was added in
the previous patch, to ensure that any given BMC is never "poked" more
frequently than this interval, regardless of the calling method.

Closes-Bug: #1320513

Change-Id: Id3849aadf3908133a92157b3e96dd752610533e9
Virt driver logging improvements

Right now, there's no clue in nova logs whether or not we're still
polling nodes in ironic for state changes when provisioning or
unprovisioning. Let's add some log messages for this.

Also, make get_available_resources() log the number of nodes along with
the node uuids.

Change-Id: Ic83f4389ba1ca576deb87f46cde84ce414c5baeb
Test fake console driver

This patch adds a test case to test the FakeConsole in the fake
driver.

Change-Id: If12fad2a928683626fc66adc5e870f5c30357702
Merge "Use .png instead of .gif images"
Merge "Enforce a minimum time between all IPMI commands"
Merge "Replace mknod() with chmod()"
Cleanup virt driver tests and verify final spawn

This removes redundant mocking of the IronicClientWrapper._get_client() method
and instead relies on a local fake client wrapper. This allows us to verify
loopingcall usage in the final stage of instance spawn.

This also moves some client-specific tests out of the driver tests and into
the client wrapper tests where they belong.

Change-Id: I79b05773ff302057af6694bac4951470f8eb7c1a
Merge "Improving unit tests for _do_sync_power_state"
Merge "Update IronicHostManager tests to better match how code works"
Merge "Add missing stats to IronicNodeState"
Merge "Fix host manager node detection logic"
Add 'context' parameter to get_console_output()

The get_console_output() that is called from 'nova'
have two parameters 'context' and 'instance'.

Change-Id: I56c8a01ad00f62e6be5fa525c8971c5e29fc5098
Closes-Bug: #1310132
Merge "Cleanup virt driver tests and verify final spawn"