Use six.moves.urllib.parse instead of urlparse

To keep Python 3.x compatibility, use six.moves.urllib.parse to
replace urlparse.

Partial-Bug: #1279611
Change-Id: I271d492a501a2d2fce2980e11ce6f03b7b9f878a
Do not allow POST node's internal attributes

Some attributes of node should only be exposed to user without
possibility of set/modify. This patch uses 'readonly' parameter
of WSME 0.6 for prohibit these attributes in POST.

Change-Id: Id5bc189166b1d47f84b171d4c57ac40c3a5a431e
Do not allow POST ports and chassis internal attributes

Some attributes of this resources should only be exposed to user without
possibility of set/modify. This patch uses 'readonly' parameter of
WSME 0.6 for prohibit these attributes in POST.

Change-Id: Idb4f39af04dfba58f90283db5b029deab14735cb
Remove extraneous vim configuration comments for ironic

Remove vim setting:

comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4

at the top of source code files, except for files in
openstack/common.

Change-Id: Ie80f76f08e27b7f5f747227c4cca8d79ad98bec6
Partial-Bug: #1229324
Fix race condition when deleting a node

In the db api, between checking whether the node is not reserved and
deleting it from the db there was no lock, another request could acquire
that node and start an operation on it. This patch fixes it by locking
the node before it's deleted from the db.

This patch is also a plumbing because we might want to do operations
like changing the node's power state and stopping the console before
deleting a node.

Co-authored-by: Devananda van der Veen <devananda.vdv@gmail.com>

Change-Id: I5fd90f8321812f7636477c03a83038ad42d47817
Python 3: replace "im_self" by "__self__"

The Python 3 removed the "im_self" attribute. This patch
replaces "im_self" by "__self__" attribute.

Partial-Bug: #1282514

Change-Id: Icd255eec61f225e2dc66a7efd51551f4b78ac258
Add support for custom libvirt uri

SSH driver executes "virsh list --all" without setting the default
libvirt uri. It can cause issues eg. on Fedora where the default uri is
"qemu:///session" instead of "qemu:///system" and as a result it doesn't
find any domain. This patch adds support for setting libvirt uri.

Change-Id: If714913c8b41097f25026afabbb88aa90c496d81
Closes-bug: #1281025
PXE clean_up() to remove the pxe_deploy_key parameter

The pxe_deploy_key is an internal attribute used by the PXE driver to
build the pxe configuration files, it's added to the node's driver_info
in the moment that the configuration files are being generated but it's
not being removed after the node's unprovisioned. So this patch is making
sure that the pxe_deploy_key is removed from the driver's parameters at
the clean_up() method of the pxe driver.

Change-Id: Ic5f13f247d835707ab16b2cc6579c00504744fa8
Sync common db code from Oslo

This sync contains commit - ce69e7f Don't store engine instances in oslo.db -
which removed global engine from oslo.db code. So, added code
for work with sqla engines and sessions to Ironic - get_engine()
and get_session() functions in ironic.db.sqlalchemy.api module.

Also this remove database slave connection and tpool features, because
they was removed from oslo code.

Latest oslo.db commit - 7959826af1f36a4bbc4c466d0d1e0b9efd468649

Change-Id: I14c3b823a8b975d5cd097778f3514cfb1abe2e10
Move ipminative _set_boot_device to VendorPassthru

_set_boot_device must be exposed via vendor_passthru, allowing
operators to manually change it, and force to boot from net when
performing a pxe deploy.
Until now, it was just a private method of the power driver.

Change-Id: Iac3a7183db4c3486bd6a2aa1ba36bf33e11722a9
Partial-Bug: #1264596
Suggested improvements to _set_boot_device

Change Iac3a7183db4c3486bd6a2aa1ba36bf33e11722a9 had a number
of non-essential fixups suggested, these have been added in
this dependent patch.

Change-Id: I88c5e46d65f1768765e68d0e87f06172f8e3ebd9
Prevent GET /v1/nodes returning maintenance field

GET /v1/nodes shouldn't return internal fields such as
'maintenance'.  Remove this field from the dictionary
returned, and test to make sure it doesn't come back.

Change-Id: I62b2be62ca2ca30c3fd63a1d9fe643b01fc4f171
Closes-Bug: #1282517
Add timeout for waiting callback from deploy ramdisk

'callback_timeout' options added to conductor, if timeout reached
node switched to error state. New periodical task created for timeouts
check.

Related-Bug: #1270986
Change-Id: I3084d529baa13d4f848a7d050b8299582a28d7e9
Removing get_node_power_state, bumping RPC version

There is a periodic task that is used to check the power state and save it to
the DB. Users can query the DB instead of checking the machine. Also removing
the RPC call and bumping RPC_API_VERSION to 1.10.

Closes-Bug: #1277062
Change-Id: I87923eee8f88e85e621fd0bf839d99250788561f
Merge "Do not allow POST node's internal attributes"
Merge "Do not allow POST ports and chassis internal attributes"
Merge "Move ipminative _set_boot_device to VendorPassthru"
Merge "Prevent GET /v1/nodes returning maintenance field"
Log deploy_utils.deploy() erros in the PXE driver

When the PXE driver invoke deploy_utils.deploy() it wasn't logging the
exceptions raised by this call. There was a comment saying that it was
being logged within the deploy() method itself, but it wasn't true for
all the exceptions it could raise, also, some of errors e.g TypeError
where not all parameters are being passed to the deploy() function can't
be logging by the function called itself and would fail silently. So
this patch is adding a log in the PXE module to fix this problem.

Change-Id: Ifbbc0f3cbd5c280d04249cee811d1dc478548975
Closes-Bug: #1286053
Make the PXE driver understand ephemeral disks

Allows the PXE driver to create an ephemeral partition. This is the first
step in being able to redeploy a baremetal machine with a new image but
preserve the data on the ephemeral disk.

Based on Nova's patch: https://review.openstack.org/51735

blueprint: preserve-ephemeral
Closes-Bug: #1238311
Change-Id: I2826f1f8b60316ea180284cffc495a7556e31784