mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
2f89ecf4a9
Similar to what was done in libvirt. See these commits:600462834f
c99e954973
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
#
|
|
# Copyright 2014 Red Hat, Inc.
|
|
#
|
|
# This work is licensed under the GNU GPLv2 or later.
|
|
# See the COPYING file in the top-level directory.
|
|
|
|
from ..xmlbuilder import XMLBuilder, XMLProperty
|
|
|
|
|
|
class DomainPm(XMLBuilder):
|
|
XML_NAME = "pm"
|
|
|
|
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
|