Guard against content being None

`content` can be passed in as None, so we need to set it to the empty
list if that occurs.

This also fixes the bad-practice of using a mutable data-type as a
default argument.

Fixes bug 1163598

Change-Id: Ie991c9452a21cfb036d3955a094ec345805d63d1
(cherry picked from commit 782bab8dd2930a4479d84dcb906321313d06b25b)
Fix building quantumapi network model with network list

Bug 1171636 occurs when _build_network_info_model() receives a list
of networks that does not fully map all of an instance's ports.
It crashes in _ensure_requested_network_ordering() when the list of
all ports is sorted by the subset of networks provided.

This change simplifies the early part of that function to only
consider ports within the networks provided, and to always sort those
ports in network order. This allows us to remove some error path
code from the loop below that iterates over the ports (which contained
a fatal typo, by the way) which is now dead code.

The affected code is really untested at the moment, due to the
structure of the method, making it hard to add a unit test to cover
this fix. In order to make the change clear from the existing code,
this fix is provided here first, and the following patch restructures
the method and add tests for this change and the rest of the surrounding
code.

Fixes bug 1171636

Change-Id: Idf519a88415844451b18959b38cc48ce92c090d1
(cherry picked from commit 08c7cf5c67a75dea9b453bd915a0cd55e67c4adc)
nova coverage creates lots of empty folders

With nova coverage extension disabled as a default behaviour,
nova will create lots of empty folders under /tmp folder. And also
with each time the nova service reboot, it will create a new
directory with name like nova_coverage_*. There will be number of
the empty folders accumulated.

Patch-Set 3: Rebase for merging code
Fixes: bug 1169005

Conflicts:
	nova/api/openstack/compute/contrib/coverage_ext.py

Change-Id: I26d1037eb66d781ac6ef6b600cca04a709bff3f7
(cherry picked from commit b6e072a84a31eca1f7d7c44117327c5042e153c2)
Fix zookeeper import and tests

Import zookeeper.membership rather than zookeeper.membersip.
Also fixed some issues with setting up the tests for the zookeeper
servicegroup driver.  Config options were not being set before
initializing the driver leading to failures.

There is no added test for this because the bug is indistinguishable
from not having the zookeeper python modules installed, which leads to
skipping these servicegroup tests.

Bug 1177776

Change-Id: Idd6dca2e03169399b930cc1fc1a85636497cb0b5
(cherry picked from commit 4a2845095c0e35336c60836050ca11c71898fb8c)
Fix resize when instance has no image

This patch makes it possible to resize an instance that has no image
supplied (was booted from volume), by avoiding calling the image service
and thus causing an uncaught exception, if there was no image suplied in
the first place.

Fixes bug: 1182114
blueprint: improve-boot-from-volume

Change-Id: I67d63a7aef699b555897582c74b04e857db7aafb
(cherry picked from commit 4465b705fc7cb7a150a7f8d6f70ccf6c20ff3284)
Merge "Fix zookeeper import and tests" into stable/grizzly
Merge "nova coverage creates lots of empty folders" into stable/grizzly
Merge "Guard against content being None" into stable/grizzly
Merge "Fix building quantumapi network model with network list" into stable/grizzly
Merge "Fix resize when instance has no image" into stable/grizzly