Skip to contentSkip to conversation

arm-autonomy/xenguest-init: fix guest shutdown issues after host reboot

PATCH Applied Kamil Dziezyk 2 participants 4 messages Nov 13, 2020 – Nov 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm-autonomy/xenguest-init: fix guest shutdown issues after host reboot

This patch contain following changes:
* xenguest-init stop action uses now blocking call,
and additional 'xl destroy guest' call if normal shutdown has failed.
* xenguest-init stop action stops only running guest.
* xenguest-init script is now caled before xen-tools scripts on host shutdown or reboot.
* xenguest-network-bridge script is now called before ifupdown script on host shutdown or reboot.

Change-Id: I46e307fd0ad36b2e35559b4e8a071be9bbc50e34
Issue-Id: SCM-1632

---
 .../recipes-extended/xenguest/files/xenguest-init             | 4 +++-
 .../recipes-extended/xenguest/xenguest-manager.bb             | 3 ++-
 .../recipes-extended/xenguest/xenguest-network.bb             | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)
meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-init +3 -1
index cd249cf..d580908 100755
@@ -65,8 +65,10 @@ case "$1" in
         ;;
   stop)
         echo "Stopping xenguest"
+        # update guest list
+        guestlist=$(xenguest-manager status | grep Running | cut -d ":" -f1)
         for f in ${guestlist}; do
-            /usr/bin/xenguest-manager stop ${f}
+            xl shutdown -w ${f} || xl destroy ${f}
         done
         ;;
   reload)
meta-arm-autonomy/recipes-extended/xenguest/xenguest-manager.bb +2 -1
index bd7963f..9c29bde 100644
@@ -21,8 +21,9 @@ XENGUEST_MANAGER_VOLUME_NAME ?= "vg-xen"
 XENGUEST_MANAGER_GUEST_DIR ?= "${datadir}/guests/"
 
 # We add an init script to create and start guests automatically
+# run start script after xen-tools and run stop script before xen-tools
 INITSCRIPT_NAME = "xenguest"
-INITSCRIPT_PARAMS = "defaults 90"
+INITSCRIPT_PARAMS = "start 90 2 3 4 5 . stop 79 0 1 6 ."
 
 inherit update-rc.d
 
meta-arm-autonomy/recipes-extended/xenguest/xenguest-network.bb +2 -1
index d0517b6..9464d43 100644
@@ -29,9 +29,10 @@ PACKAGES =+ "${PN}-kea-dhcp4"
 
 # Bridge configurator needs to run before S01networking init script
 # Prefix with a_ to make sure it is executed in runlevel 01 before others
+# run start script before ifupdown and run stop script after ifupdown
 INITSCRIPT_PACKAGES = "${PN} ${PN}-kea-dhcp4"
 INITSCRIPT_NAME_${PN} = "a_xenguest-network-bridge"
-INITSCRIPT_PARAMS_${PN} = "defaults 01"
+INITSCRIPT_PARAMS_${PN} = "start 01 2 3 4 5 . stop 81 0 1 6 ."
 
 # Kea configuration needs to be restored before kea init scripts:
 # Kea dhcp4 server is 30, so lets use 20, to have higher priority
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 9 lines · Kamil Dziezyk

This patch contain following changes:
* xenguest-init stop action uses now blocking call,
and additional 'xl destroy guest' call if normal shutdown has failed.
* xenguest-init stop action stops only running guest.
* xenguest-init script is now caled before xen-tools scripts on host shutdown or reboot.
* xenguest-network-bridge script is now called before ifupdown script on host shutdown or reboot.

Quoted 3 lines

Change-Id: I46e307fd0ad36b2e35559b4e8a071be9bbc50e34
Issue-Id: SCM-1632

Applied to master.

Thanks,
Jon

Quoted 60 lines
---
 .../recipes-extended/xenguest/files/xenguest-init             | 4 +++-
 .../recipes-extended/xenguest/xenguest-manager.bb             | 3 ++-
 .../recipes-extended/xenguest/xenguest-network.bb             | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)
meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-init +3 -1
index cd249cf..d580908 100755
@@ -65,8 +65,10 @@ case "$1" in
         ;;
   stop)
         echo "Stopping xenguest"
+        # update guest list
+        guestlist=$(xenguest-manager status | grep Running | cut -d ":" -f1)
         for f in ${guestlist}; do
-            /usr/bin/xenguest-manager stop ${f}
+            xl shutdown -w ${f} || xl destroy ${f}
         done
         ;;
   reload)
meta-arm-autonomy/recipes-extended/xenguest/xenguest-manager.bb +2 -1
index bd7963f..9c29bde 100644
@@ -21,8 +21,9 @@ XENGUEST_MANAGER_VOLUME_NAME ?= "vg-xen"
 XENGUEST_MANAGER_GUEST_DIR ?= "${datadir}/guests/"
 
 # We add an init script to create and start guests automatically
+# run start script after xen-tools and run stop script before xen-tools
 INITSCRIPT_NAME = "xenguest"
-INITSCRIPT_PARAMS = "defaults 90"
+INITSCRIPT_PARAMS = "start 90 2 3 4 5 . stop 79 0 1 6 ."
 
 inherit update-rc.d
 
meta-arm-autonomy/recipes-extended/xenguest/xenguest-network.bb +2 -1
index d0517b6..9464d43 100644
@@ -29,9 +29,10 @@ PACKAGES =+ "${PN}-kea-dhcp4"
 
 # Bridge configurator needs to run before S01networking init script
 # Prefix with a_ to make sure it is executed in runlevel 01 before others
+# run start script before ifupdown and run stop script after ifupdown
 INITSCRIPT_PACKAGES = "${PN} ${PN}-kea-dhcp4"
 INITSCRIPT_NAME_${PN} = "a_xenguest-network-bridge"
-INITSCRIPT_PARAMS_${PN} = "defaults 01"
+INITSCRIPT_PARAMS_${PN} = "start 01 2 3 4 5 . stop 81 0 1 6 ."
 
 # Kea configuration needs to be restored before kea init scripts:
 # Kea dhcp4 server is 30, so lets use 20, to have higher priority
Signature · 1 line
2.17.1
#3 lore raw
Quoted 1 line · Kamil Dziezyk

Can you backport this change to gatesgarth?

Done

Quoted 3 lines