Skip to contentSkip to conversation

Fix xm shutdown

PATCH Applied Masaki Kanno 2 participants 4 messages Dec 13, 2005 – Dec 14, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm shutdown

Hi,

This patch adds error message to xm shutdown command.

I ran xm shutdown command specifying Domain-0. (example: xm shutdown 0) However, the error message was not shown.
I think that the error message should be shown.

Best Regards,
Kan

tools/python/xen/xm/shutdown.py Tue Dec 13 13:28:26 2005 renamed from tools/python/xen/xm/shutdown.py Sun Dec 4 19:12:00 2005 +4 -0
diff -r 0255f48b757f tools/python/xen/xm/shutdown.py
@@ -92,6 +92,10 @@
     if len(args) < 1: opts.err('Missing domain')
     dom = args[0]
     mode = shutdown_mode(opts)  
+    dom0_name = sxp.child_value(server.xend_domain(0), 'name')
+    for x in [dom0_name, DOM0_ID]:
+        if x in dom:
+            opts.err("Can't specify Domain-0")
     shutdown(opts, [ dom ], mode, opts.vals.wait)
     
 def main(argv):
#1 lore raw
Quoted 17 lines · Masaki Kanno

Hi,

This patch adds error message to xm shutdown command.

I ran xm shutdown command specifying Domain-0. (example: xm shutdown 0) However, the error message was not shown.
I think that the error message should be shown.

Best Regards,
Kan

diff -r 0255f48b757f tools/python/xen/xm/shutdown.py

tools/python/xen/xm/shutdown.py Tue Dec 13 13:28:26 2005 line 101

Quoted 10 lines
tools/python/xen/xm/shutdown.py Tue Dec 13 13:28:26 2005 renamed from tools/python/xen/xm/shutdown.py Sun Dec 4 19:12:00 2005 +4 -0
@@ -92,6 +92,10 @@
     if len(args) < 1: opts.err('Missing domain')
     dom = args[0]
     mode = shutdown_mode(opts)  
+    dom0_name = sxp.child_value(server.xend_domain(0), 'name')
+    for x in [dom0_name, DOM0_ID]:
+        if x in dom:
+            opts.err("Can't specify Domain-0")
     shutdown(opts, [ dom ], mode, opts.vals.wait)
 
 def main(argv):

I agree that an error message would be better than silently ignoring this. However, your patch now leaves us performing this check twice -- once in main_dom(), and once in shutdown(). Could you not just show the error message if the check fails in shutdown() instead?

Ewan.

#2 lore raw

Hi Ewan,

Thanks for your advice.
I thought that the purpose of checking in shutdown() was for -all option, so I approved twice checking.

The following is new patch.

Best Regards,
Kan

tools/python/xen/xm/shutdown.py Wed Dec 14 10:17:38 2005 renamed from tools/python/xen/xm/shutdown.py Sun Dec 4 19:12:00 2005 +4 -1
diff -r 0255f48b757f tools/python/xen/xm/shutdown.py
@@ -57,7 +57,10 @@
     dom0_name = sxp.child_value(server.xend_domain(0), 'name')
     for x in [dom0_name, DOM0_ID]:
         if x in doms:
-            doms.remove(x)
+            if opts.vals.all:
+                doms.remove(x)
+            else:
+                opts.err("Can't specify Domain-0")
     for d in doms:
         server.xend_domain_shutdown(d, mode)
     if wait:
Quoted 36 lines · Ewan Mellor
Quoted 17 lines · Masaki Kanno

Hi,

This patch adds error message to xm shutdown command.

I ran xm shutdown command specifying Domain-0. (example: xm shutdown 0) However, the error message was not shown.
I think that the error message should be shown.

Best Regards,
Kan

diff -r 0255f48b757f tools/python/xen/xm/shutdown.py

tools/python/xen/xm/shutdown.py Tue Dec 13 13:28:26 2005 line 101

Quoted 10 lines
tools/python/xen/xm/shutdown.py Tue Dec 13 13:28:26 2005 renamed from tools/python/xen/xm/shutdown.py Sun Dec 4 19:12:00 2005 +4 -0
@@ -92,6 +92,10 @@
     if len(args) < 1: opts.err('Missing domain')
     dom = args[0]
     mode = shutdown_mode(opts)  
+    dom0_name = sxp.child_value(server.xend_domain(0), 'name')
+    for x in [dom0_name, DOM0_ID]:
+        if x in dom:
+            opts.err("Can't specify Domain-0")
     shutdown(opts, [ dom ], mode, opts.vals.wait)
 
 def main(argv):

I agree that an error message would be better than silently ignoring this. However, your patch now leaves us performing this check twice -- once in main_dom(), and once in shutdown(). Could you not just show the error message if the check fails in shutdown() instead?

Ewan.

Applied
#3 lore raw
Quoted 10 lines · Masaki Kanno

Hi Ewan,

Thanks for your advice.
I thought that the purpose of checking in shutdown() was for -all option, so I approved twice checking.

The following is new patch.

Best Regards,
Kan

Applied, thank you.

Ewan.