diff --git a/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml b/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml index 7a55b464c..bf557a892 100644 --- a/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml +++ b/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml @@ -17,7 +17,7 @@ - destroy + restart destroy destroy @@ -60,9 +60,9 @@ - destroy - restart - restart + restart + destroy + preserve /bin/qemu-system-aarch64 diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml index 11e838172..68fa6bfd4 100644 --- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml +++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml @@ -189,7 +189,7 @@ destroy restart - restart + preserve /virtualmachines/production diff --git a/tests/clitest.py b/tests/clitest.py index 6fe131051..7e23ca074 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -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 diff --git a/virtinst/guest.py b/virtinst/guest.py index 8891cec82..f8d86d110 100644 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -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()