Skip to content

Commit

Permalink
Merge "Redefine the domain's XML on volume attach/detach" into stable…
Browse files Browse the repository at this point in the history
…/essex
  • Loading branch information
Jenkins authored and openstack-gerrit committed Sep 13, 2012
2 parents 4ac2dcc + b375b4f commit 2e75689
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nova/tests/fakelibvirt.py
Expand Up @@ -73,6 +73,8 @@ def _reset():
VIR_DOMAIN_SHUTOFF = 5
VIR_DOMAIN_CRASHED = 6

VIR_DOMAIN_XML_SECURE = 1

VIR_CPU_COMPARE_ERROR = -1
VIR_CPU_COMPARE_INCOMPATIBLE = 0
VIR_CPU_COMPARE_IDENTICAL = 1
Expand Down
14 changes: 14 additions & 0 deletions nova/virt/libvirt/connection.py
Expand Up @@ -549,6 +549,13 @@ def attach_volume(self, connection_info, instance_name, mountpoint):
connection_info,
mount_device)

# TODO(danms) once libvirt has support for LXC hotplug,
# replace this re-define with use of the
# VIR_DOMAIN_AFFECT_LIVE & VIR_DOMAIN_AFFECT_CONFIG flags with
# attachDevice()
domxml = virt_dom.XMLDesc(libvirt.VIR_DOMAIN_XML_SECURE)
self._conn.defineXML(domxml)

@staticmethod
def _get_disk_xml(xml, device):
"""Returns the xml for the disk mounted at device"""
Expand Down Expand Up @@ -583,6 +590,13 @@ def detach_volume(self, connection_info, instance_name, mountpoint):
connection_info,
mount_device)

# TODO(danms) once libvirt has support for LXC hotplug,
# replace this re-define with use of the
# VIR_DOMAIN_AFFECT_LIVE & VIR_DOMAIN_AFFECT_CONFIG flags with
# detachDevice()
domxml = virt_dom.XMLDesc(libvirt.VIR_DOMAIN_XML_SECURE)
self._conn.defineXML(domxml)

@exception.wrap_exception()
def _attach_lxc_volume(self, xml, virt_dom, instance_name):
LOG.info(_('attaching LXC block device'))
Expand Down

0 comments on commit 2e75689

Please sign in to comment.