Add UNSHELVING and RESCUING into IoOPSFilter consideration state

IoOpsFilter will take instance in following state
task_states.RESIZE_MIGRATING, task_states.REBUILDING, task_states.RESIZE_PREP,
task_states.IMAGE_SNAPSHOT, task_states.IMAGE_BACKUP
into consideration ,if the instance on this host exceed the maximum
number of instance allowed to do I/O the scheduler will fail on the host

UNSHELVING and RESCUING are also I/O related so IoOps need to include them

Change-Id: I141470254c824e7e57e6734ae0e016c432b85c00
Closes-Bug: #1295558
Fix instance cross AZ check when attaching volumes

For CONF.cinder_cross_az_attach=False, we currently only check the desired AZ
during scheduling but don't actually check the final AZ of the node.

When attaching volumes to running instances we need to check the actual
AZ on the instance and not the desired AZ at boot time. The desired AZ
attribute is optional at boot and may not be set or the desired AZ
could be different from the final AZ.
When we are booting with a volume however we don't know the final AZ so we
check on the desired AZ.

Closes-Bug: #1255347
Change-Id: Ied912c171100a450754d315027bf5c407ac067bb
libvirt: Refresh volume connection_info after volume snapshot

The following patch is related to the guest assisted snapshot
functionality.  When you take a snapshot of a volume
(e.g. GlusterFS) attached to a running instance, a new snapshot
file is created, i.e. volume-<uuid>.<snapshot-uuid>.  The
instance uses this file as the active volume.  If you shutdown
and restart the instance, nova will reattach the base volume
(volume-<uuid>) to the instance instead of the snapshot volume
(volume-<uuid>.<snapshot-uuid>).  The expected behavior is to
have the snapshot volume reattach to the instance.  This is
caused by stale data being returned from the database when
_get_instance_volume_block_device_info is called during
_power_on.  To fix this bug, this patch calls
refresh_connection_info to update the database in both
volume_snapshot_create and _volume_snapshot_delete methods of the
libvirt driver.

Change-Id: I0f340a3f879580e7981d97863bc299e33d71aa84
Closes-Bug: #1304695
Remove comments since it's pointless

Remove some comments for rescue/unrescue since it's pointless.

Change-Id: I1fa76355599fcd7a6999a16854361f7edd752a93
Raise more information on V2 API volumes when resource not found

NotFound exception is caught in volumes.py on v2 api
and raise HTTPNotFound exception but exception information are
not well specified. This patch adds more information
to the raised exception.

Change-Id: I2bd48503460662fcc648b31ade7156059b370f2b
Closes-Bug: #1275755
libvirt: Handle unsupported host capabilities

Neither libvirt-xen nor libvirt-lxc support
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES so check for the proper error
code that is returned by libvirt.

The existing code was performing this check improperly by trying to
catch an enum value; instead, we need to catch the `libvirtError`
exception and then check its return code.

Co-Authored-By: Rick Harris <rconradharris@gmail.com>
Co-Authored-By: Andrew Melton <andrew.melton@rackspace.com>
Closes-Bug: 1297962
Change-Id: Ie8bf5c9d1f2a27c387f8b2f54a9bb729fa2f0985
Convert address to str in fixed_ip_obj.associate

A caller of associate may pass in a netaddr.IPAddress argument which
will currently fail when it gets to sqlalchemy.  Following the
convention of other methods the netaddr.IPAddress will be cast to a
string.

Change-Id: I67c1876b447217b37104660ba87ed967f477b863
Closes-bug: 1317668
Partially remove quota-class logic from nova.quotas and test_quotas

Continuation of quota-class removal started in
I1110022d6f628d03aaf363da707f2d2ef1600437.

* No need to have quota-class in FakeContext since quota-class isn't in
  the real context anymore.
* Don't check for quota_class _DEFAULT_QUOTA_NAME='default' in
  get_defaults
* Remove get_by_class
* Remove get_class_quotas
* Full removal is in the subsequent patch.

Change-Id: Ia563ac3341b980c1b5a4a45fe73770ddc27acc91
vmware:Don't shadow builtin function type

We should avoid to assign builtin function with other value.

Closes-Bug: #1319615
Change-Id: I9c52524a16b6a74ad76466473338bf86414f0c50
VMware: spawn refactor - phase 1 - fetch_image

One wonders why this inner method existed at all. It did nothing but
add log messages. The inner method has been stripped and the log
messages abandoned because it turns out that they added no meaningful
information at all. It is not clear what intention this method had
if any.

partial blueprint vmware-spawn-refactor

Co-authored-by: Tracy Jones <tjones@vmware.com>
Change-Id: Ib346b5739d11a7f1fc0a145673bb2701b4b59455
Fixes Hyper-V iSCSI target login method

Hyper-V is trying to log in to portals/targets every time a volume
is attached, even if the portal/target was already connected. This
is not an issue with most volume backends, but it causes the attach
to fail when using Storwize as a Cinder backend.

This patch fixes the issue by checking if the target or portal is
already connected, and simply perform an update in this case,
instead of attempting to create a new connection.

Also, a retry loop is introduced for the case when the iSCSI target
login fails. As in this loop it is checked whether or not the
operation completed successfully, this method does not rely anymore
only on a sleep interval to ensure that the connection to the target
has been made. Even so, on V2 volume utilities, the sleep interval
is still needed to avoid having a new connection attempt before the
last one finished.

The method which gets the according mounted disk must raise an
exception when the device number is -1, which signifies that the
disk has not been mounted properly.

Co-Authored-By: Jay Bryant <jsbryant@us.ibm.com>

Closes-bug: #1221525

Change-Id: I92d2a586704fa3e857f46432bb571c81e86d183b
Merge "Partially remove quota-class logic from nova.quotas and test_quotas"
Correct pci resources log

In _report_final_resource_view() method, Nova will never record
"free pci" in log message because 'pci_devices' is not in dict 'resources'.

Closes-bug: #1314008

Change-Id: I90f1e3c624922c39e47f5e1fcccc7e33139d54e7
Fix wrong method name assert_called_once

There isn't method assert_called_once, and it doesn't really
check anything.  we use assertTrue(mock.called) instead.

Change-Id: Ibea0bbe5346220d59eea3b551b7548a3beaa5a6e
Ignore etc/nova/nova.conf.sample

Since we have already remove this sample file, and provided a way
to generate it, it should be no longer tracked.

Change-Id: I786812d039d96044ff5040d09f5472051966f74f
Closes-Bug: #1320150
Remove quota_class params from rest of nova.quota

Remove quota_class param from all of nova.quota resulting in no more
quota_class code in nova.quota and no tests in test_quota.

Change-Id: I1e788414f2f86d846612d3c4e909caae46273f4e
Remove quota_class db API calls

Previous patches:
* Remove quota_class API I1110022d6f628d03aaf363da707f2d2ef1600437
* Removed the quota_class from nova.context in I85dd24121a434b95dc6f0af180444d4258b50765
* Removed quota_class from nova.quotas in I1e788414f2f86d846612d3c4e909caae46273f4e

Now that we aren't using quota_class anywhere, remove the DB API. A
subsequent patch will add the database migration to drop the table.

Change-Id: Idd888cc45533140d500fbe0bca1fed36d6fb0274
Imported Translations from Transifex

Change-Id: I00d53eb9b5b08b272f8dccf7d750d30499103302
Add log translation hints.

Oslo would like to see hints like this in all of our code by the
end of juno. I'll slowly trickle the changes out over the
release.

Change-Id: I5aa89ec5e1abd7222967467261de9fecb3afa57b
Merge "Ignore etc/nova/nova.conf.sample"