libvirt _live_snapshot & _swap_volume functions re-define guest with wrong XML document

Bug #1346191 reported by Daniel Berrange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
lvdongbing

Bug Description

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

The fix is to replace

  dom.XMLDesc(0)

with

  dom.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE |
                               libvirt.VIR_DOMAIN_XML_SECURE)

in the _live_snapshot and _swap_volume functions.

Tracy Jones (tjones-i)
tags: added: libvirt
lvdongbing (dbcocle)
Changed in nova:
assignee: nobody → lvdongbing (dbcocle)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/110346

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/110346
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5c3f212343df997daa48f1f4a1cdd2a29099c288
Submitter: Jenkins
Branch: master

commit 5c3f212343df997daa48f1f4a1cdd2a29099c288
Author: lvdongbing <email address hidden>
Date: Tue Jul 29 23:40:44 2014 +0800

    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

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
importance: Undecided → Medium
tags: added: icehouse-backport-potential
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.