mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-27 10:25:25 +03:00
domain: pm: Add set_defaults
This commit is contained in:
parent
5517033c79
commit
468f5e67fa
@ -13,3 +13,23 @@ class DomainPm(XMLBuilder):
|
||||
|
||||
suspend_to_mem = XMLProperty("./suspend-to-mem/@enabled", is_yesno=True)
|
||||
suspend_to_disk = XMLProperty("./suspend-to-disk/@enabled", is_yesno=True)
|
||||
|
||||
|
||||
##################
|
||||
# Default config #
|
||||
##################
|
||||
|
||||
def set_defaults(self, guest):
|
||||
# When the suspend feature is exposed to VMs, an ACPI shutdown
|
||||
# event triggers a suspend in the guest, which causes a lot of
|
||||
# user confusion (especially compounded with the face that suspend
|
||||
# is often buggy so VMs can get hung, etc).
|
||||
#
|
||||
# We've been disabling this in virt-manager for a while, but lets
|
||||
# do it here too for consistency.
|
||||
if (guest.os.is_x86() and
|
||||
self.conn.check_support(self.conn.SUPPORT_CONN_PM_DISABLE)):
|
||||
if self.suspend_to_mem is None:
|
||||
self.suspend_to_mem = False
|
||||
if self.suspend_to_disk is None:
|
||||
self.suspend_to_disk = False
|
||||
|
@ -757,7 +757,7 @@ class Guest(XMLBuilder):
|
||||
self.features.set_defaults(self)
|
||||
for seclabel in self.seclabels:
|
||||
seclabel.set_defaults(self)
|
||||
self._set_pm_defaults()
|
||||
self.pm.set_defaults(self)
|
||||
|
||||
for dev in self.devices.get_all():
|
||||
dev.set_defaults(self)
|
||||
@ -918,21 +918,6 @@ class Guest(XMLBuilder):
|
||||
if i.name == "hypervclock":
|
||||
self.clock.remove_timer(i)
|
||||
|
||||
def _set_pm_defaults(self):
|
||||
# When the suspend feature is exposed to VMs, an ACPI shutdown
|
||||
# event triggers a suspend in the guest, which causes a lot of
|
||||
# user confusion (especially compounded with the face that suspend
|
||||
# is often buggy so VMs can get hung, etc).
|
||||
#
|
||||
# We've been disabling this in virt-manager for a while, but lets
|
||||
# do it here too for consistency.
|
||||
if (self.os.is_x86() and
|
||||
self.conn.check_support(self.conn.SUPPORT_CONN_PM_DISABLE)):
|
||||
if self.pm.suspend_to_mem is None:
|
||||
self.pm.suspend_to_mem = False
|
||||
if self.pm.suspend_to_disk is None:
|
||||
self.pm.suspend_to_disk = False
|
||||
|
||||
def _add_implied_controllers(self):
|
||||
has_spapr_scsi = False
|
||||
has_virtio_scsi = False
|
||||
|
Loading…
Reference in New Issue
Block a user