mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-10 07:25:51 -06:00
virtManager: add functions to manage guest "title" metadata
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
0d03f972a3
commit
4b52133e53
@ -204,6 +204,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 +258,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 +320,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()
|
||||
@ -563,6 +578,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 +910,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 #
|
||||
|
Loading…
Reference in New Issue
Block a user