Do not allow resize to zero disk flavor

For some reason nova allows creating a flavor with a disk_size of 0,
when an instance is booted using such flavor its disk will use the
native base image size as the size of the ephemeral root volume (from
the ops docs:
http://docs.openstack.org/openstack-ops/content/flavors.html).

Even though having the disk_size=0 means that the instance's disk can
have any imaginable size, nova will still allow to resize that instance
to any flavor defining disk_size >= 0 but it won't shrink the disk if it
is bigger than the new disk_size.

This patch add check to prevent resize to zero disk flavor except
when both current and new disk are 0.

DocImpact

Change-Id: Iffc2f821cc51ccf555ea1e3d7589147375aeb56a
Closes-bug: 1305860
Replace nova.utils.cpu_count() with processutils.get_worker_count()

cpu_count() was moved from nova to oslo-incubator via commit
85f178489a128a04a7ee3ed44018403caa109ef0 so it can be used in other
projects.

This change removes the duplicate code from nova and uses the renamed
method from oslo.

Change-Id: I03da77adf64e0495880343b7086f5907a2c5f75d
Add assert_called check for "brclt addif" test

I92ee96e3aa34f7cd154a8ce4b33852b96cabe8c9 adds a negative test for
"brclt addif" but some mock arguments are not used/checked.
This patch adds assert_called_once_with check.

Change-Id: I8f3a0e4957343c8d6c903e1b893c58fda4916d91
libvirt: remove volume_driver_method API

Replace the 'volume_driver_method' API with _connect_volume
and _disconnect_volume methods to remove the pointless
introspection based calling technique. This adds a '_' to
the names to show that they are internal methods only.

Related-bug: #1333219
Change-Id: Ife3fb60dd8aef8adf6bbdd2465971e156430fa0d
libvirt: remove hack from ensure_filtering_rules_for_instance

The ensure_filtering_rules_for_instance method had a hack
where the test suite caller could pass in a module to
replace the greenthread.sleep call. This is utterly crazy
when mock can trivially replace the greenthread.sleep call
directly.

Partial-bug: #1333219
Change-Id: I449290aa366f5c85cc63a15d0b1704339be4d73a
Neutronv2 api does not support neutron without port quota

If quota on ports are disabled in neutron (see below), neutronv2 api
set port quota to None and quota check raises a TypeError.

  # neutron server /etc/neutron/neutron.conf
  [quotas]
  quota_items=network,subnet,router,floatingip

This change set port quota to -1 (unlimited) if quota on ports are
disabled.

Change-Id: I89c530dd57a7beb35695be124ca8511148378458
Closes-Bug: #1333315
VM diagnostics: introduce Diagnostics model object

There is no formal definition for the VM diagnostics. This patch
introduces a model object that will be used by the virt drivers
to return instance diagnostics.

The model will have a version. Each update to the model will require
a version change.

Part of the blueprint v3-diagnostics

Change-Id: I5527bc9904417489ec9bde844c9ff24cb02233fd
Pass instance to _error_out_instance_on_exception

This is part of a series of patches to eventually get instance objects
passed to _instance_update so that we don't have to make a separate call
to update the instance via conductor when using an object already.  We
start with _error_out_instance_on_exception, then need to handle
_set_instance_error_state and then will change _instance_update.

Adds unit tests for the three different exception blocks handled
in the context.

Part of blueprint compute-manager-objects-juno

Change-Id: Ib3e64089a45cfab37e9c3570b94fed59b0d8f22c
Merge "Neutronv2 api does not support neutron without port quota"
Merge "Do not allow resize to zero disk flavor"
Merge "libvirt: remove volume_driver_method API"
Merge "Replace nova.utils.cpu_count() with processutils.get_worker_count()"
Merge "Add assert_called check for "brclt addif" test"
Merge "Pass instance to _error_out_instance_on_exception"
Merge "VM diagnostics: introduce Diagnostics model object"
Merge "libvirt: remove hack from ensure_filtering_rules_for_instance"