Example #1
0
def xm_console(args):
    arg_check(args, "console", 1)

    dom = args[0]
    info = server.xend.domain(dom)
    domid = int(sxp.child_value(info, "domid", "-1"))
    console.execConsole(domid)
Example #2
0
def xm_console(args):
    arg_check(args, "console", 1)

    dom = args[0]
    info = server.xend.domain(dom)
    domid = int(sxp.child_value(info, 'domid', '-1'))
    console.execConsole(domid)
Example #3
0
def do_console(domain_name):
    cpid = os.fork() 
    if cpid != 0:
        for i in range(10):
            # Catch failure of the create process 
            time.sleep(1)
            (p, rv) = os.waitpid(cpid, os.WNOHANG)
            if os.WIFEXITED(rv):
                if os.WEXITSTATUS(rv) != 0:
                    sys.exit(os.WEXITSTATUS(rv))
            try:
                domid = domain_name_to_domid(domain_name)
                console.execConsole(domid)
            except:
                pass
        print("Could not start console\n");
        sys.exit(0)
Example #4
0
def do_console(domain_name):
    cpid = os.fork() 
    if cpid != 0:
        for i in range(10):
            # Catch failure of the create process 
            time.sleep(1)
            (p, rv) = os.waitpid(cpid, os.WNOHANG)
            if os.WIFEXITED(rv):
                if os.WEXITSTATUS(rv) != 0:
                    sys.exit(os.WEXITSTATUS(rv))
            try:
                domid = domain_name_to_domid(domain_name)
                console.execConsole(domid)
            except:
                pass
        print("Could not start console\n");
        sys.exit(0)
Example #5
0
def do_console(domain_name):
    cpid = os.fork() 
    if cpid != 0:
        for i in range(10):
            # Catch failure of the create process 
            time.sleep(1)
            (p, rv) = os.waitpid(cpid, os.WNOHANG)
            if os.WIFEXITED(rv):
                if os.WEXITSTATUS(rv) != 0:
                    sys.exit(os.WEXITSTATUS(rv))
            try:
                # Acquire the console of the created dom
                if serverType == SERVER_XEN_API:
                    domid = server.xenapi.VM.get_domid(
                               get_single_vm(domain_name))
                else:
                    dom = server.xend.domain(domain_name)
                    domid = int(sxp.child_value(dom, 'domid', '-1'))
                console.execConsole(domid)
            except:
                pass
        print("Could not start console\n");
        sys.exit(0)
Example #6
0
    if gopts.vals.config:
        config = gopts.vals.config
    else:
        gopts.load_defconfig()
        preprocess(gopts.vals)
        if not gopts.getopt('name') and gopts.getopt('defconfig'):
            gopts.setopt('name', os.path.basename(gopts.getopt('defconfig')))
        config = make_config(gopts.vals)

    return (gopts, config)


def main(argv):
    try:
        (opts, config) = parseCommandLine(argv)
    except StandardError, ex:
        err(str(ex))

    if not opts:
        return

    if opts.vals.dryrun:
        PrettyPrint.prettyprint(config)
    else:
        dom = make_domain(opts, config)
        if opts.vals.console_autoconnect:
            console.execConsole(dom)
        
if __name__ == '__main__':
    main(sys.argv)