Edit description using SetMetadata when available

Since 0.9.10 libvirt supports editing a domain's metadata using the
SetMetadata API. Using that API the description of a domain can be
edited as it is running.

Make virt-manager edit the description of a domain using SetMetadata
when available.

(crobinso: Add Markus to AUTHORS)
This commit is contained in:
Marcus Karlsson 2012-10-16 23:26:06 +02:00 committed by Cole Robinson
parent a341ce4534
commit 248cb89c1c
3 changed files with 19 additions and 10 deletions

View File

@ -82,6 +82,7 @@ Further patches have been submitted by:
Guannan Ren <gren-at-redhat-dot-com>
Eduardo Elias Ferreira <edusf-at-linux-dot-vnet-dot-ibm-dot-com>
Joey Boggs <jboggs-at-redhat-dot-com>
Marcus Karlsson <mk-at-acc.umu.se>
<...send a patch & get your name here...>

View File

@ -2033,16 +2033,7 @@ class vmmDetails(vmmGObjectUI):
desc_widget = self.widget("overview-description")
desc = desc_widget.get_buffer().get_property("text") or ""
add_define(self.vm.define_description, desc)
# Hack so that we don't get a warning that
# 'changes take effect after reboot'
# We already fake hotplug like behavior, by reading the
# description from the inactive XML from a running VM
#
# libvirt since 0.9.10 provides a SetMetadata API that provides
# actual <description> 'hotplug', but using that means checking
# for support, version, etc, so let's stick with the easy way
add_hotplug(lambda d: d, desc)
add_hotplug(self.vm.hotplug_description, desc)
return self._change_config_helper(df, da, hf, ha)

View File

@ -813,6 +813,23 @@ class vmmDomain(vmmLibvirtObject):
devobj.passwd = newval or None
self.update_device(devobj)
def hotplug_description(self, desc):
# We already fake hotplug like behavior, by reading the
# description from the inactive XML from a running VM
#
# libvirt since 0.9.10 provides a SetMetadata API that provides
# actual <description> 'hotplug', and using that means checkig
# for support, version, etc.
if not virtinst.support.check_domain_support(self._backend,
virtinst.support.SUPPORT_DOMAIN_SET_METADATA):
return
flags = (libvirt.VIR_DOMAIN_AFFECT_LIVE |
libvirt.VIR_DOMAIN_AFFECT_CONFIG)
self._backend.setMetadata(
libvirt.VIR_DOMAIN_METADATA_DESCRIPTION,
desc, None, None, flags)
########################
# Libvirt API wrappers #