This patch fixes a typo in xm''s main.py. This fixes the exception thrown when doing, for example, "xm domid" on a non-existent domain. Signed-off-by: Dan Smith <danms@us.ibm.com> -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christian Limpach
2005-Aug-24 08:29 UTC
Re: [Xen-devel] [PATCH] fix error handler index in xm
Thanks! On 8/23/05, Dan Smith <danms@us.ibm.com> wrote:> This patch fixes a typo in xm''s main.py. This fixes the exception > thrown when doing, for example, "xm domid" on a non-existent domain. > > Signed-off-by: Dan Smith <danms@us.ibm.com> > > > > > -- > Dan Smith > IBM Linux Technology Center > Open Hypervisor Team > email: danms@us.ibm.com > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christian Limpach
2005-Aug-24 15:48 UTC
Re: [Xen-devel] [PATCH] fix error handler index in xm
On 8/23/05, Dan Smith <danms@us.ibm.com> wrote:> This patch fixes a typo in xm''s main.py. This fixes the exception > thrown when doing, for example, "xm domid" on a non-existent domain.I''ve reverted this check-in because with the change applied, the error messages are incorrect: moonbase-0:~# xm destroy vm7 Error: Domain ''bogus'' not found when running ''xm destroy'' Please provide before/after examples when sending patches to the tools. christian _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
CL> I''ve reverted this check-in because with the change applied, the
CL> error messages are incorrect:
Ok, so the problem is rooted in the way the args list is manipulated
in the subcommand handlers. As it stands now (without the patch),
some commands give a good error message, while others dump a stack
trace if the domain doesn''t exist:
# xm destroy foo
Error: Domain ''foo'' not found when running ''xm
destroy''
# xm domid foo
Traceback (most recent call last):
File "/usr/sbin/xm", line 10, in ?
main.main(sys.argv)
File "/usr/lib/python/xen/xm/main.py", line 671, in main
handle_xend_error(argv[1], args[1], ex)
IndexError: list index out of range
This is because destroy adds "bogus" into the args list at index 0,
but domid does not. I''ve attached a new patch that checks for this
condition, and removes the "bogus" entry from the list if the
subcommand added it. This makes the call to handle_xend_error() work
in both situations:
# xm destroy foo
Error: Domain ''foo'' not found when running ''xm
destroy''
# xm domid foo
Error: Domain ''foo'' not found when running ''xm
domid''
Is that an acceptable solution for now? Perhaps a cleanup of the
inconsistent subcommand handler behavior is in order. I can do that
when I start work on the remaining interface changes.
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@us.ibm.com
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Christian Limpach
2005-Aug-25 09:56 UTC
Re: [Xen-devel] [PATCH] fix error handler index in xm
On Wed, Aug 24, 2005 at 10:07:22AM -0700, Dan Smith wrote:> CL> I''ve reverted this check-in because with the change applied, the > CL> error messages are incorrect: > > Ok, so the problem is rooted in the way the args list is manipulated > in the subcommand handlers. As it stands now (without the patch), > some commands give a good error message, while others dump a stack > trace if the domain doesn''t exist:Ah, ok.> This is because destroy adds "bogus" into the args list at index 0, > but domid does not. I''ve attached a new patch that checks for this > condition, and removes the "bogus" entry from the list if the > subcommand added it. This makes the call to handle_xend_error() work > in both situations: > > # xm destroy foo > Error: Domain ''foo'' not found when running ''xm destroy'' > # xm domid foo > Error: Domain ''foo'' not found when running ''xm domid'' > > Is that an acceptable solution for now? Perhaps a cleanup of the > inconsistent subcommand handler behavior is in order. I can do that > when I start work on the remaining interface changes.Yes, I''ve checked this in for now, but making the subcommand handler behavious consistent would be good. christian _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel