[OSSTEST,01/38] ts-logs-capture: Cope if xl shutdown leaves domain running for a bit
diff mbox series

Message ID 20200519190230.29519-2-ian.jackson@eu.citrix.com
State New
Headers show
Series
  • Upgrade most hosts/guests to buster
Related show

Commit Message

Ian Jackson May 19, 2020, 7:01 p.m. UTC
This seems mostly to affect buster but it could in principle affect
earlier releases too I think.

In principle it would be nice to fix this bug, and to have a proper
test for it, but a reliable test is hard and an unreliable one is not
useful.  So I guess we are going to have this workaround
indefinitely...

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 ts-logs-capture | 1 +
 1 file changed, 1 insertion(+)

Comments

Jason Andryuk May 28, 2020, 3:30 p.m. UTC | #1
On Tue, May 19, 2020 at 3:03 PM Ian Jackson <ian.jackson@eu.citrix.com> wrote:
>
> This seems mostly to affect buster but it could in principle affect
> earlier releases too I think.
>
> In principle it would be nice to fix this bug, and to have a proper
> test for it, but a reliable test is hard and an unreliable one is not
> useful.  So I guess we are going to have this workaround
> indefinitely...

`xl shutdown -w` waits for either domain shutdown or destruction in
wait_for_domain_deaths()
https://github.com/xen-project/xen/blob/master/tools/xl/xl_vmcontrol.c#L183

My understanding is shutdown happens first when the guest stops and
destruction happens afterward when all the resources are cleaned up.
So your race is that the domain shutdown, but it still shows up in `xl
list` since it hasn't been destroyed.

OpenXT has a hack to only wait for destruction
https://github.com/OpenXT/xenclient-oe/blob/master/recipes-extended/xen/files/xl-shutdown-wait-for-domain-death.patch.
I didn't write it, and the explanation isn't specific, but I think the
purpose is to all resources are released before the OpenXT toolstack
proceeds with (blktap) cleanup.

Maybe a new `xl shutdown` flag to wait for domain destruction would be
worthwhile?

Regards,
Jason
Ian Jackson May 28, 2020, 3:36 p.m. UTC | #2
Jason Andryuk writes ("Re: [OSSTEST PATCH 01/38] ts-logs-capture: Cope if xl shutdown leaves domain running for a bit"):
> My understanding is shutdown happens first when the guest stops and
> destruction happens afterward when all the resources are cleaned up.
> So your race is that the domain shutdown, but it still shows up in `xl
> list` since it hasn't been destroyed.
> 
> OpenXT has a hack to only wait for destruction
> https://github.com/OpenXT/xenclient-oe/blob/master/recipes-extended/xen/files/xl-shutdown-wait-for-domain-death.patch.
> I didn't write it, and the explanation isn't specific, but I think the
> purpose is to all resources are released before the OpenXT toolstack
> proceeds with (blktap) cleanup.
> 
> Maybe a new `xl shutdown` flag to wait for domain destruction would be
> worthwhile?

Yes!  Repeating the -w flag maybe.

Ian.

Patch
diff mbox series

diff --git a/ts-logs-capture b/ts-logs-capture
index 0320a5a5..d75a2fda 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -272,6 +272,7 @@  sub shutdown_guests () {
 		( xl shutdown -a -F -w ; echo y ) &
 	    ) | (
 		read x
+		sleep 10 # xl shutdown is a bit racy :-/
 		xl list | awk '!/^Domain-0 |^Name / {print $2}' \
 		| xargs -t -r -n1 xl destroy ||:
 	    )