示例#1
0
def volume():
    data = request.body.read()
    volume = json.loads(data)['volume_name']

    # Get connection and log into OneView
    con = ov.connection(oneview_server)
    login = {'userName':username,'password':password}
    con.login(login)

    # Get access to storage resources
    storage = ov.storage(con)
    pools = storage.get_storage_pools()
    for pool in pools['members']:

        # Find specified storage pool
        if pool['name'] == storage_pool:
            storagePoolUri = pool['uri']
            newvolume = ov.common.make_storage_volume(volume,
                                                 102410241024,
                                                 True,
                                                 storagePoolUri,
                                                 'Created via script',
                                                 'thin')
            result = storage.add_storage_volume(newvolume)

    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.status = 200
    print json.dumps({'state': result['state']})
    return json.dumps({'state': result['state']})
示例#2
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Display Connectable Volume Templates

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HP OneView Authorized Login Domain''')

    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    getconvol(sto)
def main():
    parser = argparse.ArgumentParser(add_help=True, description='Usage')
    parser.add_argument('-a', '--appliance', dest='host', required=True,
                        help='HP OneView Appliance hostname or IP')
    parser.add_argument('-u', '--user', dest='user', required=False,
                        default='Administrator', help='HP OneView Username')
    parser.add_argument('-p', '--pass', dest='passwd', required=False,
                        help='HP OneView Password')
    parser.add_argument('-c', '--certificate', dest='cert', required=False,
                        help='Trusted SSL Certificate Bundle in PEM '
                        '(Base64 Encoded DER) Format')
    parser.add_argument('-r', '--proxy', dest='proxy', required=False,
                        help='Proxy (host:port format')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    getconvol(sto)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Display Storage Systems

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-n', dest='name',
                       help='''
    Name of the storage system to get''')
    group.add_argument('-s', dest='serialNo',
                       help='''
    Serial number of the storage system to get''')
    group.add_argument('-g', dest='get',
                       action='store_true',
                       help='''
    Get all storage systems''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.name:
        get_storage_system_by_name(sto, args.name)
        sys.exit()

    if args.serialNo:
        get_storage_system_by_serial(sto, args.serialNo)
        sys.exit()

    if args.get:
        get_all_storage_systems(sto)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Delete individual or ALL Storage Pools

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-s', dest='sto_name',
                       help='''
    Name of storage system. This option requires the pool name option "-n"
    to be specified''')
    group.add_argument('-d', dest='delete_all',
                       action='store_true',
                       help='''
    Remove ALL storage pools and exit''')
    parser.add_argument('-n', dest='pool_name', required=False,
                        help='''
    Storage pool name''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.sto_name:
        if args.pool_name:
            del_pool_by_name(sto, args.sto_name, args.pool_name)
        else:
            print ('Storage system MUST be accompanied by storage pool name')
        sys.exit()

    if args.delete_all:
        del_all_pools(sto)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Delete individual or ALL Storage Pools

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-s', dest='sto_name',
                       help='''
    Name of storage system. This option requires the pool name option "-n"
    to be specified''')
    group.add_argument('-d', dest='delete_all',
                       action='store_true',
                       help='''
    Remove ALL storage pools and exit''')
    parser.add_argument('-n', dest='pool_name', required=False,
                        help='''
    Storage pool name''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.sto_name:
        if args.pool_name:
            del_pool_by_name(sto, args.sto_name, args.pool_name)
        else:
            print ('Storage system MUST be accompanied by storage pool name')
        sys.exit()

    if args.delete_all:
        del_all_pools(sto)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Add new Storage Pools (i.e. HPE 3PAR Common Provisioning Group [CPG]) for
    volumes to be provisioned from.  The Storage System must be imported
    prior to adding Storage Pools.

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-sp', dest='pool_name', required=True,
                        help='''
    Storage Pool Name''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-ss', dest='sto_name',
                        help='''
    Name of the Storage System to use''')
    group.add_argument('-f', dest='first_avaliable',
                        action='store_true',
                        help='''
    Use the first avaliable storage system''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_storage_pool(sto, args.pool_name, args.sto_name, args.first_avaliable)
示例#8
0
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Delete individual or ALL Volumes

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HP OneView Authorized Login Domain''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-n', dest='name',
                       help='''
    Name of the storage volume to delete''')
    group.add_argument('-d', dest='delete_all',
                       action='store_true',
                       help='''
                       Remove ALL storage volumes and exit''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.delete_all:
        del_all_volumes(sto)
        sys.exit()

    del_volume_by_name(sto, args.name)
示例#9
0
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Display Volumes

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-n', dest='name',
                       help='''
    Name of the storage volume to get''')
    group.add_argument('-g', dest='get_all',
                       action='store_true',
                       help='''
                       Get ALL storage volumes and exit''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.get_all:
        get_all_volumes(sto)
        sys.exit()

    get_volume_by_name(sto, args.name)
def main():
    parser = argparse.ArgumentParser(add_help=True, description='Usage')
    parser.add_argument('-a', '--appliance', dest='host', required=True,
                        help='HP OneView Appliance hostname or IP')
    parser.add_argument('-u', '--user', dest='user', required=False,
                        default='Administrator', help='HP OneView Username')
    parser.add_argument('-p', '--pass', dest='passwd', required=False,
                        help='HP OneView Password')
    parser.add_argument('-c', '--certificate', dest='cert', required=False,
                        help='Trusted SSL Certificate Bundle in PEM '
                        '(Base64 Encoded DER) Format')
    parser.add_argument('-r', '--proxy', dest='proxy', required=False,
                        help='Proxy (host:port format')
    parser.add_argument('-su', '--sto_user', dest='stousr', required=False,
                        help='Administrative username for the storage system')
    parser.add_argument('-sp', '--sto_pass', dest='stopass', required=False,
                        help='Administrative password for the storage system')
    parser.add_argument('-sd', '--sto_dom', dest='stodom', required=False, default='NewDomain',
                        help='Storage Domain on the storage system')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-s', dest='storage',
                       help='IP address of the storage system to add')
    group.add_argument('-d', dest='delete',
                       action='store_true', help='Remove ALL storage systems and exit')
    group.add_argument('-g', dest='get',
                       action='store_true', help='Get storage systems and exit')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.get:
        getsto(sto)
        sys.exit()

    if args.delete:
        delsto(sto)
        sys.exit()

    addsto(sto, args.storage, args.stousr, args.stopass, args.stodom)
示例#11
0
def main():
    parser = argparse.ArgumentParser(add_help=True, description='Usage')
    parser.add_argument('-a', '--appliance', dest='host', required=True,
                        help='HP OneView Appliance hostname or IP')
    parser.add_argument('-u', '--user', dest='user', required=False,
                        default='Administrator', help='HP OneView Username')
    parser.add_argument('-p', '--pass', dest='passwd', required=False,
                        help='HP OneView Password')
    parser.add_argument('-c', '--certificate', dest='cert', required=False,
                        help='Trusted SSL Certificate Bundle in PEM '
                        '(Base64 Encoded DER) Format')
    parser.add_argument('-r', '--proxy', dest='proxy', required=False,
                        help='Proxy (host:port format')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-n', dest='name',
                       help='Name of the storage volume to add')
    group.add_argument('-d', dest='delete',
                       action='store_true', help='Remove ALL storage volumes and exit')
    group.add_argument('-g', dest='get',
                       action='store_true', help='Get storage volumes and exit')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.get:
        getsto(sto)
        sys.exit()

    if args.delete:
        delsto(sto)
        sys.exit()

    addsto(sto, args.name)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Display Connectable Volume Templates

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    getconvol(sto)
示例#13
0
def volume():
    count = 0

    # Get connection and log into OneView
    con = ov.connection(oneview_server)
    login = {'userName':username,'password':password}
    con.login(login)

    # Get access to storage resources
    storage = ov.storage(con)
    pools = storage.get_storage_pools()
    for pool in pools['members']:

        # Find specified storage pool
        if pool['name'] == storage_pool:
            existing_volumes = storage.get_storage_volumes()

    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.status = 200
    print json.dumps({'count': existing_volumes['count']})
    return json.dumps({'count': existing_volumes['count']})
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Import a supported Storage System. In order for the Storage Ports to be
    mapped to Expected Networks, either a Supported SAN Manager will need to
    be configured, or 3PAR Direct Attach networks will have to exist.

    When adding supported HP 3PAR storage systems, please make sure
    "startwsapi" has been executed from the HP 3PAR CLI, which enables the
    HP 3PAR REST API that is required by HP OneView.

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HP OneView Authorized Login Domain''')
    parser.add_argument('-sh', dest='storage', required=True,
                        help='''
    IP address of the storage system to add''')
    parser.add_argument('-su', dest='stousr', required=False,
                        help='''
    Administrative username for the storage system''')
    parser.add_argument('-sp', dest='stopass', required=False,
                        help='''
    Administrative password for the storage system''')
    parser.add_argument('-sd', dest='stodom', required=True,
                        help='''
    Storage Domain on the storage system''')
    parser.add_argument('-ip',  dest='import_pools', required=False,
                        default=False, action='store_true',
                        help='''
    Import all of the storage pools from the array''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_storage_system(sto, args.storage, args.stousr, args.stopass,
                       args.stodom, args.import_pools)
示例#15
0
parser.add_argument('--ov-password', help='OneView password',
    dest='oneview_password', default='HPEnet123')
parser.add_argument('--storage-pool', help='Storage pool name',
    dest='storage_pool', default='CPG-SSD')
parser.add_argument('--volumes', help='Volumes to be created',
    dest='volumes', nargs='+', required=True)

args = parser.parse_args()

# Get connection and log into OneView
con = ov.connection(args.oneview_server)
login = {'userName':args.oneview_user,'password':args.oneview_password}
con.login(login)

# Get access to storage resources
storage = ov.storage(con)
pools = storage.get_storage_pools()
for pool in pools['members']:

    # Find specified storage pool
    if pool['name'] == args.storage_pool:
        storagePoolUri = pool['uri']
        existing_volumes = storage.get_storage_volumes()

        # Loop throw volumes specified in input
        for vol in args.volumes:

            # Loop throw existing volumes
            for existing_volume in existing_volumes['members']:

                # Is this volume we want to remove?
示例#16
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Display Storage Systems

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-n',
                       dest='name',
                       help='''
    Name of the storage system to get''')
    group.add_argument('-s',
                       dest='serialNo',
                       help='''
    Serial number of the storage system to get''')
    group.add_argument('-g',
                       dest='get',
                       action='store_true',
                       help='''
    Get all storage systems''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.name:
        get_storage_system_by_name(sto, args.name)
        sys.exit()

    if args.serialNo:
        get_storage_system_by_serial(sto, args.serialNo)
        sys.exit()

    if args.get:
        get_all_storage_systems(sto)
示例#17
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Add new Storage Pools (i.e. HPE 3PAR Common Provisioning Group [CPG]) for
    volumes to be provisioned from.  The Storage System must be imported
    prior to adding Storage Pools.

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-sp',
                        dest='pool_name',
                        required=True,
                        help='''
    Storage Pool Name''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-ss',
                       dest='sto_name',
                       help='''
    Name of the Storage System to use''')
    group.add_argument('-f',
                       dest='first_avaliable',
                       action='store_true',
                       help='''
    Use the first avaliable storage system''')

    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_storage_pool(sto, args.pool_name, args.sto_name, args.first_avaliable)
示例#18
0
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Define a OneView SAN Storage connection list for use with defining a
    server profile with managed SAN storage connections.

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-sl', dest='san_list',
                        required=True,
                        help='''
    Name of file for SAN storage list''')
    parser.add_argument('-cl', dest='conn_list',
                        required=True,
                        help='''
    Name of server profile connection list file to import''')
    parser.add_argument('-app', dest='append',
                        required=False,
                        action='store_true',
                        help='''
    Causes SAN list to be appended to the file''')
    parser.add_argument('-o', dest='hostos',
                        required=True,
                        choices=['CitrixXen', 'AIX', 'IBMVIO', 'RHEL4',
                                 'RHEL3', 'RHEL', 'RHEV', 'VMware', 'Win2k3',
                                 'Win2k8', 'Win2k12', 'OpenVMS', 'Egenera',
                                 'Exanet', 'Solaris9', 'Solaris10',
                                 'Solaris11', 'ONTAP', 'OEL', 'HPUX11iv1',
                                 'HPUX11iv2', 'HPUX11iv3', 'SUSE', 'SUSE9',
                                 'Inform'],
                        help='''
    Specify the Host OS type, which will set the Host OS value when HP OneView
    created the Host object on the Storage System. Accepted values:

         . CitrixXen = "Citrix Xen Server 5.x/6.x"
         . AIX       = "AIX"
         . IBMVIO    = "IBM VIO Server"
         . RHEL4     = "RHE Linux (Pre RHEL 5)"
         . RHEL3     = "RHE Linux (Pre RHEL 5)"
         . RHEL      = "RHE Linux (5.x, 6.x)"
         . RHEV      = "RHE Virtualization (5.x, 6.x)"
         . VMware    = "ESX 4.x/5.x"
         . Win2k3    = "Windows 2003"
         . Win2k8    = "Windows 2008/2008 R2"
         . Win2k12   = "Windows 2012 / WS2012 R2"
         . OpenVMS   = "OpenVMS"
         . Egenera   = "Egenera"
         . Exanet    = "Exanet"
         . Solaris9  = "Solaris 9/10"
         . Solaris10 = "Solaris 9/10"
         . Solaris11 = "Solaris 11"
         . ONTAP     = "NetApp/ONTAP"
         . OEL       = "OE Linux UEK (5.x, 6.x)"
         . HPUX11iv1 = "HP-UX (11i v1, 11i v2)"
         . HPUX11iv2 = "HP-UX (11i v1, 11i v2)"
         . HPUX11iv3 = "HP-UX (11i v3)"
         . SUSE      = "SuSE (10.x, 11.x)"
         . SUSE9     = "SuSE Linux (Pre SLES 10)"
         . Inform    = "InForm"

    ''')
    parser.add_argument('-n', dest='name', required=True,
                        help='''
    Name of the exsisting storage volume to attach''')
    parser.add_argument('-l', dest='lun_id', required=False,
                        type=int,
                        help='''
    Manual entry for the LUN number. Auto, will be used if this
    value is not specified.''')
    parser.add_argument('-del', dest='del_vol', required=False,
                        action='store_false',
                        help='''
    Indicates that the volume will be deleted when the profile is deleted.''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.lun_id:
        if args.lun_id < 0 or args.lun_id > 255:
            print('Error: boot lun value must be between 0 and 255')
            sys.exit(1)

    define_san(sto, args.name, args.san_list, args.conn_list, args.append,
               args.hostos, args.lun_id, args.del_vol)
示例#19
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
   Copy Server Profile

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 EncodedDER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-n',
                        dest='name',
                        required=True,
                        help='''
    Name of the source server profile''')
    parser.add_argument('-d',
                        dest='dest',
                        required=True,
                        help='''
    Name of the destination  server profile''')
    parser.add_argument('-f',
                        dest='forcePowerOff',
                        required=False,
                        action='store_true',
                        help='''
    When set, forces power off of target server.
    Avoids error exit if server is up''')
    parser.add_argument('-s',
                        dest='server_id',
                        required=True,
                        help='''
    Destination  Server identification. There are multiple ways to specify
    the server id:

    . Hostname or IP address of the stand-alone server iLO
    . Server Hardware name of a server than has already been imported
      into HPE OneView and is listed under Server Hardware
    . "UNASSIGNED" for creating an unassigned Server Profile''')
    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    srv = hpov.servers(con)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
        if args.cert:
            con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    server, sht = get_server(con, srv, args.server_id, args.forcePowerOff,
                             args.name)
    copy_profile(con, srv, sto, args.name, args.dest, server, sht)
示例#20
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Display Server Profiles

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 EncodedDER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-n',
                        dest='name',
                        required=True,
                        help='''
    Name of the source server profile''')
    parser.add_argument('-d',
                        dest='dest',
                        required=True,
                        help='''
    Name of the destination  server profile''')
    parser.add_argument('-f',
                        dest='forcePowerOff',
                        required=False,
                        action='store_true',
                        help='''
    When set, forces power off of target server.
    Avoids error exit if server is up''')
    parser.add_argument('-s',
                        dest='server_id',
                        required=True,
                        help='''
    Destinatly Server identification. There are multiple ways to specify
    the server id:

    . Hostname or IP address of the stand-alone server iLO
    . Server Hardware name of a server than has already been imported
      into HP OneView and is listed under Server Hardware
    . "UNASSIGNED" for creating an unassigned Server Profile''')
    parser.add_argument('-sh',
                        dest='server_hwt',
                        required=False,
                        help='''
    Server harware type is required for defining an unassigned profile. Note
    the Server Hardware Type must be present in the HP OneView appliance
    before it can be uesd. For example, a sngle server with the specific server
    hardware type must have been added to OneView for that hardware type to
    be used. The example script get - server - hardware - types.py with the - l
    arguement can be used to get a list of server hardware types that have
    been imported into the OneView appliance''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    srv = hpov.servers(con)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
        if args.cert:
            con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.server_id.upper() == 'UNASSIGNED' and not args.server_hwt:
        print('Error: Server Hardware Type must be specified when defining an'
              'unassigned server profile')
        sys.exit()

    server, sht = get_server(con, srv, args.server_id, args.server_hwt,
                             args.forcePowerOff)
    copy_profile(con, srv, sto, args.name, args.dest, server, sht)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                                     formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
   Copy Server Profile

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 EncodedDER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-n', dest='name', required=True,
                        help='''
    Name of the source server profile''')
    parser.add_argument('-d', dest='dest', required=True,
                        help='''
    Name of the destination  server profile''')
    parser.add_argument('-f', dest='forcePowerOff',
                        required=False,
                        action='store_true',
                        help='''
    When set, forces power off of target server.
    Avoids error exit if server is up''')
    parser.add_argument('-s', dest='server_id', required=True,
                        help='''
    Destination  Server identification. There are multiple ways to specify
    the server id:

    . Hostname or IP address of the stand-alone server iLO
    . Server Hardware name of a server than has already been imported
      into HP OneView and is listed under Server Hardware
    . "UNASSIGNED" for creating an unassigned Server Profile''')
    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    srv = hpov.servers(con)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
        if args.cert:
            con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    server, sht = get_server(con, srv, args.server_id, args.forcePowerOff,
                             args.name)
    copy_profile(con, srv, sto, args.name, args.dest, server, sht)
示例#22
0
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Provision a new storage volume from the managed Storage System.

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-n', dest='name',
                        required=True,
                        help='''
    Name of the storage volume to add''')
    parser.add_argument('-sp', dest='sto_pool',
                        required=True,
                        help='''
    Name of the storage pool to use''')
    parser.add_argument('-cap', dest='size',
                        required=True,
                        help='''
    Size of volume in GiB''')
    parser.add_argument('-sh', dest='shareable',
                        required=False,
                        default=False,
                        action='store_true',
                        help='''
    sets volume to shareable, omit for private''')
    parser.add_argument('-pt', dest='provType',
                        required=False,
                        default='Thin',
                        help='''
    Thin or Full provisioning''')
    parser.add_argument('-des', dest='desc',
                        required=False,
                        default='Example Volume',
                        help='''
    Description of volume''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_volume(sto, args.name, args.sto_pool, args.size, args.shareable,
               args.desc, args.provType)
示例#23
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Import a supported Storage System. In order for the Storage Ports to be
    mapped to Expected Networks, either a Supported SAN Manager will need to
    be configured, or 3PAR Direct Attach networks will have to exist.

    When adding supported HPE 3PAR storage systems, please make sure
    "startwsapi" has been executed from the HPE 3PAR CLI, which enables the
    HPE 3PAR REST API that is required by HPE OneView.

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-sh',
                        dest='storage',
                        required=True,
                        help='''
    IP address of the storage system to add''')
    parser.add_argument('-su',
                        dest='stousr',
                        required=False,
                        help='''
    Administrative username for the storage system''')
    parser.add_argument('-sp',
                        dest='stopass',
                        required=False,
                        help='''
    Administrative password for the storage system''')
    parser.add_argument('-sd',
                        dest='stodom',
                        required=True,
                        help='''
    Storage Domain on the storage system''')
    parser.add_argument('-ip',
                        dest='import_pools',
                        required=False,
                        default=False,
                        action='store_true',
                        help='''
    Import all of the storage pools from the array''')

    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_storage_system(sto, args.storage, args.stousr, args.stopass,
                       args.stodom, args.import_pools)
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description="""
    Add/Create a new storage pool resource

    Usage: """,
    )
    parser.add_argument(
        "-a",
        dest="host",
        required=True,
        help="""
    HP OneView Appliance hostname or IP address""",
    )
    parser.add_argument(
        "-u",
        dest="user",
        required=False,
        default="Administrator",
        help="""
    HP OneView Username""",
    )
    parser.add_argument(
        "-p",
        dest="passwd",
        required=True,
        help="""
    HP OneView Password""",
    )
    parser.add_argument(
        "-c",
        dest="cert",
        required=False,
        help="""
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format""",
    )
    parser.add_argument(
        "-y",
        dest="proxy",
        required=False,
        help="""
    Proxy (host:port format""",
    )
    parser.add_argument(
        "-n",
        dest="name",
        required=True,
        help="""
    Name of the volume template to add""",
    )
    parser.add_argument(
        "-sp",
        dest="sto_pool",
        required=True,
        help="""
    Name of the storage pool to add template to""",
    )
    parser.add_argument(
        "-cap",
        dest="size",
        required=True,
        help="""
    Size of volume template in GiB""",
    )
    parser.add_argument(
        "-sh",
        dest="shareable",
        required=False,
        default=False,
        action="store_true",
        help="""
    sets template to shareable, omit for private""",
    )
    parser.add_argument(
        "-pt",
        dest="provType",
        required=False,
        default="Thin",
        help="""
    Thin or Full provisioning""",
    )
    parser.add_argument(
        "-des",
        dest="desc",
        required=False,
        default="Example Volume Template",
        help="""
    Description of template""",
    )
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument(
        "-ss",
        dest="sto_sys",
        help="""
    Name of the Storage System to use""",
    )
    group.add_argument(
        "-f",
        dest="first_avaliable",
        action="store_true",
        help="""
    Use the first avaliable storage system""",
    )

    args = parser.parse_args()
    credential = {"userName": args.user, "password": args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(":")[0], args.proxy.split(":")[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_vol_template(
        sto,
        args.name,
        args.sto_sys,
        args.sto_pool,
        args.size,
        args.shareable,
        args.desc,
        args.provType,
        args.first_avaliable,
    )
示例#25
0
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description='''
    Provision a new storage volume from the managed Storage System.

    Usage: ''')
    parser.add_argument('-a',
                        dest='host',
                        required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u',
                        dest='user',
                        required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p',
                        dest='passwd',
                        required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c',
                        dest='cert',
                        required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y',
                        dest='proxy',
                        required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j',
                        dest='domain',
                        required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-n',
                        dest='name',
                        required=True,
                        help='''
    Name of the storage volume to add''')
    parser.add_argument('-sp',
                        dest='sto_pool',
                        required=True,
                        help='''
    Name of the storage pool to use''')
    parser.add_argument('-cap',
                        dest='size',
                        required=True,
                        help='''
    Size of volume in GiB''')
    parser.add_argument('-sh',
                        dest='shareable',
                        required=False,
                        default=False,
                        action='store_true',
                        help='''
    sets volume to shareable, omit for private''')
    parser.add_argument('-pt',
                        dest='provType',
                        required=False,
                        default='Thin',
                        help='''
    Thin or Full provisioning''')
    parser.add_argument('-des',
                        dest='desc',
                        required=False,
                        default='Example Volume',
                        help='''
    Description of volume''')

    args = parser.parse_args()
    credential = {
        'authLoginDomain': args.domain.upper(),
        'userName': args.user,
        'password': args.passwd
    }

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_volume(sto, args.name, args.sto_pool, args.size, args.shareable,
               args.desc, args.provType)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Add/Create a new storage pool resource

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HPE OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HPE OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HPE OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-j', dest='domain', required=False,
                        default='Local',
                        help='''
    HPE OneView Authorized Login Domain''')
    parser.add_argument('-n', dest='name', required=True,
                        help='''
    Name of the volume template to add''')
    parser.add_argument('-sp', dest='sto_pool', required=True,
                        help='''
    Name of the storage pool to add template to''')
    parser.add_argument('-cap',  dest='size', required=True,
                        help='''
    Size of volume template in GiB''')
    parser.add_argument('-sh',  dest='shareable', required=False,
                        default=False, action='store_true',
                        help='''
    sets template to shareable, omit for private''')
    parser.add_argument('-pt',  dest='provType', required=False,
                        default='Thin',
                        help='''
    Thin or Full provisioning''')
    parser.add_argument('-des',  dest='desc', required=False,
                        default='Example Volume Template',
                        help='''
    Description of template''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-ss', dest='sto_sys',
                        help='''
    Name of the Storage System to use''')
    group.add_argument('-f', dest='first_avaliable',
                        action='store_true',
                        help='''
    Use the first avaliable storage system''')

    args = parser.parse_args()
    credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_vol_template(sto, args.name, args.sto_sys, args.sto_pool, args.size,
                     args.shareable, args.desc, args.provType, args.first_avaliable)
def main():
    parser = argparse.ArgumentParser(
        add_help=True,
        formatter_class=argparse.RawTextHelpFormatter,
        description="""
    Display Volume Templates

    Usage: """,
    )
    parser.add_argument(
        "-a",
        dest="host",
        required=True,
        help="""
    HP OneView Appliance hostname or IP address""",
    )
    parser.add_argument(
        "-u",
        dest="user",
        required=False,
        default="Administrator",
        help="""
    HP OneView Username""",
    )
    parser.add_argument(
        "-p",
        dest="passwd",
        required=True,
        help="""
    HP OneView Password""",
    )
    parser.add_argument(
        "-c",
        dest="cert",
        required=False,
        help="""
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format""",
    )
    parser.add_argument(
        "-y",
        dest="proxy",
        required=False,
        help="""
    Proxy (host:port format""",
    )
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument(
        "-n",
        dest="name",
        help="""
    Name of the storage volume template""",
    )
    group.add_argument(
        "-g",
        dest="get_all",
        action="store_true",
        help="""
    Get all storage volume templates""",
    )

    args = parser.parse_args()
    credential = {"userName": args.user, "password": args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(":")[0], args.proxy.split(":")[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    if args.get_all:
        get_all_vol_templates(sto)
        sys.exit()

    get_vol_template_by_name(sto, args.name)
def main():
    parser = argparse.ArgumentParser(add_help=True,
                        formatter_class=argparse.RawTextHelpFormatter,
                                     description='''
    Add/Create a new storage pool resource

    Usage: ''')
    parser.add_argument('-a', dest='host', required=True,
                        help='''
    HP OneView Appliance hostname or IP address''')
    parser.add_argument('-u', dest='user', required=False,
                        default='Administrator',
                        help='''
    HP OneView Username''')
    parser.add_argument('-p', dest='passwd', required=True,
                        help='''
    HP OneView Password''')
    parser.add_argument('-c', dest='cert', required=False,
                        help='''
    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')
    parser.add_argument('-y', dest='proxy', required=False,
                        help='''
    Proxy (host:port format''')
    parser.add_argument('-n', dest='name', required=True,
                        help='''
    Name of the volume template to add''')
    parser.add_argument('-sp', dest='sto_pool', required=True,
                        help='''
    Name of the storage pool to add template to''')
    parser.add_argument('-cap',  dest='size', required=True,
                        help='''
    Size of volume template in GiB''')
    parser.add_argument('-sh',  dest='shareable', required=False,
                        default=False, action='store_true',
                        help='''
    sets template to shareable, omit for private''')
    parser.add_argument('-pt',  dest='provType', required=False,
                        default='Thin',
                        help='''
    Thin or Full provisioning''')
    parser.add_argument('-des',  dest='desc', required=False,
                        default='Example Volume Template',
                        help='''
    Description of template''')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-ss', dest='sto_sys',
                        help='''
    Name of the Storage System to use''')
    group.add_argument('-f', dest='first_avaliable',
                        action='store_true',
                        help='''
    Use the first avaliable storage system''')

    args = parser.parse_args()
    credential = {'userName': args.user, 'password': args.passwd}

    con = hpov.connection(args.host)
    sto = hpov.storage(con)

    if args.proxy:
        con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])
    if args.cert:
        con.set_trusted_ssl_bundle(args.cert)

    login(con, credential)
    acceptEULA(con)

    add_vol_template(sto, args.name, args.sto_sys, args.sto_pool, args.size,
                     args.shareable, args.desc, args.provType, args.first_avaliable)