VMware: spawn refactor - DatastorePath class

Part of spawn refactor work to consolidate a lot of the datastore path
manipulation code. The DatastorePath class is a simpler version of a
class of the same name in earlier versions of
https://review.openstack.org/#/c/87002, and is intentionally limited in
the ways that DatastorePath objects can be constructed. No attempts are
made to ensure that the datastore, directories and files referenced in
these objects are valid on the remote system.

partial blueprint vmware-spawn-refactor

Change-Id: Id65d0308d32835048229e7a3d98b84af2b13583c
VMware: remove dsutil.split_datastore_path

The functionality of split_datatore_path has been subsumed by
the DatastorePath utility class, so remove it and convert
all callers to use the latter.

Change-Id: I07a2cfe15fccaca4aee25bc43157e6c604b91831
VMware: spawn refactor - Datastore class

Introduces the start of a simple Datastore class to encapsulate relevant
data of a datastore.

partial blueprint vmware-spawn-refactor

Change-Id: Ic0ee6cdd47e7cbd66cf456776c61d0b85fb51a0a
Fix BaremetalHostManager node detection logic

This is the second patch to prepare baremetal for the removal of
capabilities in Nova HostManager.

BaremetalHostManager 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 BaremetalHostManager to
correctly choose BaremetalHostState 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 that follows
has landed.

Change-Id: I0c2e6d985fb29f35b823cdf9a83fead2fa45082a
Partial-Bug: #1260265
Remove traces of now unused host capabilities from scheduler

This is take two of this patch. This time after preparing Baremetal
and Ironic code to work with the HostManager changes introduced in
this patch.

Host capabilities updates are no longer used by the scheduler. All host
state is instead fetched from the DB. Some left over fields are still
kept by the host manager but contain no data. This change remove the
last traces of host capabilities from the scheduler.

Baremetal/Ironic host managers 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. This change
works in tandem with prior updates to Baremetal/Ironic node detection
logic to fix this problem.

Important: This must not be approved until the Ironic patch in
https://review.openstack.org/97447 has first landed!

Change-Id: Id5f88c0aa1df9152ddb62904b0544801a8bcfd2a
Closes-Bug: #1260265
libvirt: remove unused 'get_disks' method

The 'get_disks' method was a virt driver public API used by
the old compute monitor class. This class was deleted in

  commit 07646e85841a4f7c81e80254ac63715bece2aadd
  Author: Brian Waldon <brian.waldon@rackspace.com>
  Date:   Tue Aug 2 10:09:58 2011 -0400

      removing compute monitor

Leaving no in-tree user of the 'get_disks' method. This
method is not declared in the ComputeDriver base class
nor implemented by any virt driver besides libvirt, so
can be safely deleted.

Partial-bug: #1333219
Change-Id: I4d3f53499d088a82e471ab68feef1ae50d3f8bdc
libvirt: add '_' prefix to all get_guest_*_config methods

The get_guest_*_config methods are all internal helpers so should
have a '_' prefix to indicate they are not part of public virt
driver API.

Related-bug: #1333219
Change-Id: I76108c4992144cc7c3273bfd753aa76f7a821a56
Add API schema for v2.1/v3 flavor_manage API

By defining the API schema, it is possible to separate the validation
code from the API method. The API method can be more simple.
In addition, a response of API validation error can be consistent for
the whole Nova API.

Partially implements blueprint v3-api-schema

Change-Id: I92de34f6b9801b7ff9e4a9cc77baf2bf2bb36f6f
Use _set_instance_obj_error_state in compute manager set_admin_password

The set_admin_password operation is not a lifecycle operation like
building or deleting an instance, or resize for that matter, so replace
usage of _set_instance_error_state which does a host stats update with
_set_instance_obj_error_state which just sets the instance state to
error and handles any InstanceNotFound exception (in case we still want
to be a little paranoid).

Part of blueprint compute-manager-objects-juno

Change-Id: Ie1d1075095ed5d318d0d7a638526bc5cd40d4583
Move the error check for "brctl addif"

The git commit 873aad92944f8840e772d65eda4b3320d65a9ce7[1] has moved
"brctl addif" command, but the commit did not move its error check.

Now the error check sees the result of "ip addr show dev <interface>
scope global" command wrongly, and the command outputs "Dump was
interrupted and may be inconsistent" sometimes because of a kernel change.
As the result, gate failures happen sometimes.

This patch moves the error check to right place.

[1]: https://github.com/openstack/nova/commit/873aad92944f8840e772d65eda4b3320d

Change-Id: I92ee96e3aa34f7cd154a8ce4b33852b96cabe8c9
Closes-Bug: #1334142
Merge "Add API schema for v2.1/v3 flavor_manage API"
Merge "Move the error check for "brctl addif""
Merge "libvirt: remove unused 'get_disks' method"
Merge "libvirt: add '_' prefix to all get_guest_*_config methods"
Merge "Fix BaremetalHostManager node detection logic"
Merge "Remove traces of now unused host capabilities from scheduler"
Use ebtables to isolate dhcp traffic

Iptables doesn't properly block the broadcast traffic crossing
the bridge, so use ebtables instead. Removes test which is no
longer valid since we are not using iptables anymore.

Change-Id: I43e5f1fe9512dd3ec9595c7203bc46837cef3cad
Closes-Bug: #1318104
Merge "Use _set_instance_obj_error_state in compute manager set_admin_password"
Merge "Use ebtables to isolate dhcp traffic"
Merge "VMware: spawn refactor - DatastorePath class"