Make tenant_usage fall back to instance_type_id

In order to expose historical usage information about instances that
were deleted at the time migration #153 was run, we need to fall back
to looking up type information by instance_type_id.

This patch does that (only for deleted instances) and replicates the
previous behavior of skipping instances that have an instance_type_id
that points to a non-existent type.

Fixes bug 1161022

(cherry-picked from 30631d0077424001e2fa57674e6e9f2a12f0683e)

Change-Id: I39d30c59d1711d8f2a61c7a5e2545b3952e55dbe
Fix quantum nic allocation when only portid is specified

A simple omission at the end of allocate_for_instance() was preventing
the function from returning information about the newly-allocated port
if one was not actually allocated from a network (i.e. if it was
provided as input). This fixes that and adds a test which would have
caught it.

Fixes bug 1160560

(cherry-picked from 57689f26f37fe3de33a666a2d7d0731eae9c7ea9)

Change-Id: Ib0d7d91acfe5bd684cdfc072fe47c8115c2f91b3
Merge "Fix quantum nic allocation when only portid is specified" into milestone-proposed
always quote dhcp-domain, otherwise dnsmasq can fail to start

the dnsmasq arg --dhcp-domain can't be passed to dnsmasq as empty
(i.e. --dhcp-domain= ) unlike many other arguments. If you do pass
it as empty, dnsmasq won't start, throwing a ProcessException which
then crashes the rest of nova-network.

Fix this by quoting dhcp-domain so that empty domains are allowed.

Fixed bug #1161027

This was found by grenade upgrade testing

Change-Id: Id24814339d8c8a709f5041f0aa98b10ba1e0e595
(cherry picked from commit 8d68ed3583df6ced4b4c8b6d6bb3569e03992cfe)
Fix typo in the XML serialization os-services API.

Partially implements blueprint nova-api-samples
fixes bug 1130609

The XML serializer for the update method in the os-services API extensions was
not serializing the "updated_at" field because of a typo in the code.
In this change we added api_samples for the XML output.

Change-Id: I9fff0677e9bad650b19e559b3ed6e9bc0ffe8c3c
(cherry picked from commit 48b41e0b880adf80e3be6d128cd392af57b8477e)