mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
guest: Don't unconditionally overwrite on_poweroff/on_crash
This commit is contained in:
parent
a4e6280a6c
commit
a5d03fdf6e
@ -17,7 +17,7 @@
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_poweroff>restart</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
@ -60,9 +60,9 @@
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<on_poweroff>restart</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>preserve</on_crash>
|
||||
<devices>
|
||||
<emulator>/bin/qemu-system-aarch64</emulator>
|
||||
<disk type="file" device="disk">
|
||||
|
@ -189,7 +189,7 @@
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<on_crash>preserve</on_crash>
|
||||
<resource>
|
||||
<partition>/virtualmachines/production</partition>
|
||||
</resource>
|
||||
|
@ -761,7 +761,7 @@ c.add_compare("--arch armv7l --machine virt --boot kernel=/f19-arm.kernel,initrd
|
||||
c.add_compare("--arch armv7l --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --os-variant fedora20", "arm-defaultmach-f20")
|
||||
c.add_compare("--arch aarch64 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s", "aarch64-machvirt")
|
||||
c.add_compare("--arch aarch64 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s", "aarch64-machdefault")
|
||||
c.add_compare("--arch aarch64 --cdrom %(EXISTIMG2)s --boot loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s --cpu none", "aarch64-cdrom")
|
||||
c.add_compare("--arch aarch64 --cdrom %(EXISTIMG2)s --boot loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart", "aarch64-cdrom")
|
||||
c.add_compare("--arch ppc64 --machine pseries --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-pseries-f20")
|
||||
c.add_compare("--arch ppc64 --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-machdefault-f20")
|
||||
c.add_compare("--arch aarch64 --nodisks", "aarch64-default-uefi") # ensure aarch64 defaults to UEFI
|
||||
|
@ -102,9 +102,9 @@ class Guest(XMLBuilder):
|
||||
_XML_ROOT_NAME = "domain"
|
||||
_XML_PROP_ORDER = ["type", "name", "uuid", "title", "description",
|
||||
"maxmemory", "memory", "blkiotune", "memtune", "memoryBacking",
|
||||
"vcpus", "curvcpus", "numatune", "bootloader", "os", "idmap", "features",
|
||||
"cpu", "clock", "on_poweroff", "on_reboot", "on_crash", "resource", "pm",
|
||||
"emulator", "_devices", "seclabel"]
|
||||
"vcpus", "curvcpus", "numatune", "bootloader", "os", "idmap",
|
||||
"features", "cpu", "clock", "on_poweroff", "on_reboot", "on_crash",
|
||||
"resource", "pm", "emulator", "_devices", "seclabel"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
XMLBuilder.__init__(self, *args, **kwargs)
|
||||
@ -190,8 +190,8 @@ class Guest(XMLBuilder):
|
||||
|
||||
on_poweroff = XMLProperty("./on_poweroff",
|
||||
default_cb=lambda s: "destroy")
|
||||
on_reboot = XMLProperty("./on_reboot")
|
||||
on_crash = XMLProperty("./on_crash")
|
||||
on_reboot = XMLProperty("./on_reboot", default_cb=lambda s: "restart")
|
||||
on_crash = XMLProperty("./on_crash", default_cb=lambda s: "restart")
|
||||
|
||||
os = XMLChildProperty(OSXML, is_single=True)
|
||||
features = XMLChildProperty(DomainFeatures, is_single=True)
|
||||
@ -306,7 +306,7 @@ class Guest(XMLBuilder):
|
||||
# We do a shallow copy of the OS block here, so that we can
|
||||
# set the install time properties but not permanently overwrite
|
||||
# any config the user explicitly requested.
|
||||
data = self.os
|
||||
data = (self.os, self.on_crash, self.on_reboot)
|
||||
try:
|
||||
self._propstore["os"] = self.os.copy()
|
||||
except:
|
||||
@ -315,7 +315,9 @@ class Guest(XMLBuilder):
|
||||
return data
|
||||
|
||||
def _finish_get_xml(self, data):
|
||||
self._propstore["os"] = data
|
||||
(self._propstore["os"],
|
||||
self.on_crash,
|
||||
self.on_reboot) = data
|
||||
|
||||
def _get_install_xml(self, *args, **kwargs):
|
||||
data = self._prepare_get_xml()
|
||||
@ -347,9 +349,9 @@ class Guest(XMLBuilder):
|
||||
self.installer.alter_bootconfig(self, osblob_install)
|
||||
self._set_transient_device_defaults(install)
|
||||
|
||||
action = install and "destroy" or "restart"
|
||||
self.on_reboot = action
|
||||
self.on_crash = action
|
||||
if install:
|
||||
self.on_reboot = "destroy"
|
||||
self.on_crash = "destroy"
|
||||
|
||||
self._set_osxml_defaults()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user