summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Karlsson <mk@acc.umu.se>2012-10-16 23:26:06 +0200
committerCole Robinson <crobinso@redhat.com>2012-10-16 17:52:10 -0400
commit248cb89c1c6786d856d597f7c837c33545f43c8f (patch)
tree85737eae05f5b01fbbacd9d654756c7965e12d9e
parenta341ce4534f60f79113ce27e64416abebcf241dd (diff)
downloadvirt-manager-248cb89c1c6786d856d597f7c837c33545f43c8f.tar.gz
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)
-rw-r--r--AUTHORS1
-rw-r--r--src/virtManager/details.py11
-rw-r--r--src/virtManager/domain.py17
3 files changed, 19 insertions, 10 deletions
diff --git a/AUTHORS b/AUTHORS
index e0f4886d..fb81b58a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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...>
diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 35dc8338..e57903a1 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -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)
diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index d536f776..cc446c4d 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -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 #