Esempio n. 1
0
def validate_args(parser):
    """
    Validate nodeadm arguments. 
    """
    spec     = {} # map of destination option strings and parsed values
    opts     = {} # old map
    opt2spec = {}

    opt_count = client_utils.get_options(spec,opts,opt2spec,parser)

    if (parser.no_args() and not parser.options.list_nstates) or opt_count == 0:
        client_utils.print_usage(parser)
        sys.exit(1)

    impl = client_utils.component_call(SYSMGR, False, 'get_implementation', ())

    # make sure we're on a cluster-system
    if impl not in ['cluster_system', 'alps_system']:
        client_utils.logger.error("nodeadm is only supported on cluster systems.  Try partlist instead.")
        sys.exit(0)

    # Check mutually exclusive options
    mutually_exclusive_option_lists = [['down', 'up', 'list_nstates',
        'list_details', 'queue']]

    if opt_count > 1:
        client_utils.validate_conflicting_options(parser, mutually_exclusive_option_lists)
Esempio n. 2
0
def validate_args(parser):
    """
    Validate nodeadm arguments. 
    """
    spec = {}  # map of destination option strings and parsed values
    opts = {}  # old map
    opt2spec = {}

    opt_count = client_utils.get_options(spec, opts, opt2spec, parser)

    if (parser.no_args()
            and not parser.options.list_nstates) or opt_count == 0:
        client_utils.print_usage(parser)
        sys.exit(1)

    impl = client_utils.component_call(SYSMGR, False, 'get_implementation', ())

    # make sure we're on a cluster-system
    if "cluster_system" != impl:
        client_utils.logger.error(
            "nodeadm is only supported on cluster systems.  Try partlist instead."
        )
        sys.exit(0)

    # Check mutually exclusive options
    mutually_exclusive_option_lists = [['down', 'up', 'list_nstates', 'queue']]

    if opt_count > 1:
        client_utils.validate_conflicting_options(
            parser, mutually_exclusive_option_lists)
Esempio n. 3
0
def validate_args(parser):
    """
    Validate arguments
    """
    spec     = {} 
    opts     = {} 
    opt2spec = {}

    opt_count = client_utils.get_options(spec, opts, opt2spec, parser)

    if opt_count == 0:
        client_utils.print_usage(parser)
        sys.exit(1)

    opts_wo_args = ['list_blocks', 'xml', 'dump', 'savestate', 'boot_stop', 'boot_start', 'boot_status', 'list_io',
                    'autoboot_start', 'autoboot_stop', 'autoboot_status']

    # Make sure jobid or queue is supplied for the appropriate commands
    if parser.no_args() and not [opt for opt in spec if opt in opts_wo_args]:
        client_utils.logger.error("At least one partition must be supplied")
        sys.exit(1)

    # Check mutually exclusive options
    base_list  = ['add', 'delete', 'enable', 'disable', 'activate', 'deactivate', 'fail', 'unfail', 'xml',
                  'savestate', 'list_blocks', 'dump', 'boot_stop', 'boot_start', 'boot_status']
    list_1  = base_list + ['queue'] 
    list_2  = base_list + ['rmq','appq']
    list_3  = ['pg_list', 'blockinfo','clean_block', 'list_blocks', 'rmq','appq']
    list_4  = ['list_io', 'rmq', 'appq']
    
    mux_option_lists = [list_1, list_2, list_3, list_4]

    if opt_count > 1:
        client_utils.validate_conflicting_options(parser, mux_option_lists)
Esempio n. 4
0
def validate_args(parser):
    """
    Validate arguments
    """
    spec = {}
    opts = {}
    opt2spec = {}

    opt_count = client_utils.get_options(spec, opts, opt2spec, parser)

    if opt_count == 0:
        client_utils.print_usage(parser)
        sys.exit(1)

    opts_wo_args = [
        'list_blocks', 'xml', 'dump', 'savestate', 'boot_stop', 'boot_start',
        'boot_status', 'list_io', 'autoboot_start', 'autoboot_stop',
        'autoboot_status'
    ]

    # Make sure jobid or queue is supplied for the appropriate commands
    if parser.no_args() and not [opt for opt in spec if opt in opts_wo_args]:
        client_utils.logger.error("At least one partition must be supplied")
        sys.exit(1)

    # Check mutually exclusive options
    base_list = [
        'add', 'delete', 'enable', 'disable', 'activate', 'deactivate', 'fail',
        'unfail', 'xml', 'savestate', 'list_blocks', 'dump', 'boot_stop',
        'boot_start', 'boot_status'
    ]
    list_1 = base_list + ['queue']
    list_2 = base_list + ['rmq', 'appq']
    list_3 = [
        'pg_list', 'blockinfo', 'clean_block', 'list_blocks', 'rmq', 'appq'
    ]
    list_4 = ['list_io', 'rmq', 'appq']

    mux_option_lists = [list_1, list_2, list_3, list_4]

    if opt_count > 1:
        client_utils.validate_conflicting_options(parser, mux_option_lists)
Esempio n. 5
0
def validate_args(parser, args):
    """
    Validate arguments
    """
    spec = {}
    opts = {}
    opt2spec = {}

    opt_count = client_utils.get_options(spec, opts, opt2spec, parser)

    if opt_count == 0:
        client_utils.print_usage(parser, "No required options provided")
        sys.exit(1)

    # Make sure jobid or queue is supplied for the appropriate commands
    args_opts = [opt for opt in spec if opt in ['adjust', 'dep_frac']]
    if parser.no_args() and args_opts:
        client_utils.logger.error("At least one jobid must be supplied")
        sys.exit(1)

    elif not parser.no_args():
        if not args_opts:
            client_utils.logger.error("No arguments needed")
        else:
            for i in range(len(args)):
                if args[i] == '*':
                    continue
                try:
                    args[i] = int(args[i])
                except ValueError:
                    client_utils.logger.error(
                        "jobid must be an integer, found '%s'" % args[i])
                    sys.exit(1)

    # Check mutually exclusive options
    mutually_exclusive_option_lists = [[
        'stop', 'start', 'stat', 'reread', 'savestate', 'adjust'
    ], ['stop', 'start', 'stat', 'reread', 'savestate', 'dep_frac']]

    if opt_count > 1:
        client_utils.validate_conflicting_options(
            parser, mutually_exclusive_option_lists)
Esempio n. 6
0
def validate_args(parser, args):
    """
    Validate arguments
    """
    spec     = {} 
    opts     = {} 
    opt2spec = {}
    
    opt_count = client_utils.get_options(spec, opts, opt2spec, parser)

    if opt_count == 0:
        client_utils.print_usage(parser, "No required options provided")
        sys.exit(1)

    # Make sure jobid or queue is supplied for the appropriate commands
    args_opts =  [opt for opt in spec if opt in ['adjust','dep_frac']]
    if parser.no_args() and args_opts:
        client_utils.logger.error("At least one jobid must be supplied")
        sys.exit(1)

    elif not parser.no_args():
        if not args_opts:
            client_utils.logger.error("No arguments needed")
        else:
            for i in range(len(args)):
                if args[i] == '*':
                    continue
                try:
                    args[i] = int(args[i])
                except ValueError:
                    client_utils.logger.error("jobid must be an integer, found '%s'" % args[i])
                    sys.exit(1)

    # Check mutually exclusive options
    mutually_exclusive_option_lists = [['stop', 'start', 'stat', 'reread', 'savestate', 'adjust'],
                                       ['stop', 'start', 'stat', 'reread', 'savestate', 'dep_frac']]

    if opt_count > 1:
        client_utils.validate_conflicting_options(parser, mutually_exclusive_option_lists)