xenapi: Stub out _add_torrent_url for Vhd tests

This will make the FetchVhdImageTestCasetest case play nicer when
a BitTorrent url plugin is installed and the tests are running with
no virtual environment.

Change-Id: I204f14246938981633989654bd3446ca3230c222
Avoid deleting user-provided Neutron ports if VM spawn fails

If the VM boot fails, resources like Neutron ports are destroyed.
This is particularly bad if the failure is transient and a
rescheduling attempt is made. In this case the port no longer exist
and the failure becomes self-inflicted. To avoid this, during the
deletion of VM resources, we look at the requested_networks passed
by the user: if they contain port ids, we skip the destruction.

An optional parameter is added to RPC method deallocate_for_instance.
RPC Network API is bumped to 1.10 to reflect this change, but the
change is backward compatible.

Fixes bug #1195490

Change-Id: Iade232267c58ae2cf3966829e660d3298070a3bf
Code dedup in class TestServerActionRequestXMLDeserializer

Moved duplicated requests and expected replies to functions
-_generate_request()
-_generate_expected()

bp nova-tests-code-duplication

Change-Id: Ib1d1b8b93f769b8dd8223dbbb3c42288254d8825
Avoid shadowing Exception 'message' attribute

The Exception class has a 'message' attribute:

  >>> Exception('foo').message
  'foo'

This attribute is deprecated since Python 2.6 and removed in Python 3:

  http://www.python.org/dev/peps/pep-0352/#retracted-ideas

To help porting to Python 3, we should avoid using the .message
attribute at all. However, confusingly, we follow a pattern that results
in the attribute being shadowed by a class attribute:

  >>> class MyException(Exception):
  ...     message = 'Foo %s'
  ...     def __init__(self, bar):
  ...         message = self.message % bar
  ...         super(MyException, self).__init__(message)
  ...
  >>> MyException('bar').message
  'Foo %s'
  >>> str(MyException('bar'))
  'Foo bar'

whereas, we obviously want behaviour like this:

  >>> class MyException(Exception):
  ...     msg_fmt = 'Foo %s'
  ...     def __init__(self, bar):
  ...         message = self.msg_fmt % bar
  ...         super(MyException, self).__init__(message)
  ...
  >>> MyException('bar').message
  'Foo bar'
  >>> str(MyException('bar'))
  'Foo bar'

Avoid this shadowing by using 'msg_fmt' as the name of the class
attribute so it's more obvious where we're actually using the deprecated
.message attribute.

Also add a test which fails without this fix.

Change-Id: I304f31edec20b1293cf6c8de931415590fde6752
Add API-v3 merged core API into core API list

This completes core API list, so if one of those could not be loaded
an exception will be raised.

The changes on the tests were necessary to avoid whitelist or blacklist all the
core API or get an exception cause one of them wasn't loadi
Also to fix a bug in the tests that override the black or white lists options
and it wasn't in list format causing, for instance, that ips API match with
os-fixed-ips.

Related to bp nova-v3-api

Change-Id: I6e0c6eaa38863495bcabf2e6ce082589becdfe82
Code dedup in class ImagesControllerTest

Moved most commonly used values and dictionaries to setUp()

bp nova-tests-code-duplication

Change-Id: I9d573085964d2f62736413ca49391b19f058edb7
Merge "Add API-v3 merged core API into core API list"
Merge "Code dedup in class ImagesControllerTest"
Merge "Avoid shadowing Exception 'message' attribute"
Merge "Avoid deleting user-provided Neutron ports if VM spawn fails"
Merge "Code dedup in class TestServerActionRequestXMLDeserializer"
Merge "xenapi: Stub out _add_torrent_url for Vhd tests"
Merge remote-tracking branch 'm_src_repo/citrix-fixes' into build-temp