direct-io.hg

annotate tools/python/xen/xm/console.py @ 11572:ad22c711ccb7

[XM] Error handling cleanup

Introducing an OptionError exception to be used by all xm subcommands
to signal an error in the arguments. "xm" will catch these and output
the appropriate error and usage message.

Detailed Changes:

main.py:
* Cleaned up imports and moved warning filter outside of
import block.
* Converted usage parameters and description to a python
dict rather than strings to enable better usage help
formatting.
* Removed unused list_label domain command.
* Added cmdHelp() prints out usage message for any command
* Added shortHelp() prints out the default help message when
xm is invoked with no arguments.
* Added longHelp() prints out long help message when invoked
with xm --help or xm help.
* Added extra optional paramter to getDomains() so we can
tell Xend not to poll devices. This will speed up xm list.
(PENDING changes to Xend itself.)
* Changed all references where 'dom' actually means 'domid'
to use the correct name.
* Changed 'xm list' header format to use printf formatting style.
* Renamed xm_subcommand to xm_importcommand so it is more
clear what it is doing (all xm commands are subcommands!)
* Moved cpu_make_map() inside xm_vcpu_pin as an anonymous func.
* Use OptionError whenever an invalid option is detected in xm.
* Added proper catch and error printing for XendError and
OptionErrors in main().

addlabel.py:
cfgbootpolicy.py:
dry-run.py:
dump-policy.py:
get-label.py:
labels.py:
loadpolicy.py:
makepolicy.py:
rmlabel.py:
resources.py:
* Replaced usage() with help() that is called from main.py
* Replaced usage() invokation with raising OptionError

opts.py:
* Added very simple wrap() function that behaves differently
to textwrap.wrap()
* Added OptionError()
* Replaced the string representation of Opt, Opts to output
a nicely formatted usage message.
* Changed class Opts itself will throw approriate OptionErrors.
* Changed set_bool to recognise 'y' and 'n' as valid input

create.py:
* Some whitespace and column width cleanup.
* throws OptionError if encounters option error.

migrate.py:
* Replace usage() message with the string representation of
gopts.

sysrq.py:
* Replace usage message with throwing OptionErrors

Signed-off-by: Alastair Tse <atse@xensource.com>
author atse@norwich.uk.xensource.com
date Fri Sep 22 11:37:31 2006 +0100 (2006-09-22)
parents 713328270fb3
children
rev   line source
emellor@7312 1 #============================================================================
emellor@7312 2 # This library is free software; you can redistribute it and/or
emellor@7312 3 # modify it under the terms of version 2.1 of the GNU Lesser General Public
emellor@7312 4 # License as published by the Free Software Foundation.
emellor@7312 5 #
emellor@7312 6 # This library is distributed in the hope that it will be useful,
emellor@7312 7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
emellor@7312 8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
emellor@7312 9 # Lesser General Public License for more details.
emellor@7312 10 #
emellor@7312 11 # You should have received a copy of the GNU Lesser General Public
emellor@7312 12 # License along with this library; if not, write to the Free Software
emellor@7312 13 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
emellor@7312 14 #============================================================================
emellor@7312 15 # Copyright (C) 2005 XenSource Ltd
emellor@7312 16 #============================================================================
emellor@7312 17
emellor@7312 18
emellor@7312 19 XENCONSOLE = "xenconsole"
emellor@7312 20
emellor@7312 21 import xen.util.auxbin
emellor@7312 22
emellor@7312 23 def execConsole(domid):
emellor@7312 24 xen.util.auxbin.execute(XENCONSOLE, [str(domid)])