コード例 #1
0
def get_args():
    """Get command line args from the user.
    """

    parser = cli.build_arg_parser()

    parser.add_argument('-v', '--vm_uuid',
                        required=False,
                        action='store',
                        help='Virtual machine uuid')

    parser.add_argument('-n', '--network_name',
                        required=False,
                        action='store',
                        help='Name of the network/portgroup')

    parser.add_argument('-d', '--is_VDS',
                        action="store_true",
                        default=False,
                        help='The provided network is in VSS or VDS')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #2
0
def get_args():
    """Get command line args from the user.
    """

    parser = cli.build_arg_parser()

    parser.add_argument('-v', '--vm_uuid',
                        required=True,
                        action='store',
                        help='Virtual machine uuid')

    parser.add_argument('-r', '--vm_user',
                        required=True,
                        action='store',
                        help='virtual machine user name')

    parser.add_argument('-w', '--vm_pwd',
                        required=False,
                        action='store',
                        help='virtual machine password')

    parser.add_argument('-t', '--path_to_script',
                        required=True,
                        action='store',
                        help='Local path where the script is')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #3
0
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--property', default='runtime.powerState',
                        help='Name of the property to filter by')
    parser.add_argument('-v', '--value', default='poweredOn',
                        help='Value to filter with')
    return cli.prompt_for_password(parser.parse_args())
コード例 #4
0
def get_args():
    """
    Adds additional args for deleting a snapshot of a fcd

    -d datastore
    -v vdisk
    -n snapshot
    -y yes
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-d', '--datastore',
                        required=True,
                        action='store',
                        help='Datastore name where disk is located')

    parser.add_argument('-v', '--vdisk',
                        required=False,
                        action='store',
                        help='First Class Disk name to delete snapshot for')

    # because -s is reserved for 'service', we use -n for snapshot name
    parser.add_argument('-n', '--snapshot',
                        required=True,
                        action='store',
                        help='Snapshot name to be deleted')

    parser.add_argument('-y', '--yes',
                        action='store_true',
                        help='Confirm disk deletion.')

    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #5
0
def get_args():
    """
    Adds additional args for detaching a disk from a vm

    -n vm_name
    -i uuid
    -d disknumber
    -l language
    """
    parser = cli.build_arg_parser()

    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-n', '--vm_name',
                       action='store',
                       help='Virtual Machine name where disk is attached')

    group.add_argument('-i', '--uuid',
                       action='store',
                       help='Virtual Machine UUID where disk is attached')

    parser.add_argument('-d', '--disknumber',
                        required=True,
                        help='HDD number to detach.',
                        type=int)

    parser.add_argument('-l', '--language',
                        default='English',
                        help='Language your vcenter used.')

    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #6
0
def get_args():
    """Get command line args from the user.
    """

    parser = cli.build_arg_parser()

    parser.add_argument('-v', '--vm_uuid',
                        required=False,
                        action='store',
                        help='Virtual machine uuid')

    parser.add_argument('-r', '--vm_user',
                        required=False,
                        action='store',
                        help='virtual machine user name')

    parser.add_argument('-w', '--vm_pwd',
                        required=False,
                        action='store',
                        help='virtual machine password')

    parser.add_argument('-l', '--path_inside_vm',
                        required=False,
                        action='store',
                        help='Path inside VM for upload')

    parser.add_argument('-f', '--upload_file',
                        required=False,
                        action='store',
                        help='Path of the file to be uploaded from host')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #7
0
def get_args():
    """
    Adds additional args for deleting a fcd

    -d datastore
    -v vdisk
    -y yes
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-d', '--datastore',
                        required=True,
                        action='store',
                        help='Datastore name where disk is located')

    parser.add_argument('-v', '--vdisk',
                        required=True,
                        action='store',
                        help='First Class Disk name to be deleted')

    parser.add_argument('-y', '--yes',
                        action='store_true',
                        help='Confirm disk deletion.')

    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #8
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-v', '--vm_name',
                        required=True,
                        action='store',
                        help='Name of the new VM')

    parser.add_argument('--template_name',
                        required=True,
                        action='store',
                        help='Name of the template/VM you are cloning from')

    parser.add_argument('--datacenter_name',
                        required=False,
                        action='store',
                        default=None,
                        help='Name of the Datacenter you wish to use.')

    parser.add_argument('--cluster_name',
                        required=False,
                        action='store',
                        default=None,
                        help='Name of the cluster you wish to use')

    parser.add_argument('--host_name',
                        required=False,
                        action='store',
                        default=None,
                        help='Name of the cluster you wish to use')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #9
0
def get_args():
    """Get command line args from the user.
    """

    parser = cli.build_arg_parser()

    parser.add_argument('-v', '--vm_uuid',
                        required=False,
                        action='store',
                        help='Virtual machine uuid')

    parser.add_argument('-r', '--vm_user',
                        required=False,
                        action='store',
                        help='virtual machine user name')

    parser.add_argument('-w', '--vm_pwd',
                        required=False,
                        action='store',
                        help='virtual machine password')

    parser.add_argument('-l', '--path_to_program',
                        required=False,
                        action='store',
                        help='Path inside VM to the program')

    parser.add_argument('-f', '--program_arguments',
                        required=False,
                        action='store',
                        help='Program command line options')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #10
0
def setup_args():
    """
    Get standard connection arguments
    """
    parser = cli.build_arg_parser()
    my_args = parser.parse_args()

    return cli.prompt_for_password(my_args)
コード例 #11
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n',
                        '--vmname',
                        required=False,
                        help="Name of the VirtualMachine you want to change.")
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #12
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n',
                        '--name',
                        required=False,
                        help="Name of the Datastore.")
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #13
0
def setup_args():

    """
    Get standard connection arguments
    """
    parser = cli.build_arg_parser()
    my_args = parser.parse_args()

    return cli.prompt_for_password(my_args)
コード例 #14
0
def setup_args():
    """
    Adds additional args to allow the vm uuid to
    be set.
    """
    parser = cli.build_arg_parser()
    parser.add_argument('--vm-name', help="Name of the virtual machine.")
    parser.add_argument('--ignition-config', help="Path to ignition config.")
    return cli.prompt_for_password(parser.parse_args())
コード例 #15
0
ファイル: getallvms.py プロジェクト: liuyongliu2000/PyCtrlVm
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-f', '--find',
                        required=False,
                        action='store',
                        help='String to match VM names')
    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #16
0
def get_args():
    """
    Use the tools.cli methods and then add a few more arguments.
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-c', '--count',
                        type=int,
                        required=True,
                        action='store',
                        help='Number of VMs to create')

    parser.add_argument('-d', '--datastore',
                        required=True,
                        action='store',
                        help='Name of Datastore to create VM in')

    parser.add_argument('--datacenter',
                        required=True,
                        help='Name of the datacenter to create VM in.')

    parser.add_argument('--folder',
                        required=True,
                        help='Name of the vm folder to create VM in.')

    parser.add_argument('--resource-pool',
                        required=True,
                        help='Name of resource pool to create VM in.')

    parser.add_argument('--opaque-network',
                        help='Name of the opaque network to add to the new VM')

    # NOTE (hartsock): as a matter of good security practice, never ever
    # save a credential of any kind in the source code of a file. As a
    # matter of policy we want to show people good programming practice in
    # these samples so that we don't encourage security audit problems for
    # people in the future.

    parser.add_argument('-k', '--public_key_file',
                        required=False,
                        action='store',
                        help='Name of the file holding your marvel public key,'
                             ' the key should be the first only of the file. '
                             'Set one up at developer.marvel.com/account')

    parser.add_argument('-e', '--private_key_file',
                        required=False,
                        action='store',
                        help='Name of the file holding your marvel private '
                             'key, the key should be the only line of the '
                             'file. '
                             'Set one up at developer.marvel.com/account')

    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #17
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--vmname', required=True,
                        help="Name of the VirtualMachine you want to change.")
    parser.add_argument('-m', '--unitnumber', required=True,
                        help='NIC number.', type=int)
    parser.add_argument('-t', '--state', required=True,
                        choices=['delete', 'disconnect', 'connect'])
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #18
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--vmname', required=True,
                        help="Name of the VirtualMachine you want to change.")
    parser.add_argument('-m', '--unitnumber', required=True,
                        help='NIC number.', type=int)
    parser.add_argument('-t', '--state', required=True,
                        choices=['delete', 'disconnect', 'connect'])
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #19
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--vmname', required=True,
                        help="Name of the VirtualMachine you want to change.")
    parser.add_argument('-m', '--unitnumber', required=True,
                        help='HDD number to delete.', type=int)
    parser.add_argument('-y', '--yes',
                        help='Confirm disk deletion.', action='store_true')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #20
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--vmname', required=True,
                        help="Name of the VirtualMachine you want to change.")
    parser.add_argument('-m', '--unitnumber', required=True,
                        help='HDD number to delete.', type=int)
    parser.add_argument('-y', '--yes',
                        help='Confirm disk deletion.', action='store_true')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #21
0
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--name',
                        help='Name of the VM to test CD-rom on')
    parser.add_argument('-i', '--iso',
                        help='ISO to use in test. Use datastore path format. '
                              'E.g. [datastore1] path/to/file.iso')
    parser.add_argument('-d', '--datacenter',
                        help='Name of datacenter to search on. '
                             'Defaults to first.')
    return cli.prompt_for_password(parser.parse_args())
コード例 #22
0
ファイル: filter_vms.py プロジェクト: liuyongliu2000/PyCtrlVm
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n',
                        '--property',
                        default='runtime.powerState',
                        help='Name of the property to filter by')
    parser.add_argument('-v',
                        '--value',
                        default='poweredOn',
                        help='Value to filter with')
    return cli.prompt_for_password(parser.parse_args())
コード例 #23
0
def setup_args():
    """
    Adds additional args to allow the vm uuid to
    be set.
    """
    parser = cli.build_arg_parser()
    # using j here because -u is used for user
    parser.add_argument('-j', '--uuid',
                        required=True,
                        help='UUID of the VirtualMachine you want to reboot.')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #24
0
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--name',
                        help='Name of the VM for relocate events')
    parser.add_argument('-d', '--datacenter',
                        help='Name of datacenter to search on. '
                             'Defaults to first.')
    parser.add_argument('--filterUsers',
                        help="Comma-separated list of users to filter on")
    parser.add_argument('--filterSystemUser', action='store_true',
                        help="Filter system user, defaults to false.")
    return cli.prompt_for_password(parser.parse_args())
コード例 #25
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--vmname', required=True,
                        help="Name of the VirtualMachine you want to change.")
    parser.add_argument('-m', '--unitnumber', required=True,
                        help='CD/DVD unit number.', type=int)
    parser.add_argument('-i', '--iso', required=False,
                        help='Full path to iso. i.e. "[ds1] folder/Ubuntu.iso"'
                             ' If not provided, backend will'
                             ' set to RemotePassThrough')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #26
0
def get_args():
    parser = cli.build_arg_parser()

    parser.add_argument('-v',
                        '--vswitch',
                        type=str,
                        action='store',
                        help='standard vSwitch name for creation',
                        required=True)
    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #27
0
def get_args():
    """
    Adds additional args for creating a fcd from a snapshot

    -d source_datastore
    -v source_vdisk
    -n snapshot
    -D dest_datastore
    -V dest_vdisk
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-d',
                        '--source_datastore',
                        required=True,
                        action='store',
                        help='Datastore name where source disk is located')

    parser.add_argument('-v',
                        '--source_vdisk',
                        required=True,
                        action='store',
                        help='First Class Disk name with specified snapshot')

    # because -s is reserved for 'service', we use -n for snapshot name
    parser.add_argument('-n',
                        '--snapshot',
                        required=True,
                        action='store',
                        help='Snapshot name to be cloned')

    parser.add_argument('-D',
                        '--dest_datastore',
                        required=True,
                        action='store',
                        help='Datastore name where new disk is located')

    parser.add_argument('-V',
                        '--dest_vdisk',
                        required=True,
                        action='store',
                        help='First Class Disk name to be created')

    # because -s is reserved for 'service' and -p is reserved for 'password'
    parser.add_argument('-e',
                        '--policy',
                        action='store',
                        help='Storage Policy name for new disk. If unset, '
                        'the default policy of the datastore specified '
                        'will apply.')

    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #28
0
def setup_args():
    """
    Adds additional args to allow the vm uuid to
    be set.
    """
    parser = cli.build_arg_parser()
    # using j here because -u is used for user
    parser.add_argument('-j', '--uuid',
                        required=True,
                        help='UUID of the VirtualMachine you want to reboot.')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #29
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n', '--vmname', required=True,
                        help="Name of the VirtualMachine you want to change.")
    parser.add_argument('-m', '--unitnumber', required=True,
                        help='CD/DVD unit number.', type=int)
    parser.add_argument('-i', '--iso', required=False,
                        help='Full path to iso. i.e. "[ds1] folder/Ubuntu.iso"'
                             ' If not provided, backend will'
                             ' set to RemotePassThrough')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #30
0
def get_args():
    """
    Add VM name to args
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-n', '--name',
                        required=True,
                        help='Name of Virtual Machine.')

    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #31
0
def get_args():
    """
    Adds additional args for listing all fcd

    -d datastore
    """
    parser = cli.build_arg_parser()
    parser.add_argument('-d', '--datastore',
                        required=True,
                        action='store',
                        help='Datastore name where disk is located')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #32
0
def setup_args():
    """
    Get standard connection arguments
    """
    parser = cli.build_arg_parser()
    parser.add_argument(
        '-f',
        '--folder',
        default='',
        help='Folder name of the VirtualMachine you want to shutdown.')
    my_args = parser.parse_args()

    return cli.prompt_for_password(my_args)
コード例 #33
0
def setup_args():
    parser = cli.build_arg_parser()
    # parser.add_argument('-j', '--uuid', required=False,
    #                     help="UUID of the VirtualMachine you want to find."
    #                          " If -i is not used BIOS UUID assumed.")
    # parser.add_argument('-i', '--instance', required=False,
    #                     action='store_true',
    #                     help="Flag to indicate the UUID is an instance UUID")
    parser.add_argument('-n', '--name', 
                        required=False,
                        action='store',
                        help="name of VirtualMachine")
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #34
0
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('--ova-path',
                        help='Path to the OVA file, can be local or a URL.')
    parser.add_argument('-d', '--datacenter',
                        help='Name of datacenter to search on. '
                             'Defaults to first.')
    parser.add_argument('-r', '--resource-pool',
                        help='Name of resource pool to use. '
                             'Defaults to largest memory free.')
    parser.add_argument('-ds', '--datastore',
                        help='Name of datastore to use. '
                             'Defaults to largest free space in datacenter.')
    return cli.prompt_for_password(parser.parse_args())
コード例 #35
0
def setup_args():
    """
    Adds additional ARG to allow the uuid to be set.
    """
    parser = cli.build_arg_parser()
    # using j here because -u is used for user
    parser.add_argument('-j', '--uuid',
                        help='UUID of the HostSystem you want to find'
                             ' duplicate of if not looking for the default'
                             ' Dell UUID: 44454C4C-0000-1020-8020-80C04F202020')

    my_args = parser.parse_args()

    return cli.prompt_for_password(my_args)
コード例 #36
0
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n',
                        '--name',
                        help='Name of the VM to test CD-rom on')
    parser.add_argument('-i',
                        '--iso',
                        help='ISO to use in test. Use datastore path format. '
                        'E.g. [datastore1] path/to/file.iso')
    parser.add_argument('-d',
                        '--datacenter',
                        help='Name of datacenter to search on. '
                        'Defaults to first.')
    return cli.prompt_for_password(parser.parse_args())
コード例 #37
0
def get_args():
    """
    Adds additional args for retrieving a port group

    -pg portgroupname
    """
    parser = cli.build_arg_parser()

    # because -p is reserved for 'password'
    parser.add_argument('-pg', '--portgroupname',
                        required=True,
                        help="Name of the port group")
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #38
0
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-j', '--uuid', required=True,
                        help="UUID of the VirtualMachine you want to find."
                             " If -i is not used BIOS UUID assumed.")
    parser.add_argument('-i', '--instance', required=False,
                        action='store_true',
                        help="Flag to indicate the UUID is an instance UUID")
    parser.add_argument('-d', '--description', required=False,
                        help="Description for the snapshot")
    parser.add_argument('-n', '--name', required=True,
                        help="Name for the Snapshot")
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #39
0
ファイル: set_note_R.py プロジェクト: wuwentao1998/CloudTides
def setup_args():
    """
    Adds additional args to allow the vm uuid to
    be set.
    """
    parser = cli.build_arg_parser()
    # using j here because -u is used for user
    parser.add_argument('-i',
                        '--ip',
                        required=False,
                        action='store',
                        help='IP address of the VM to search for')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #40
0
def get_args():
    """
    Add VM name to args
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-n',
                        '--name',
                        required=True,
                        help='Name of Virtual Machine.')

    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #41
0
def setup_args():
    """
    Adds additional ARG to allow the uuid to be set.
    """
    parser = cli.build_arg_parser()
    # using j here because -u is used for user
    parser.add_argument('-j',
                        '--uuid',
                        help='UUID of the HostSystem you want to find'
                        ' duplicate of if not looking for the default'
                        ' Dell UUID: 44454C4C-0000-1020-8020-80C04F202020')

    my_args = parser.parse_args()

    return cli.prompt_for_password(my_args)
コード例 #42
0
def get_args():
    """
    Adds additional args for the Dvs portgroup configuration
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-ds', '--dvs-name',
                        required=True,
                        help=' Name of the distributed virtual switch')

    parser.add_argument('-pg', '--dvs-pg-name',
                        required=True,
                        help="Name of the distributed port group")
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #43
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-d', '--uuid',
                        required=True,
                        action='store',
                        help='Instance UUID of the VM to look for.')
    parser.add_argument('-n', '--name',
                        required=False,
                        action='store',
                        help='The ovf:id to use for the top-level OVF Entity.')
    parser.add_argument('-w', '--workdir',
                        required=True,
                        action='store',
                        help='Working directory. Must have write permission.')
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #44
0
def get_args():
    """Get command line args from the user.
    """

    parser = cli.build_arg_parser()

    parser.add_argument('-a',
                        '--action',
                        required=True,
                        action='store',
                        help='Virtual machine action: start, stop or suspend')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #45
0
def get_args():
    """
    Adds additional args for creating a fcd

    -d datastore
    -n name
    -c capacityInGB
    -e policy
    -k keepAfterDeleteVm
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-d',
                        '--datastore',
                        required=True,
                        action='store',
                        help='Datastore name where disk is located')

    parser.add_argument('-n',
                        '--name',
                        required=True,
                        action='store',
                        help='First Class Disk name to be created')

    parser.add_argument('-c',
                        '--capacityInGB',
                        required=True,
                        action='store',
                        help='Size in GB of the First Class Disk.',
                        type=int)

    # because -s is reserved for 'service' and -p is reserved for 'password'
    parser.add_argument('-e',
                        '--policy',
                        action='store',
                        help='Storage Policy name. If unset, the default '
                        'policy of the datastore specified will apply.')

    parser.add_argument('-k',
                        '--keepAfterDeleteVm',
                        action='store_true',
                        help='Keep after VM deletion. Choice of the '
                        'deletion behavior of this virtual storage object. '
                        'If not set, the default value is false.')

    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #46
0
def get_args():
    """Supports the command-line arguments listed below.
    """
    parser = cli.build_arg_parser()
    parser.description = 'Show VM Home and Virtual Disk Storage Policies'
    parser.add_argument('-v',
                        '--vm_name',
                        required=True,
                        action='store',
                        metavar='string',
                        help='Get virtual machine by name')
    parser.add_argument('--strict',
                        required=False,
                        action='store_true',
                        help='Search strict virtual machine name matches')
    args = parser.parse_args()
    return cli.prompt_for_password(args)
コード例 #47
0
def get_args():
    """Get command line args from the user.
    """

    parser = cli.build_arg_parser()

    parser.add_argument('-v',
                        '--vm_uuid',
                        required=False,
                        action='store',
                        help='Virtual machine uuid')

    parser.add_argument('-i',
                        '--ip',
                        required=False,
                        action='store',
                        help='IP address of the VM to search for')

    parser.add_argument('-r',
                        '--vm_user',
                        required=False,
                        action='store',
                        help='virtual machine user name')

    parser.add_argument('-w',
                        '--vm_pwd',
                        required=False,
                        action='store',
                        help='virtual machine password')

    parser.add_argument('-l',
                        '--path_to_program',
                        required=False,
                        action='store',
                        help='Path inside VM to the program')

    parser.add_argument('-f',
                        '--program_arguments',
                        required=False,
                        action='store',
                        help='Program command line options')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #48
0
def setup_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-n',
                        '--property',
                        default='runtime.powerState',
                        help='Name of the property to filter by')
    parser.add_argument('-v',
                        '--value',
                        default='poweredOn',
                        help='Value to filter with')
    parser.add_argument('-mem_threshold_percent',
                        '--mem_threshold_percent',
                        help='Set your desired memory threshold from 0-20')
    parser.add_argument('-secure',
                        '--secure',
                        help='Set S if you want to connect securely')
    return cli.prompt_for_password(parser.parse_args())
コード例 #49
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument('-d', '--datastore',
                        required=True,
                        action='store',
                        help='Datastore name')
    parser.add_argument('-l', '--local_file',
                        required=True,
                        action='store',
                        help='Local disk path to file')
    parser.add_argument('-r', '--remote_file',
                        required=True,
                        action='store',
                        help='Path on datastore to place file')
    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #50
0
def get_args():
    """
    Use the tools.cli methods and then add a few more arguments.
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-c',
                        '--count',
                        type=int,
                        required=True,
                        action='store',
                        help='Number of VMs to create')

    parser.add_argument('-d',
                        '--datastore',
                        required=True,
                        action='store',
                        help='Name of Datastore to create VM in')

    # NOTE (hartsock): as a matter of good security practice, never ever
    # save a credential of any kind in the source code of a file. As a
    # matter of policy we want to show people good programming practice in
    # these samples so that we don't encourage security audit problems for
    # people in the future.

    parser.add_argument('-k',
                        '--public_key_file',
                        required=False,
                        action='store',
                        help='Name of the file holding your marvel public key,'
                        ' the key should be the first only of the file. '
                        'Set one up at developer.marvel.com/account')

    parser.add_argument('-e',
                        '--private_key_file',
                        required=False,
                        action='store',
                        help='Name of the file holding your marvel private '
                        'key, the key should be the only line of the '
                        'file. '
                        'Set one up at developer.marvel.com/account')

    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #51
0
def get_args():
    """
    Use the tools.cli methods and then add a few more arguments.
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-d',
                        '--datastore',
                        required=True,
                        action='store',
                        help='Name of Datastore to create VM in')

    parser.add_argument('-cs',
                        '--sockets',
                        required=True,
                        action='store',
                        help='Numbers of CPU sockets')

    parser.add_argument('-c',
                        '--cores',
                        required=True,
                        action='store',
                        help='Numbers of core by CPUs sockets')

    parser.add_argument('-m',
                        '--memory',
                        required=True,
                        action='store',
                        help='Memory size in MB')

    parser.add_argument('-n',
                        '--name',
                        required=True,
                        action='store',
                        help='VM name')

    parser.add_argument('-v',
                        '--vlan',
                        required=True,
                        action='store',
                        help='Name of VLAN')

    args = parser.parse_args()

    return cli.prompt_for_password(args)
コード例 #52
0
def setup_args():
    """Adds additional ARGS to allow the vm name or uuid to
    be set.
    """
    parser = cli.build_arg_parser()
    # using j here because -u is used for user
    parser.add_argument('-j', '--uuid',
                        help='UUID of the VirtualMachine you want to reboot.')
    parser.add_argument('-n', '--name',
                        help='DNS Name of the VirtualMachine you want to '
                             'reboot.')
    parser.add_argument('-i', '--ip',
                        help='IP Address of the VirtualMachine you want to '
                             'reboot')

    my_args = parser.parse_args()

    return cli.prompt_for_password(my_args)
コード例 #53
0
def get_args():
    """Get command line args from the user.
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-v', '--vm_name',
                        required=True,
                        action='store',
                        help='Virtual machine name')

    parser.add_argument('-n', '--network_name',
                        required=True,
                        action='store',
                        help='Name of the portgroup or NSX-T Logical Switch')

    args = parser.parse_args()

    cli.prompt_for_password(args)
    return args
コード例 #54
0
def get_args():
    """
    Adds additional args for the vMotion
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-dd', '--datastore-dest',
                        required=False,
                        help=' Datastore of the destination')

    parser.add_argument('-t', '--target-esx-host',
                        required=False,
                        help="name of the destination esx host")

    parser.add_argument('-v', '--vm-name',
                        required=True,
                        help="name of the vm")
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #55
0
def get_args():
    parser = cli.build_arg_parser()
    parser.add_argument("-v", "--vmname", required=True, help="Name of the VirtualMachine you want to change.")
    parser.add_argument("-d", "--disk-number", required=True, help="Disk number to change mode.")
    parser.add_argument(
        "-m",
        "--mode",
        required=True,
        choices=[
            "independent_persistent",
            "persistent",
            "independent_nonpersistent",
            "nonpersistent",
            "undoable",
            "append",
        ],
    )
    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #56
0
def get_args():
    """
    Adds additional args for creating a fcd

    -d datastore
    -n name
    -c capacityInGB
    -e policy
    -k keepAfterDeleteVm
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-d', '--datastore',
                        required=True,
                        action='store',
                        help='Datastore name where disk is located')

    parser.add_argument('-n', '--name',
                        required=True,
                        action='store',
                        help='First Class Disk name to be created')

    parser.add_argument('-c', '--capacityInGB',
                        required=True,
                        action='store',
                        help='Size in GB of the First Class Disk.',
                        type=int)

    # because -s is reserved for 'service' and -p is reserved for 'password'
    parser.add_argument('-e', '--policy',
                        action='store',
                        help='Storage Policy name. If unset, the default '
                        'policy of the datastore specified will apply.')

    parser.add_argument('-k', '--keepAfterDeleteVm',
                        action='store_true',
                        help='Keep after VM deletion. Choice of the '
                        'deletion behavior of this virtual storage object. '
                        'If not set, the default value is false.')

    my_args = parser.parse_args()
    return cli.prompt_for_password(my_args)
コード例 #57
0
ファイル: create_vm.py プロジェクト: aidevnet/vmware
def get_args():
    """
    Use the tools.cli methods and then add a few more arguments.
    """
    parser = cli.build_arg_parser()

    parser.add_argument('-c', '--count',
                        type=int,
                        required=True,
                        action='store',
                        help='Number of VMs to create')

    parser.add_argument('-d', '--datastore',
                        required=True,
                        action='store',
                        help='Name of Datastore to create VM in')

    args = parser.parse_args()

    return cli.prompt_for_password(args)