[virt-tools-list] [PATCH v3 2/6] Set default action in case of on_crash as destroy

Cole Robinson crobinso at redhat.com
Wed Mar 1 19:24:12 UTC 2017

On 02/21/2017 09:27 AM, Mikhail Feoktistov wrote:
> Virtuozzo hypervisor doesn't support restart on_crash for containers.
> Also for common qemu usage it's not going to have any functional difference.
> ---
>  virtinst/guest.py | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> diff --git a/virtinst/guest.py b/virtinst/guest.py
> index 7d3fb9d..5b8bc7b 100644
> --- a/virtinst/guest.py
> +++ b/virtinst/guest.py
> @@ -198,7 +198,7 @@ class Guest(XMLBuilder):
>      on_poweroff = XMLProperty("./on_poweroff",
>                                default_cb=lambda s: "destroy")
>      on_reboot = XMLProperty("./on_reboot", default_cb=lambda s: "restart")
> -    on_crash = XMLProperty("./on_crash", default_cb=lambda s: "restart")
> +    on_crash = XMLProperty("./on_crash", default_cb=lambda s: "destroy")
>      on_lockfailure = XMLProperty("./on_lockfailure")
>      seclabels = XMLChildProperty(Seclabel)
> @@ -352,7 +352,6 @@ class Guest(XMLBuilder):
>          if install:
>              self.on_reboot = "destroy"
> -            self.on_crash = "destroy"
>          elif self.os.is_s390x():
>              # on_crash=restart can cause reboot loops on s390x,
>              # so use preserve

Thanks for the patch, but after looking more I decided to take it a bit
further and push a more comprehensive change. It contains this change though
so it should fix the vz issue

Working on the rest of your patches now...


commit fc6778108b1ea3f8a178e444fe547e9355a06dd5
Author: Cole Robinson <crobinso at redhat.com>
Date:   Tue Feb 21 17:27:56 2017 +0300

    guest: Don't set any defaults for on_*

    Currently we hardcode these defaults for installing VMs:


    And these for post-install config:


    But this has some issues. on_crash=restart is problematic in that most
    configs don't support it, and some like virtuozzo actively reject it.
    Additionally this we should leave as much to libvirt defaults as we
    can, which are more sensible in this case.

    Drop everything except setting on_reboot=destroy for the install time
    case (which is required for our config changes). Since on_poweroff
    and on_crash already default to 'destroy', the install time config
    is unchanged, and the post-install config now on_crash=destroy instead
    of 'restart'.

    The s390 on_crash=preserve workaround is dropped, which was intended
    to avoid a reboot loop caused by on_crash=reboot

More information about the virt-tools-list mailing list