• Leigh B. Stoller's avatar
    Converted os_load and node_reboot into libraries. Basically that meant · 9bfe3d61
    Leigh B. Stoller authored
    splitting the existing code between a frontend script that parses arguments
    and does taint checking, and a backend library where all the work is done
    (including permission checks). The interface to the libraries is simple
    right now (didn't want to spend a lot of time on designing interface
    without knowing if the approach would work long term).
    	use libreboot;
    	use libosload;
            nodereboot(\%reboot_args, \%reboot_results);
            osload(\%reload_args, \%reload_results);
    Arguments are passed to the libraries in the form of a hash. For example,
    in os_setup:
    	$reload_args{'debug'}     = $dbg;
    	$reload_args{'asyncmode'} = 1;
    	$reload_args{'imageid'}   = $imageid;
    	$reload_args{'nodelist'}  = [ @nodelist ];
    Results are passed back both as a return code (-1 means total failure right
    away, while a positive argument indicates the number of nodes that failed),
    and in the results hash which gives the status for each individual node. At