Skip to contentSkip to conversation

Fix xm shutdown for xendomains

PATCH New Masaki Kanno 1 participant 1 message Apr 8, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm shutdown for xendomains

Hi,

When I tested xm shutdown command with a domain name, xm shutdown command waited for a shutdown completion of a guest OS as I had expected. But, when I tested xm shutdown command with a domain ID, xm shutdown command did not wait for it.

Domain name:

 # time xm shutdown vm1 --wait
 Domain vm1 terminated
 All domains terminated
 real    0m21.093s
 user    0m0.490s
 sys     0m0.090s
 # xm list
 Name                                        ID   Mem VCPUs      State   Time(s)
 Domain-0                                     0   743     2     r-----    272.6

Domain ID:

 # time xm shutdown 9 --wait
 Domain 9 terminated
 All domains terminated
 real    0m1.551s
 user    0m0.410s
 sys     0m0.060s
 # xm list
 Name                                        ID   Mem VCPUs      State   Time(s)
 Domain-0                                     0   743     2     r-----    262.3
 vm1                                          9   256     1     r-----     34.1

I think that this problem has an impact to shutting down guest OSes by xendomains because xendomains uses xm shutdown command with the domain ID. Guest OSes may be not shut down as expected because xm shutdown command is executed twice in the short term as follows.

 # service xendomains stop
 Shutting down Xen domains: vm1(shut).Domain 7 terminated
 All domains terminated
  SHUTDOWN_ALL ...Domain vm1 terminated
 All domains terminated
 /etc/init.d/xendomains: line 318:  6736 Terminated              watchdog_xm shutdown
 /etc/init.d/xendomains: line 318:  6768 Terminated              watchdog_xm shutdown 1

This patch solves the problem. Even if xm shutdown command with the domain ID, xm shutdown command waits for the shutdown completion of guest OSes.

 # time xm shutdown 11 --wait
 Domain vm1 terminated
 All domains terminated
 real    0m21.678s
 user    0m0.540s
 sys     0m0.030s
 # service xendomains stop
 Shutting down Xen domains: vm1(shut)............Domain vm1 terminated
 All domains terminated
 /etc/init.d/xendomains: line 280:  8236 Terminated              watchdog_xm shutdown
 /etc/init.d/xendomains: line 318:  8236 Terminated              watchdog_xm shutdown

Best regards,
Kan

tools/python/xen/xm/shutdown.py +1 -1
diff -r db943e8d1051 tools/python/xen/xm/shutdown.py
@@ -144,7 +144,7 @@ def main_dom(opts, args):
 def main_dom(opts, args):
     if len(args) == 0: opts.err('No domain parameter given')
     if len(args) >  1: opts.err('No multiple domain parameters allowed')
-    dom = args[0]
+    dom = sxp.child_value(server.xend.domain(args[0]), 'name')
     if serverType == SERVER_XEN_API:
         dom = get_single_vm(dom)
     mode = shutdown_mode(opts)  

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel