More consistent libvirt XML handling and cleanup

Fixes bug 1081373

The overall goal of this effort is to make handling of libvirt XMLs
more consistent. First, the on-disk XML file in the instances
directory is never to be used by the libvirt driver. It will be
generated via to_xml(). Second, anytime it is safe to re-define the
XML using the version we programatically generate, we do so.

Extended to_xml() to support a new write_to_disk argument. When true,
this the resulting XML will be written to the instances directory.
Renamed _get_domain_xml to _get_existing_domain_xml, as it should only
be used when we need the XML for a defined domain. It will continue to
fall back to using to_xml() if the defined version is not available.

Hard reboots will now assume nothing about the defined state within
libvirt. Rather, we generate and define the domain every time. This
eliminates the possibility of the hypervisor and Nova database going
out of sync (i.e. volume attached in defined XML with Nova having no
knowledge). We no longer need to pass an xml argument into
_hard_reboot() since it is always generated.

Resume state on boot has been updated with logic similar to that of
_hard_reboot. Again, after a hypervisor reboot (or detection of downed
VMs on compute start), we should not assume the defined XML is valid.
The state or configuration of the VM, from Nova's perspective, may
have been changed while the system was down.

The post_live_migration_on_destination() method used to call to_xml()
without block_device_info. This would result in an on-disk XML without
any volume mappings. The compute manager has been updated to pass bdi
so that this XML can be generated and written correctly. The Mox stub
for this function has been replaced by a stub in the fake virt driver.

Change-Id: I4aa1068fa3aa54fdb7e690d46b6cf2e41bb20bc9
Merge "More consistent libvirt XML handling and cleanup"