コード例 #1
0
def instance_create(args):
    driver = virtdeploy.get_driver(DRIVER)
    instance = driver.instance_create(args.id, args.template)

    print('name: {0}'.format(instance['name']))
    print('root password: {0}'.format(instance['password']))
    print('mac address: {0}'.format(instance['mac']))
    print('hostname: {0}'.format(instance['hostname']))
    print('ip address: {0}'.format(instance['ipaddress']))
コード例 #2
0
ファイル: cli.py プロジェクト: jaryn/virt-deploy
def instance_create(args):
    driver = virtdeploy.get_driver(DRIVER)
    instance = driver.instance_create(args.id, args.template)

    print('name: {0}'.format(instance['name']))
    print('root password: {0}'.format(instance['password']))
    print('mac address: {0}'.format(instance['mac']))
    print('hostname: {0}'.format(instance['hostname']))
    print('ip address: {0}'.format(instance['ipaddress']))
コード例 #3
0
def instance_start(args):
    driver = virtdeploy.get_driver(DRIVER)
    driver.instance_start(args.name)

    if args.wait:
        address_found = utils.wait_tcp_access(driver, args.name)
        if address_found is None:
            return EXITCODE_TIMEOUT

    return EXITCODE_SUCCESS
コード例 #4
0
ファイル: cli.py プロジェクト: jaryn/virt-deploy
def instance_start(args):
    driver = virtdeploy.get_driver(DRIVER)
    driver.instance_start(args.name)

    if args.wait:
        address_found = utils.wait_tcp_access(driver, args.name)
        if address_found is None:
            return EXITCODE_TIMEOUT

    return EXITCODE_SUCCESS
コード例 #5
0
def command_ssh(args):
    driver = virtdeploy.get_driver(DRIVER)

    command = [
        'ssh', '-A', '-o', 'StrictHostKeychecking=no', '-o',
        'UserKnownHostsFile=/dev/null', '-o', 'LogLevel=QUIET'
    ]

    user, _, name = args.name.rpartition('@')

    if user:
        command.extend(('-l', user))

    command.append(driver.instance_address(name)[0])
    command.extend(args.arguments)

    return subprocess.call(command)
コード例 #6
0
ファイル: cli.py プロジェクト: jaryn/virt-deploy
def command_ssh(args):
    driver = virtdeploy.get_driver(DRIVER)

    command = ['ssh', '-A',
               '-o', 'StrictHostKeychecking=no',
               '-o', 'UserKnownHostsFile=/dev/null',
               '-o', 'LogLevel=QUIET']

    user, _, name = args.name.rpartition('@')

    if user:
        command.extend(('-l', user))

    command.append(driver.instance_address(name)[0])
    command.extend(args.arguments)

    return subprocess.call(command)
コード例 #7
0
def instance_address(args):
    driver = virtdeploy.get_driver(DRIVER)
    print('\n'.join(driver.instance_address(args.name)))
コード例 #8
0
def template_list(args):
    driver = virtdeploy.get_driver(DRIVER)
    for template in driver.template_list():
        print(u'{0:24}{1:24}'.format(template['id'], template['name']))
コード例 #9
0
def instance_delete(args):
    driver = virtdeploy.get_driver(DRIVER)
    return driver.instance_delete(args.name)
コード例 #10
0
ファイル: cli.py プロジェクト: jaryn/virt-deploy
def instance_address(args):
    driver = virtdeploy.get_driver(DRIVER)
    print('\n'.join(driver.instance_address(args.name)))
コード例 #11
0
ファイル: cli.py プロジェクト: jaryn/virt-deploy
def template_list(args):
    driver = virtdeploy.get_driver(DRIVER)
    for template in driver.template_list():
        print(u'{0:24}{1:24}'.format(template['id'], template['name']))
コード例 #12
0
ファイル: cli.py プロジェクト: jaryn/virt-deploy
def instance_delete(args):
    driver = virtdeploy.get_driver(DRIVER)
    return driver.instance_delete(args.name)
コード例 #13
0
ファイル: fabfile.py プロジェクト: dsevost/fabric-scripts
def vm_hosts(*hosts):
    """
    specify the instance names instead of hosts
    """
    driver = virtdeploy.get_driver('libvirt')
    env.hosts.extend((driver.instance_address(x)[0] for x in hosts))