[virt-tools-list] [PATCH] Edit description using SetMetadata when available
Cole Robinson
crobinso at redhat.com
Tue Oct 16 21:53:14 UTC 2012
On 10/16/2012 05:26 PM, Marcus Karlsson wrote:
> 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.
> ---
> src/virtManager/details.py | 11 +----------
> src/virtManager/domain.py | 17 +++++++++++++++++
> 2 files changed, 18 insertions(+), 10 deletions(-)
>
Thanks Markus, applied now:
http://git.fedorahosted.org/cgit/virt-manager.git/commit/?id=248cb89c1c6786d856d597f7c837c33545f43c8f
- Cole
> diff --git a/src/virtManager/details.py b/src/virtManager/details.py
> index 35dc833..e57903a 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 d536f77..cc446c4 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 #
>
More information about the virt-tools-list
mailing list