[virt-tools-list] [PATCH] Edit description immediately without a shutdown
Cole Robinson
crobinso at redhat.com
Sun Oct 14 19:26:26 UTC 2012
On 10/11/2012 05:40 PM, Marcus Karlsson wrote:
> Editing the description of a running guest will show a dialog that
> changes will take effect after the next guest shutdown. However, libvirt
> can change the description of a guest while it is running.
>
> Teach virt-manager to edit the description of a running guest without
> requiring a shutdown.
Hi Marcus, thanks for the patch!
However there's kind of a problem here, in that this will error for libvirt
less than 0.9.10 when setMetadata was introduced.
In current virt-manager though we already emulate description 'hotplug': we
always read the description from the inactive XML for the running VM, so a
'define' basically works like a hotplug.
The only missing piece was working around that error message, which I've done
with a new commit:
http://git.fedorahosted.org/cgit/virt-manager.git/commit/?id=a341ce4534f60f79113ce27e64416abebcf241dd
Also, I added a check to the virtinst support module to check for setMetadata
support:
http://git.fedorahosted.org/cgit/python-virtinst.git/commit/?id=849c1e02a3939a4b9d57e62c4974e34526249f0e
So if you want to update your patch, we could use setMetadata only when
supported. Move my comment from the virt-manager commit into the new
vmmDomain.description_hotplug function, and if setMetadata isn't supported,
just exit from the function early. That way the only description hotplug hack
can be used as a fallback.
Thanks,
Cole
> ---
> src/virtManager/details.py | 1 +
> src/virtManager/domain.py | 7 +++++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/src/virtManager/details.py b/src/virtManager/details.py
> index c53c67f..e57903a 100644
> --- a/src/virtManager/details.py
> +++ b/src/virtManager/details.py
> @@ -2033,6 +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)
> + 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 82680b8..227e8c1 100644
> --- a/src/virtManager/domain.py
> +++ b/src/virtManager/domain.py
> @@ -813,6 +813,13 @@ class vmmDomain(vmmLibvirtObject):
> devobj.passwd = newval or None
> self.update_device(devobj)
>
> + def hotplug_description(self, desc):
> + 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