[virt-tools-list] [PATCH v2 3/5] virtManager: add functions to manage guest "title" metadata

Cole Robinson crobinso at redhat.com
Wed Sep 25 16:42:09 UTC 2013


On 09/24/2013 01:06 PM, Giuseppe Scrivano wrote:
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
>  virtManager/domain.py | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/virtManager/domain.py b/virtManager/domain.py
> index 0296472..1a0c6d8 100644
> --- a/virtManager/domain.py
> +++ b/virtManager/domain.py
> @@ -195,6 +195,7 @@ class vmmDomain(vmmLibvirtObject):
>          self._is_management_domain = None
>          self._id = None
>          self._name = None
> +        self._title = None
>          self._snapshot_list = None
>  

This is unused (as is the other _title init below) and shouldn't be needed
anyways.

ACK series otherwise, so drop that bit and please push.

Thanks,
Cole

>          self.lastStatus = libvirt.VIR_DOMAIN_SHUTOFF
> @@ -204,6 +205,7 @@ class vmmDomain(vmmLibvirtObject):
>          self.managedsave_supported = False
>          self.remote_console_supported = False
>          self.snapshots_supported = False
> +        self.title_supported = False
>  
>          self._enable_net_poll = False
>          self._stats_net_supported = True
> @@ -257,6 +259,9 @@ class vmmDomain(vmmLibvirtObject):
>          self.snapshots_supported = self.conn.check_domain_support(
>                                      self._backend,
>                                      self.conn.SUPPORT_DOMAIN_LIST_SNAPSHOTS)
> +        self.title_supported = self.conn.check_domain_support(
> +                                    self._backend,
> +                                    self.conn.SUPPORT_DOMAIN_GET_METADATA)
>  
>          # Determine available XML flags (older libvirt versions will error
>          # out if passed SECURE_XML, INACTIVE_XML, etc)
> @@ -316,6 +321,17 @@ class vmmDomain(vmmLibvirtObject):
>              self._name = self._backend.name()
>          return self._name
>  
> +    def get_name_with_title(self):
> +        # When available, include the title in the name
> +        name = self.get_name()
> +        title = self.get_title()
> +        if title:
> +            return "%s - %s" % (name, title)
> +        return name
> +
> +    def get_title(self):
> +        return self.get_xmlobj(inactive=True).title
> +
>      def get_id(self):
>          if self._id is None:
>              self._id = self._backend.ID()
> @@ -372,6 +388,7 @@ class vmmDomain(vmmLibvirtObject):
>      def _invalidate_xml(self):
>          vmmLibvirtObject._invalidate_xml(self)
>          self._name = None
> +        self._title = None
>          self._id = None
>  
>      def _redefine_device(self, cb, origdev):
> @@ -563,6 +580,11 @@ class vmmDomain(vmmLibvirtObject):
>              guest.description = newvalue or None
>          return self._redefine(change)
>  
> +    def define_title(self, newvalue):
> +        def change(guest):
> +            guest.title = newvalue or None
> +        return self._redefine(change)
> +
>      # Boot define methods
>      def set_boot_device(self, boot_list):
>          def change(guest):
> @@ -890,6 +912,17 @@ class vmmDomain(vmmLibvirtObject):
>                  libvirt.VIR_DOMAIN_METADATA_DESCRIPTION,
>                  desc, None, None, flags)
>  
> +    def hotplug_title(self, title):
> +        if not self.conn.check_domain_support(self._backend,
> +                self.conn.SUPPORT_DOMAIN_SET_METADATA):
> +            return
> +
> +        flags = (libvirt.VIR_DOMAIN_AFFECT_LIVE |
> +                libvirt.VIR_DOMAIN_AFFECT_CONFIG)
> +        self._backend.setMetadata(
> +                libvirt.VIR_DOMAIN_METADATA_TITLE,
> +                title, None, None, flags)
> +
>  
>      ########################
>      # Libvirt API wrappers #
> 




More information about the virt-tools-list mailing list