hyperv: Initialize target_iqn in attach_volume

The target_iqn is referenced before it is declared in the
case that an exception is encountered in _login_storage_target
or _get_mounted_disk_from_lun.  This causes the exception path
to cause an additional, misleading, traceback to be printed
after an exception is encountered.

This commit initializes target_iqn at the beginning of
attach_volume to avoid the traceback.

Change-Id: I1cdfb9dfa054ee4f4f6918d7bc49081ccaebab9d
Close-Bug: 1233837
Plug Vif into Midonet using Neutron port binding

Currently Midokura uses its own script (mm-ctl) to bind ports. However, support
for using this script is left out of the nova and neutron projects. This causes
confusion and makes deployments unnecessarily complicated for customers using
Havana. This fix is to change nova to properly use mm-ctl. Corresponding
changes will be submitted to devstack and neutron.

Change-Id: I7c9edded5ab6fe19b63e54cd6905d9242e4a90cc
Closes-Bug: 1235132
Replace incorrect Null checking to return correctly

Null checking for metadata in check_img_metadata_properties_
quota function doesn't work as designed, fix incorrect Null
checking code.

Change-Id: Id3f971091d857d6b2aebc4985cb932417c21b5dc
Fixes: bug #1220120
Utilizes assertIn - tests/api/v3

Using assertTrue and the 'in' operator to test
if an element is in a sequence is too python2.4.
Our unit testing framework supports assertIn,
which was created for these types of tests.
Using assertIn will enhance readability of the test scripts.

Change-Id: Ic3ae0a0eca219bd7d114580ad3642e7df04ad1f4
Utilizes assertIn - tests/api/contrib

Using assertTrue and the 'in' operator to test
if an element is in a sequence is too python2.4.
Our unit testing framework supports assertIn,
which was created for these types of tests.
Adapting assertIn will enhance the readability of the test scripts.

Change-Id: Id2237b7a35c5c759e571b138faa8d1bef46a7e27
Utilizes assertIn - tests/virt

Using assertTrue and the 'in' operator to test
if an element is in a sequence is too python2.4.
Our unit testing framework supports assertIn,
which was created for these types of tests.
Using assertIn will enhance readability of the test scripts.

Change-Id: Ifa0f7e12a1ba84052e1e64ed2775056fafd2b13b
Utilizes assertIn - tests/api/etc

Using assertTrue and the 'in' operator to test
if an element is in a sequence is too python2.4.
Our unit testing framework supports assertIn,
which was created for these types of tests.
Adapting assertIn will enhance the readability of the test scripts.

Change-Id: I9995c6668710e94902d97da21303274965df17e9
Improve logging messages in libvirt driver

This is a trivial change to correct an uninformative log message.
There are two checks in get_instance_disk_info that look at a disk.
One checks for the type of a disk and logs its path if it is not a file.
The other checks for the path and logs the instance name it belongs to
if it does not exist. The first will log None if the path does not exist,
so reverse the order of the checks.

Closes-Bug: #1239747
Change-Id: Ieb52ba0584ad789dc55f40e0172cf5ed41e86fbe
Add extension access_ips for v3 API

The functionality of access ips overlaps heavily with floating ips,
and the most deployments don't use access ips now. So we decided to
demote access_ips to extensions, the more detail discussion at:
https://etherpad.openstack.org/NovaV3APICore

New extension add prefix 'os-access-ips' for properties 'access_ip_v4' and
'access_ip_v6' to follow v3 API rules. And add unittest for new extension.

For making this patch small, this patch just add the code of extension
and related unittest, without enable the new extension and remove the
old access_ips attributes. That will be done by next patch.

If you want to test this new extension, you can enable it by adding
'access_ips = nova.api.openstack.compute.plugins.v3.access_ips:AccessIPs'
to entry point 'nova.api.v3.extensions' and
'nova.api.v3.extensions.server.create*/rebuild*/update' in setup.cfg.

DocImpact

Partially implements bp nova-v3-api

Change-Id: Ib56e4ff9145798792f062fc107390565673ac9a1
Fix docstring related to create_backup API

This patch adds "returns" of backup() and removes unnecessary
"backup_type" from _create_image().

Change-Id: If00c6437ee8415ba1e21ae2cceba0817606f27b0
Manage None value for the 'os_type' property

The I2bab617f6c1e8866650ca7dc5178b640738c9ae6 introduced a way to pass the
'os_type' property to glance when we are doing a snapshot in the libvirt
driver. Currently the code doesn't manage properly the None value for this
property and so None value is passed to glance which creates an image with
a property called 'os_type' with value 'None'.
As results of that all instances booted from a snapshot with this property will
have None value in the os_type field.
That field is used to create file name for backing images for ephemeral disks.
Now consider this scenario:
we boot an instance from an image without the os_type property defined and
with an ephemeral disk of 50 G
the resulting backing file will be called ephemeral_50_default.
At this point we take a snapshot from that instance and we boot a new instance
using this snapshot, and because of this bug we will have a new backing file
called ephemeral_50_None.
That is bad because is leaking resources in the host.

Please note that I did a small refactor of the code to make my change testable.

Change-Id: I40bca2732ee2c911344e9d361612007da1c7c3cf
Closes-bug: #1240542
Improve object instantiation syntax in some tests

This makes the base and instance tests use the improved
instantiation syntax.

Change-Id: I60aa64603a4ed225cc978f4b5b86ade759242276
Remove .pyc files before generating sample conf.

Updates the generate_samples.sh script so that we remove
.pyc files in the nova source tree before generating the sample file.

If you don't run unit tests the .pyc files won't get regenerated.
This can cause cryptic errors if you run tests, switch branches,
and then try to regenerate your config files if there are module
differences, etc.

Change-Id: I784a22c1cd7fb2c69ea1d9e02f87bd7da19d76aa
Change tab to blank space in hypervisors-detail-resp

We should not use tab in hypervisors-detail-resp.json.tpl and
hypervisors-detail-resp.xml.tpl, the fix was change tab to blank
space for those two files.

Change-Id: I21be0d806e4238228dfb068f7937bdc6c81e62b0
Fix i18n issue for nova/compute/manager.py

There are some log message in nova/compute/manager.py does not follow
I18n coding style, we should update this.

Change-Id: Ia566b5377e27bc9883a3d191346ba4a83df385ff
Utilizes assertIn - tests/etc

Using assertTrue and the 'in' operator to test
if an element is in a sequence is too python2.4.
Our unit testing framework supports assertIn,
which was created for these types of tests.
Adapting assertIn will enhance the readability
of the test scripts.

Change-Id: Ib44d57e75238691234c5290d13c54c526a6ae64b
Merge "Remove .pyc files before generating sample conf."
Make Object FieldType take an object name instead of a class

The object infrastructure has a concept of an object name, which
is what we use to determine if something implements a particular
thing, and it is how we look up object classes when we
deserialize them. Since many objects will eventually reference
each other, we should be using their names to determine
compatibility, not their classes.

Related to blueprint structured-object-fields

Change-Id: I2edb8b8475662ad25e9f3319ce5e44317a2d0547
Merge "Add extension access_ips for v3 API"
Merge "Change tab to blank space in hypervisors-detail-resp"