libvirt re-define guest with wrong XML document

In the nova/virt/libvirt/driver.py file, the '_live_snapshot' and
'_swap_volume' methods have the following code flow
  xml = dom.XMLDesc(0)
  dom.undefine()
  dom.blockRebase()
  dom.defineXML(xml)
The reason for this is that 'blockRebase' requires the guest to be
transient, so we must temporarily delete the persistent config and
then re-create it later.
Unfortunately this code is using the wrong XML document when
re-creating the persistent config. 'dom.XMLDesc(0)' will return the
guest XML document based on the current guest state. Since the guest
is running in both these cases, it will get getting the *live* XML
instead of the persistent XML.So these methods are deleting the
persistent XML and replacing it with the live XML. These two
different XML documents are not guaranteed to contain the same
information.
As a second problem, it is not requesting inclusion of security
information, so any SPICE/VNC password set in the persistent XML
is getting lost.

Change-Id: I4b4e0990ca6c07a9215766f994884a1fb18f3a41
Closes-Bug: #1346191
Merge "libvirt re-define guest with wrong XML document"