Skip to content

Commit

Permalink
Adjust and increase timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
dehesselle committed Mar 13, 2019
1 parent e65d55c commit 42bf776
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ ExecStartPre=/usr/bin/bash -c 'COUNT=0; while [ $COUNT -le 10 ]; do ((COUNT++));
# Create the domain.
ExecStart=/usr/bin/virsh create ${DOMAIN_DIR}/%i.xml
# Provide a (optional) post-start functionality. Allowed to fail.
ExecStartPost=-/usr/bin/timeout -k 10 60 bash -c '[ -f ${FUNCTIONS} ] && source ${FUNCTIONS} ExecStartPost || :'
ExecStartPost=-/usr/bin/timeout -k 10 50 bash -c '[ -f ${FUNCTIONS} ] && source ${FUNCTIONS} ExecStartPost || :'
# This first ExecStop acts as substitute for the non-existing "ExecStopPre".
# It is required because we have post-stop actions that actually need to run
# while the domain is still running. Allowed to fail.
ExecStop=-/usr/bin/timeout -k 10 60 bash -c '[ -f ${FUNCTIONS} ] && source ${FUNCTIONS} ExecStopPre; [ "$(type -t virtctl_stoppre)" = "function" ] && virtctl_stoppre || :'
ExecStop=-/usr/bin/timeout -k 10 50 bash -c '[ -f ${FUNCTIONS} ] && source ${FUNCTIONS} ExecStopPre; [ "$(type -t virtctl_stoppre)" = "function" ] && virtctl_stoppre || :'
# Shutdown the domain gracefully by sending ACPI shutdown event.
ExecStop=/usr/bin/bash -c 'COUNT=0; while [ $COUNT -le 45 ]; do STATE=$(virsh domstate %i 2>&1); if [ "$STATE" = "running" ]; then [ $(($COUNT % 15)) -eq 0 ] && virsh shutdown %i; ((COUNT++)); elif [ "$STATE" = "shut off" ] || [ "${STATE::27}" = "error: failed to get domain" ]; then exit 0; fi; sleep 1; done; exit 1'
ExecStop=/usr/bin/bash -c 'COUNT=0; while [ $COUNT -le 60 ]; do STATE=$(virsh domstate %i 2>&1); if [ "$STATE" = "running" ]; then [ $(($COUNT % 15)) -eq 0 ] && virsh shutdown %i; ((COUNT++)); elif [ "$STATE" = "shut off" ] || [ "${STATE::27}" = "error: failed to get domain" ]; then exit 0; fi; sleep 1; done; exit 1'
# Provide a (optional) post-stop functionality per domain. Not allowed to fail
# because it doesn't make a difference at this point.
ExecStopPost=/usr/bin/bash -c '[ -f ${FUNCTIONS} ] && source ${FUNCTIONS} ExecStopPost || :'
# Set higher timeouts to allow for Exec commands to take longer.
TimeoutStartSec=80
TimeoutStopSec=80
TimeoutStartSec=90
TimeoutStopSec=180

[Install]
WantedBy=hypervisor.target
Expand Down

0 comments on commit 42bf776

Please sign in to comment.