Ejemplo n.º 1
0
def list(
        ctx,
        # Optional main parameter
        virtualnetworkid=None,
        # Optional main parameter
        virtualnetworktag=None,
        # Optional main parameter
        virtualnetworkids=None,
        # Optional main parameter
        virtualnetworktags=None):
    """ListVirtualNetworks enables you to list all configured virtual networks for the cluster. You can use this method to verify the virtual"""
    """network settings in the cluster."""
    """There are no required parameters for this method. However, to filter the results, you can pass one or more VirtualNetworkID or"""
    """VirtualNetworkTag values."""

    cli_utils.establish_connection(ctx)

    virtualnetworkids = parser.parse_array(virtualnetworkids)

    virtualnetworktags = parser.parse_array(virtualnetworktags)

    ctx.logger.info(""": """
                    """virtualnetworkid = """ + str(virtualnetworkid) + ";" +
                    """virtualnetworktag = """ + str(virtualnetworktag) + ";" +
                    """virtualnetworkids = """ + str(virtualnetworkids) + ";" +
                    """virtualnetworktags = """ + str(virtualnetworktags) +
                    """;""" + "")
    try:
        _ListVirtualNetworksResult = ctx.element.list_virtual_networks(
            virtual_network_id=virtualnetworkid,
            virtual_network_tag=virtualnetworktag,
            virtual_network_ids=virtualnetworkids,
            virtual_network_tags=virtualnetworktags)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ListVirtualNetworksResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ListVirtualNetworksResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 2
0
def add(
        ctx,
        # Mandatory main parameter
        pendingnodes,
        # Optional main parameter
        autoinstall=None):
    """AddNodes enables you to add one or more new nodes to a cluster. When a node that is not configured starts up for the first time, you are prompted to configure the node. After you configure the node, it is registered as a "pending node" with the cluster. """
    """Note: It might take several seconds after adding a new node for it to start up and register its drives as available."""

    cli_utils.establish_connection(ctx)

    pendingnodes = parser.parse_array(pendingnodes)

    ctx.logger.info(""": """
                    """pendingnodes = """ + str(pendingnodes) + ";" +
                    """autoinstall = """ + str(autoinstall) + """;""" + "")
    try:
        _AddNodesResult = ctx.element.add_nodes(pending_nodes=pendingnodes,
                                                auto_install=autoinstall)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_AddNodesResult), indent=4))
        return
    else:
        cli_utils.print_result(_AddNodesResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 3
0
def remove(
        ctx,
        # Mandatory main parameter
        nodes):
    """You can use RemoveNodes to remove one or more nodes that should no longer participate in the cluster. Before removing a node, you must remove all drives the node contains using the RemoveDrives method. You cannot remove a node until the RemoveDrives process has completed and all data has been migrated away from the node."""
    """After you remove a node, it registers itself as a pending node. You can add the node again or shut it down (shutting the node down removes it from the Pending Node list)."""

    cli_utils.establish_connection(ctx)

    nodes = parser.parse_array(nodes)

    ctx.logger.info(""": """ """nodes = """ + str(nodes) + """;""" + "")
    try:
        _RemoveNodesResult = ctx.element.remove_nodes(nodes=nodes)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_RemoveNodesResult), indent=4))
        return
    else:
        cli_utils.print_result(_RemoveNodesResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 4
0
def listvolumestatsby(ctx,
           # Optional main parameter
           virtualvolumeids = None):
    """ListVolumeStatsByVirtualVolume enables you to list volume statistics for any volumes in the system that are associated with virtual volumes. Statistics are cumulative from the creation of the volume."""

    

    cli_utils.establish_connection(ctx)
    

    virtualvolumeids = parser.parse_array(virtualvolumeids)
    

    ctx.logger.info(""": """"""virtualvolumeids = """+str(virtualvolumeids)+""";"""+"")
    try:
        _ListVolumeStatsByVirtualVolumeResult = ctx.element.list_volume_stats_by_virtual_volume(virtual_volume_ids=virtualvolumeids)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_ListVolumeStatsByVirtualVolumeResult), indent=4))
        return
    else:
        cli_utils.print_result(_ListVolumeStatsByVirtualVolumeResult, ctx.logger, as_json=ctx.json, as_pickle=ctx.pickle, depth=ctx.depth, filter_tree=ctx.filter_tree)
Ejemplo n.º 5
0
def liststats(
        ctx,
        # Optional main parameter
        drives=None):
    """ListDriveStats enables you to retrieve high-level activity measurements for multiple drives in the cluster. By default, this method returns statistics for all drives in the cluster, and these measurements are cumulative from the addition of the drive to the cluster. Some values this method returns are specific to block drives, and some are specific to metadata drives."""

    cli_utils.establish_connection(ctx)

    drives = parser.parse_array(drives)

    ctx.logger.info(""": """ """drives = """ + str(drives) + """;""" + "")
    try:
        _ListDriveStatsResult = ctx.element.list_drive_stats(drives=drives)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ListDriveStatsResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ListDriveStatsResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 6
0
def listhosts(ctx,
           # Optional main parameter
           virtualvolumehostids = None):
    """ListVirtualVolumeHosts returns a list of all virtual volume hosts known to the cluster. A virtual volume host is a VMware ESX host"""
    """that has initiated a session with the VASA API provider."""

    

    cli_utils.establish_connection(ctx)
    

    virtualvolumehostids = parser.parse_array(virtualvolumehostids)
    

    ctx.logger.info(""": """"""virtualvolumehostids = """+str(virtualvolumehostids)+""";"""+"")
    try:
        _ListVirtualVolumeHostsResult = ctx.element.list_virtual_volume_hosts(virtual_volume_host_ids=virtualvolumehostids)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_ListVirtualVolumeHostsResult), indent=4))
        return
    else:
        cli_utils.print_result(_ListVirtualVolumeHostsResult, ctx.logger, as_json=ctx.json, as_pickle=ctx.pickle, depth=ctx.depth, filter_tree=ctx.filter_tree)
Ejemplo n.º 7
0
def listprotocolendpoints(ctx,
           # Optional main parameter
           protocolendpointids = None):
    """ListProtocolEndpoints enables you to retrieve information about all protocol endpoints in the cluster. Protocol endpoints govern"""
    """access to their associated virtual volume storage containers."""

    

    cli_utils.establish_connection(ctx)
    

    protocolendpointids = parser.parse_array(protocolendpointids)
    

    ctx.logger.info(""": """"""protocolendpointids = """+str(protocolendpointids)+""";"""+"")
    try:
        _ListProtocolEndpointsResult = ctx.element.list_protocol_endpoints(protocol_endpoint_ids=protocolendpointids)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_ListProtocolEndpointsResult), indent=4))
        return
    else:
        cli_utils.print_result(_ListProtocolEndpointsResult, ctx.logger, as_json=ctx.json, as_pickle=ctx.pickle, depth=ctx.depth, filter_tree=ctx.filter_tree)
Ejemplo n.º 8
0
def listtasks(ctx,
           # Optional main parameter
           virtualvolumetaskids = None):
    """ListVirtualVolumeTasks returns a list of virtual volume tasks in the system."""

    

    cli_utils.establish_connection(ctx)
    

    virtualvolumetaskids = parser.parse_array(virtualvolumetaskids)
    

    ctx.logger.info(""": """"""virtualvolumetaskids = """+str(virtualvolumetaskids)+""";"""+"")
    try:
        _ListVirtualVolumeTasksResult = ctx.element.list_virtual_volume_tasks(virtual_volume_task_ids=virtualvolumetaskids)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_ListVirtualVolumeTasksResult), indent=4))
        return
    else:
        cli_utils.print_result(_ListVirtualVolumeTasksResult, ctx.logger, as_json=ctx.json, as_pickle=ctx.pickle, depth=ctx.depth, filter_tree=ctx.filter_tree)
Ejemplo n.º 9
0
def listresults(ctx,
           # Optional main parameter
           asyncresulttypes = None):
    """You can use ListAsyncResults to list the results of all currently running and completed asynchronous methods on the system."""
    """Querying asynchronous results with ListAsyncResults does not cause completed asyncHandles to expire; you can use GetAsyncResult"""
    """to query any of the asyncHandles returned by ListAsyncResults."""

    

    cli_utils.establish_connection(ctx)
    

    asyncresulttypes = parser.parse_array(asyncresulttypes)
    

    ctx.logger.info(""": """"""asyncresulttypes = """+str(asyncresulttypes)+""";"""+"")
    try:
        _ListAsyncResultsResult = ctx.element.list_async_results(async_result_types=asyncresulttypes)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_ListAsyncResultsResult), indent=4))
        return
    else:
        cli_utils.print_result(_ListAsyncResultsResult, ctx.logger, as_json=ctx.json, as_pickle=ctx.pickle, depth=ctx.depth, filter_tree=ctx.filter_tree)
Ejemplo n.º 10
0
def shutdown(
        ctx,
        # Mandatory main parameter
        nodes,
        # Optional main parameter
        option=None):
    """The Shutdown API method enables you to restart or shutdown a node that has not yet been added to a cluster. To use this method,"""
    """log in to the MIP for the pending node, and enter the "shutdown" method with either the "restart" or "halt" options."""

    cli_utils.establish_connection(ctx)

    nodes = parser.parse_array(nodes)

    ctx.logger.info(""": """
                    """nodes = """ + str(nodes) + ";" + """option = """ +
                    str(option) + """;""" + "")
    try:
        _ShutdownResult = ctx.element.shutdown(nodes=nodes, option=option)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_ShutdownResult), indent=4))
        return
    else:
        cli_utils.print_result(_ShutdownResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 11
0
def secureerase(
        ctx,
        # Mandatory main parameter
        drives):
    """SecureEraseDrives enables you to remove any residual data from drives that have a status of "available." You might want to use this method when replacing a drive nearing the end of its service life that contained sensitive data. This method uses a Security Erase Unit command to write a predetermined pattern to the drive and resets the encryption key on the drive. This asynchronous method might take up to two minutes to complete. You can use GetAsyncResult to check on the status of the secure erase operation."""
    """You can use the ListDrives method to obtain the driveIDs for the drives you want to secure erase."""

    cli_utils.establish_connection(ctx)

    drives = parser.parse_array(drives)

    ctx.logger.info(""": """ """drives = """ + str(drives) + """;""" + "")
    try:
        _AsyncHandleResult = ctx.element.secure_erase_drives(drives=drives)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_AsyncHandleResult), indent=4))
        return
    else:
        cli_utils.print_result(_AsyncHandleResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 12
0
def add(
        ctx,
        # Mandatory main parameter
        username,
        # Mandatory main parameter
        password,
        # Mandatory main parameter
        access,
        # Optional main parameter
        accepteula=None,
        # Optional main parameter
        attributes=None):
    """You can use AddClusterAdmin to add a new cluster admin account. A cluster ddmin can manage the cluster using the API and management tools. Cluster admins are completely separate and unrelated to standard tenant accounts."""
    """Each cluster admin can be restricted to a subset of the API. NetApp recommends using multiple cluster admin accounts for different users and applications. You should give each cluster admin the minimal permissions necessary; this reduces the potential impact of credential compromise."""
    """You must accept the End User License Agreement (EULA) by setting the acceptEula parameter to true to add a cluster administrator account to the system."""

    cli_utils.establish_connection(ctx)

    access = parser.parse_array(access)

    kwargsDict = None
    if (attributes is not None and attributes != ()):
        try:
            kwargsDict = simplejson.loads(attributes)
        except Exception as e:
            ctx.logger.error(e.__str__())
            exit(1)

    ctx.logger.info(""": """
                    """username = """ + str(username) + ";" +
                    """password = """ + str(password) + ";" + """access = """ +
                    str(access) + ";" + """accepteula = """ + str(accepteula) +
                    ";" + """attributes = """ + str(kwargsDict) + """;""" + "")
    try:
        _AddClusterAdminResult = ctx.element.add_cluster_admin(
            username=username,
            password=password,
            access=access,
            accept_eula=accepteula,
            attributes=kwargsDict)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_AddClusterAdminResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_AddClusterAdminResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 13
0
def addclusteradmin(
        ctx,
        # Mandatory main parameter
        username,
        # Mandatory main parameter
        access,
        # Optional main parameter
        accepteula=None,
        # Optional main parameter
        attributes=None):
    """AddLdapClusterAdmin enables you to add a new LDAP cluster administrator user. An LDAP cluster administrator can manage the"""
    """cluster via the API and management tools. LDAP cluster admin accounts are completely separate and unrelated to standard tenant"""
    """accounts."""
    """You can also use this method to add an LDAP group that has been defined in Active Directory. The access level that is given to the group is passed to the individual users in the LDAP group."""

    cli_utils.establish_connection(ctx)

    access = parser.parse_array(access)

    kwargsDict = None
    if (attributes is not None and attributes != ()):
        try:
            kwargsDict = simplejson.loads(attributes)
        except Exception as e:
            ctx.logger.error(e.__str__())
            exit(1)

    ctx.logger.info(""": """
                    """username = """ + str(username) + ";" + """access = """ +
                    str(access) + ";" + """accepteula = """ + str(accepteula) +
                    ";" + """attributes = """ + str(kwargsDict) + """;""" + "")
    try:
        _AddLdapClusterAdminResult = ctx.element.add_ldap_cluster_admin(
            username=username,
            access=access,
            accept_eula=accepteula,
            attributes=kwargsDict)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_AddLdapClusterAdminResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_AddLdapClusterAdminResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 14
0
def modify(
        ctx,
        # Mandatory main parameter
        clusteradminid,
        # Optional main parameter
        password=None,
        # Optional main parameter
        access=None,
        # Optional main parameter
        attributes=None):
    """You can use ModifyClusterAdmin to change the settings for a cluster admin or LDAP cluster admin. You cannot change access for the administrator cluster admin account."""

    cli_utils.establish_connection(ctx)

    access = parser.parse_array(access)

    kwargsDict = None
    if (attributes is not None and attributes != ()):
        try:
            kwargsDict = simplejson.loads(attributes)
        except Exception as e:
            ctx.logger.error(e.__str__())
            exit(1)

    ctx.logger.info(""": """
                    """clusteradminid = """ + str(clusteradminid) + ";" +
                    """password = """ + str(password) + ";" + """access = """ +
                    str(access) + ";" + """attributes = """ + str(kwargsDict) +
                    """;""" + "")
    try:
        _ModifyClusterAdminResult = ctx.element.modify_cluster_admin(
            cluster_admin_id=clusteradminid,
            password=password,
            access=access,
            attributes=kwargsDict)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ModifyClusterAdminResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ModifyClusterAdminResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 15
0
def removefromvolumeaccessgroup(
        ctx,
        # Mandatory main parameter
        volumeaccessgroupid,
        # Mandatory main parameter
        initiators,
        # Optional main parameter
        deleteorphaninitiators=None):
    """RemoveInitiatorsFromVolumeAccessGroup enables"""
    """you to remove initiators from a specified volume access"""
    """group."""

    cli_utils.establish_connection(ctx)

    initiators = parser.parse_array(initiators)

    ctx.logger.info(""": """
                    """volumeaccessgroupid = """ + str(volumeaccessgroupid) +
                    ";" + """initiators = """ + str(initiators) + ";" +
                    """deleteorphaninitiators = """ +
                    str(deleteorphaninitiators) + """;""" + "")
    try:
        _ModifyVolumeAccessGroupResult = ctx.element.remove_initiators_from_volume_access_group(
            volume_access_group_id=volumeaccessgroupid,
            initiators=initiators,
            delete_orphan_initiators=deleteorphaninitiators)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ModifyVolumeAccessGroupResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ModifyVolumeAccessGroupResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 16
0
def list(
        ctx,
        # Optional main parameter
        startvolumeaccessgroupid=None,
        # Optional main parameter
        limit=None,
        # Optional main parameter
        volumeaccessgroups=None):
    """ListVolumeAccessGroups enables you to return"""
    """information about the volume access groups that are"""
    """currently in the system."""

    cli_utils.establish_connection(ctx)

    volumeaccessgroups = parser.parse_array(volumeaccessgroups)

    ctx.logger.info(""": """
                    """startvolumeaccessgroupid = """ +
                    str(startvolumeaccessgroupid) + ";" + """limit = """ +
                    str(limit) + ";" + """volumeaccessgroups = """ +
                    str(volumeaccessgroups) + """;""" + "")
    try:
        _ListVolumeAccessGroupsResult = ctx.element.list_volume_access_groups(
            start_volume_access_group_id=startvolumeaccessgroupid,
            limit=limit,
            volume_access_groups=volumeaccessgroups)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ListVolumeAccessGroupsResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ListVolumeAccessGroupsResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 17
0
def remove(
        ctx,
        # Mandatory main parameter
        drives,
        # Optional main parameter
        forceduringupgrade=None):
    """You can use RemoveDrives to proactively remove drives that are part of the cluster. You might want to use this method when"""
    """reducing cluster capacity or preparing to replace drives nearing the end of their service life. Any data on the drives is removed and"""
    """migrated to other drives in the cluster before the drive is removed from the cluster. This is an asynchronous method. Depending on"""
    """the total capacity of the drives being removed, it might take several minutes to migrate all of the data. Use the GetAsyncResult"""
    """method to check the status of the remove operation."""
    """When removing multiple drives, use a single RemoveDrives method call rather than multiple individual methods with a single drive"""
    """each. This reduces the amount of data balancing that must occur to even stabilize the storage load on the cluster."""
    """You can also remove drives with a "failed" status using RemoveDrives. When you remove a drive with a "failed" status it is not"""
    """returned to an "available" or active status. The drive is unavailable for use in the cluster."""
    """Use the ListDrives method to obtain the driveIDs for the drives you want to remove."""

    cli_utils.establish_connection(ctx)

    drives = parser.parse_array(drives)

    ctx.logger.info(""": """
                    """drives = """ + str(drives) + ";" +
                    """forceduringupgrade = """ + str(forceduringupgrade) +
                    """;""" + "")
    try:
        _AsyncHandleResult = ctx.element.remove_drives(
            drives=drives, force_during_upgrade=forceduringupgrade)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_AsyncHandleResult), indent=4))
        return
    else:
        cli_utils.print_result(_AsyncHandleResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 18
0
def list(
        ctx,
        # Optional main parameter
        startinitiatorid=None,
        # Optional main parameter
        limit=None,
        # Optional main parameter
        initiators=None):
    """ListInitiators enables you to list initiator IQNs or World Wide Port Names (WWPNs)."""

    cli_utils.establish_connection(ctx)

    initiators = parser.parse_array(initiators)

    ctx.logger.info(""": """
                    """startinitiatorid = """ + str(startinitiatorid) + ";" +
                    """limit = """ + str(limit) + ";" + """initiators = """ +
                    str(initiators) + """;""" + "")
    try:
        _ListInitiatorsResult = ctx.element.list_initiators(
            start_initiator_id=startinitiatorid,
            limit=limit,
            initiators=initiators)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ListInitiatorsResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ListInitiatorsResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 19
0
def list(ctx,
           # Optional main parameter
           details = None,
           # Optional main parameter
           limit = None,
           # Optional main parameter
           recursive = None,
           # Optional main parameter
           startvirtualvolumeid = None,
           # Optional main parameter
           virtualvolumeids = None):
    """ListVirtualVolumes enables you to list the virtual volumes currently in the system. You can use this method to list all virtual volumes,"""
    """or only list a subset."""

    

    cli_utils.establish_connection(ctx)
    
    
    
    
    

    virtualvolumeids = parser.parse_array(virtualvolumeids)
    

    ctx.logger.info(""": """"""details = """+str(details)+";" + """limit = """+str(limit)+";" + """recursive = """+str(recursive)+";" + """startvirtualvolumeid = """+str(startvirtualvolumeid)+";" + """virtualvolumeids = """+str(virtualvolumeids)+""";"""+"")
    try:
        _ListVirtualVolumesResult = ctx.element.list_virtual_volumes(details=details, limit=limit, recursive=recursive, start_virtual_volume_id=startvirtualvolumeid, virtual_volume_ids=virtualvolumeids)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(simplejson.dumps(simplejson.loads(_ListVirtualVolumesResult), indent=4))
        return
    else:
        cli_utils.print_result(_ListVirtualVolumesResult, ctx.logger, as_json=ctx.json, as_pickle=ctx.pickle, depth=ctx.depth, filter_tree=ctx.filter_tree)
Ejemplo n.º 20
0
def addtovolumeaccessgroup(
        ctx,
        # Mandatory main parameter
        volumeaccessgroupid,
        # Mandatory main parameter
        initiators):
    """AddInitiatorsToVolumeAccessGroup enables you"""
    """to add initiators to a specified volume access group."""

    cli_utils.establish_connection(ctx)

    initiators = parser.parse_array(initiators)

    ctx.logger.info(""": """
                    """volumeaccessgroupid = """ + str(volumeaccessgroupid) +
                    ";" + """initiators = """ + str(initiators) + """;""" + "")
    try:
        _ModifyVolumeAccessGroupResult = ctx.element.add_initiators_to_volume_access_group(
            volume_access_group_id=volumeaccessgroupid, initiators=initiators)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ModifyVolumeAccessGroupResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ModifyVolumeAccessGroupResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 21
0
def listgroup(
        ctx,
        # Optional main parameter
        volumes=None,
        # Optional main parameter
        groupsnapshotid=None):
    """ListGroupSnapshots enables you to get information about all group snapshots that have been created."""

    cli_utils.establish_connection(ctx)

    volumes = parser.parse_array(volumes)

    ctx.logger.info(""": """
                    """volumes = """ + str(volumes) + ";" +
                    """groupsnapshotid = """ + str(groupsnapshotid) + """;""" +
                    "")
    try:
        _ListGroupSnapshotsResult = ctx.element.list_group_snapshots(
            volumes=volumes, group_snapshot_id=groupsnapshotid)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ListGroupSnapshotsResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ListGroupSnapshotsResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 22
0
def delete(
        ctx,
        # Mandatory main parameter
        initiators):
    """DeleteInitiators enables you to delete one or more initiators from the system (and from any associated volumes or volume access"""
    """groups)."""
    """If DeleteInitiators fails to delete one of the initiators provided in the parameter, the system returns an error and does not delete any"""
    """initiators (no partial completion is possible)."""

    cli_utils.establish_connection(ctx)

    initiators = parser.parse_array(initiators)

    ctx.logger.info(""": """
                    """initiators = """ + str(initiators) + """;""" + "")
    try:
        _DeleteInitiatorsResult = ctx.element.delete_initiators(
            initiators=initiators)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_DeleteInitiatorsResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_DeleteInitiatorsResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 23
0
def modify(
        ctx,
        # Mandatory main parameter
        volumeaccessgroupid,
        # Optional main parameter
        virtualnetworkid=None,
        # Optional main parameter
        virtualnetworktags=None,
        # Optional main parameter
        name=None,
        # Optional main parameter
        initiators=None,
        # Optional main parameter
        volumes=None,
        # Optional main parameter
        deleteorphaninitiators=None,
        # Optional main parameter
        attributes=None):
    """You can use ModifyVolumeAccessGroup to update initiators and add or remove volumes from a volume access group. If a specified initiator or volume is a duplicate of what currently exists, the volume access group is left as-is. If you do not specify a value for volumes or initiators, the current list of initiators and volumes is not changed."""

    cli_utils.establish_connection(ctx)

    virtualnetworkid = parser.parse_array(virtualnetworkid)

    virtualnetworktags = parser.parse_array(virtualnetworktags)

    initiators = parser.parse_array(initiators)

    volumes = parser.parse_array(volumes)

    kwargsDict = None
    if (attributes is not None and attributes != ()):
        try:
            kwargsDict = simplejson.loads(attributes)
        except Exception as e:
            ctx.logger.error(e.__str__())
            exit(1)

    ctx.logger.info(""": """
                    """volumeaccessgroupid = """ + str(volumeaccessgroupid) +
                    ";" + """virtualnetworkid = """ + str(virtualnetworkid) +
                    ";" + """virtualnetworktags = """ +
                    str(virtualnetworktags) + ";" + """name = """ + str(name) +
                    ";" + """initiators = """ + str(initiators) + ";" +
                    """volumes = """ + str(volumes) + ";" +
                    """deleteorphaninitiators = """ +
                    str(deleteorphaninitiators) + ";" + """attributes = """ +
                    str(kwargsDict) + """;""" + "")
    try:
        _ModifyVolumeAccessGroupResult = ctx.element.modify_volume_access_group(
            volume_access_group_id=volumeaccessgroupid,
            virtual_network_id=virtualnetworkid,
            virtual_network_tags=virtualnetworktags,
            name=name,
            initiators=initiators,
            volumes=volumes,
            delete_orphan_initiators=deleteorphaninitiators,
            attributes=kwargsDict)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_ModifyVolumeAccessGroupResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_ModifyVolumeAccessGroupResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 24
0
def enableauthentication(
        ctx,
        # Mandatory main parameter
        serveruris,
        # Optional main parameter
        authtype=None,
        # Optional main parameter
        groupsearchbasedn=None,
        # Optional main parameter
        groupsearchcustomfilter=None,
        # Optional main parameter
        groupsearchtype=None,
        # Optional main parameter
        searchbinddn=None,
        # Optional main parameter
        searchbindpassword=None,
        # Optional main parameter
        userdntemplate=None,
        # Optional main parameter
        usersearchbasedn=None,
        # Optional main parameter
        usersearchfilter=None):
    """The EnableLdapAuthentication method enables you to configure an LDAP directory connection to use for LDAP authentication to a cluster. Users that are members of the LDAP directory can then log in to the storage system using their LDAP credentials."""

    cli_utils.establish_connection(ctx)

    serveruris = parser.parse_array(serveruris)

    ctx.logger.info(""": """
                    """serveruris = """ + str(serveruris) + ";" +
                    """authtype = """ + str(authtype) + ";" +
                    """groupsearchbasedn = """ + str(groupsearchbasedn) + ";" +
                    """groupsearchcustomfilter = """ +
                    str(groupsearchcustomfilter) + ";" +
                    """groupsearchtype = """ + str(groupsearchtype) + ";" +
                    """searchbinddn = """ + str(searchbinddn) + ";" +
                    """searchbindpassword = """ + str(searchbindpassword) +
                    ";" + """userdntemplate = """ + str(userdntemplate) + ";" +
                    """usersearchbasedn = """ + str(usersearchbasedn) + ";" +
                    """usersearchfilter = """ + str(usersearchfilter) +
                    """;""" + "")
    try:
        _EnableLdapAuthenticationResult = ctx.element.enable_ldap_authentication(
            server_uris=serveruris,
            auth_type=authtype,
            group_search_base_dn=groupsearchbasedn,
            group_search_custom_filter=groupsearchcustomfilter,
            group_search_type=groupsearchtype,
            search_bind_dn=searchbinddn,
            search_bind_password=searchbindpassword,
            user_dntemplate=userdntemplate,
            user_search_base_dn=usersearchbasedn,
            user_search_filter=usersearchfilter)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_EnableLdapAuthenticationResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_EnableLdapAuthenticationResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 25
0
def create(ctx, minutes, hours, weekdays, days, monthdays, haserror, paused,
           recurring, runnextinterval, volumeids, snapshotname,
           enableremotereplication, retention, name, startingdate):
    """CreateSchedule is used to create a schedule that will autonomously make a snapshot of a volume at a defined interval."""
    """"""
    """The snapshot created can be used later as a backup or rollback to ensure the data on a volume or group of volumes is consistent for the point in time in which the snapshot was created. """
    """"""
    """Note: Creating a snapshot is allowed if cluster fullness is at stage 2 or 3. Snapshots are not created when cluster fullness is at stage 4 or 5."""
    cli_utils.establish_connection(ctx)

    if not (
        (minutes is not None and hours is not None and days is not None) or
        (minutes is not None and hours is not None and weekdays is not None) or
        (minutes is not None and hours is not None and monthdays is not None)):
        ctx.logger.error(
            """You must provide one of the three possible frequency formats:
        Option 1: Provide minutes, hours, and days
        Option 2: Provide minutes, hours, and weekdays
        Option 3: Provide minutes, hours, and monthdays""")
        exit(1)

    # Mandatory parameters:
    weekdayStringArray = parser.parse_array(weekdays)
    if (minutes is not None and hours is not None and days is not None):
        freq = TimeIntervalFrequency(minutes=minutes, hours=hours, days=days)
    if (minutes is not None and hours is not None and weekdays is not None):
        freq = DaysOfWeekFrequency(
            minutes=minutes,
            hours=hours,
            weekdays=[Weekday.from_name(name) for name in weekdayStringArray])
    if (minutes is not None and hours is not None and monthdays is not None):
        freq = DaysOfMonthFrequency(minutes=minutes,
                                    hours=hours,
                                    monthdays=parser.parse_array(monthdays))

    volumeids = parser.parse_array(volumeids)

    scheduleInfo = ScheduleInfo(
        volume_ids=volumeids,
        snapshot_name=snapshotname,
        enable_remote_replication=enableremotereplication,
        retention=retention)

    schedule = Schedule(frequency=freq,
                        schedule_info=scheduleInfo,
                        name=name,
                        starting_date=startingdate)

    if paused is not None:
        schedule.paused = paused
    if recurring is not None:
        schedule.recurring = recurring
    if runnextinterval is not None:
        schedule.run_next_interval = runnextinterval

    ctx.logger.info("""schedule = """ + str(schedule) + """;""" + "")
    try:
        _CreateScheduleResult = ctx.element.create_schedule(schedule=schedule)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()

    cli_utils.print_result(_CreateScheduleResult,
                           ctx.logger,
                           as_json=ctx.json,
                           as_pickle=ctx.pickle,
                           depth=ctx.depth,
                           filter_tree=ctx.filter_tree)
Ejemplo n.º 26
0
def modify(ctx, scheduleid, minutes, hours, weekdays, days, monthdays, paused,
           recurring, runnextinterval, volumeids, snapshotname,
           enableremotereplication, retention, name, startingdate,
           tobedeleted):

    if ctx.json is True:
        ctx.logger.error(
            "This command does not support the -j field. If you really need it, use sfapi invoke."
        )
        exit(1)
    """ModifySchedule is used to modify a schedule that will autonomously make a snapshot of a volume at a defined interval."""
    """"""
    """The snapshot can be used later as a backup or rollback to ensure the data on a volume or group of volumes is consistent for the point in time in which the snapshot was created. """
    """"""
    """Note: Creating a snapshot is allowed if cluster fullness is at stage 2 or 3. Snapshots are not created when cluster fullness is at stage 4 or 5."""
    cli_utils.establish_connection(ctx)

    if (
            minutes is not None or hours is not None or days is not None
            or weekdays is not None or monthdays is not None
    ) and not (
        (minutes is not None and hours is not None and days is not None) or
        (minutes is not None and hours is not None and weekdays is not None) or
        (minutes is not None and hours is not None and monthdays is not None)):
        ctx.logger.error(
            """You must provide one of the three possible frequency formats:
        Option 1: Provide minutes, hours, and days - specifies time in between snapshots
        Option 2: Provide minutes, hours, and weekdays - specifies time to take snapshots
        Option 3: Provide minutes, hours, and monthdays - specifies time to take snapshots"""
        )
        exit(1)

    # Now that we've done our checks, get the specific schedule:
    try:
        _GetScheduleResult = ctx.element.get_schedule(schedule_id=scheduleid)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()

    if _GetScheduleResult.schedule == None:
        ctx.logger.error(
            "The schedule specified by schedule_id does not exist.")
    schedule = _GetScheduleResult.schedule

    # Mandatory parameters:
    freq = None
    weekdayStringArray = parser.parse_array(weekdays)

    if (minutes is not None and hours is not None and days is not None):
        freq = TimeIntervalFrequency(minutes=minutes, hours=hours, days=days)
    if (minutes is not None and hours is not None and weekdays is not None):
        freq = DaysOfWeekFrequency(
            minutes=minutes,
            hours=hours,
            weekdays=[Weekday.from_name(name) for name in weekdayStringArray])
    if (minutes is not None and hours is not None and monthdays is not None):
        freq = DaysOfMonthFrequency(minutes=minutes,
                                    hours=hours,
                                    monthdays=parser.parse_array(monthdays))
    if freq:
        schedule.frequency = freq
    if volumeids:
        schedule.schedule_info.volume_ids = parser.parse_array(volumeids)
    if snapshotname:
        schedule.schedule_info.snapshot_name = snapshotname
    if enableremotereplication is not None:
        schedule.schedule_info.enable_remote_replication = enableremotereplication
    if retention:
        schedule.schedule_info.retention = retention
    if name:
        schedule.name = name
    if startingdate:
        schedule.starting_date = startingdate
    if paused is not None:
        schedule.paused = paused
    if recurring is not None:
        schedule.recurring = recurring
    if runnextinterval is not None:
        schedule.run_next_interval = runnextinterval
    if scheduleid:
        schedule.schedule_id = scheduleid
    if tobedeleted is not None:
        schedule.to_be_deleted = tobedeleted

    ctx.logger.info("""schedule = """ + str(schedule) + """;""" + "")
    try:
        _ModifyScheduleResult = ctx.element.modify_schedule(schedule=schedule)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()

    cli_utils.print_result(_ModifyScheduleResult,
                           ctx.logger,
                           as_json=ctx.json,
                           as_pickle=ctx.pickle,
                           depth=ctx.depth,
                           filter_tree=ctx.filter_tree)
Ejemplo n.º 27
0
def creategroup(
        ctx,
        # Mandatory main parameter
        volumes,
        # Optional main parameter
        name=None,
        # Optional main parameter
        enableremotereplication=None,
        # Optional main parameter
        retention=None,
        # Optional main parameter
        attributes=None,
        # Optional main parameter
        snapmirrorlabel=None):
    """CreateGroupSnapshot enables you to create a point-in-time copy of a group of volumes. You can use this snapshot later as a backup or rollback to ensure the data on the group of volumes is consistent for the point in time that you created the snapshot."""
    """Note: Creating a group snapshot is allowed if cluster fullness is at stage 2 or 3. Snapshots are not created when cluster fullness is at stage 4 or 5."""

    cli_utils.establish_connection(ctx)

    volumes = parser.parse_array(volumes)

    kwargsDict = None
    if (attributes is not None and attributes != ()):
        try:
            kwargsDict = simplejson.loads(attributes)
        except Exception as e:
            ctx.logger.error(e.__str__())
            exit(1)

    ctx.logger.info(""": """
                    """volumes = """ + str(volumes) + ";" + """name = """ +
                    str(name) + ";" + """enableremotereplication = """ +
                    str(enableremotereplication) + ";" + """retention = """ +
                    str(retention) + ";" + """attributes = """ +
                    str(kwargsDict) + ";" + """snapmirrorlabel = """ +
                    str(snapmirrorlabel) + """;""" + "")
    try:
        _CreateGroupSnapshotResult = ctx.element.create_group_snapshot(
            volumes=volumes,
            name=name,
            enable_remote_replication=enableremotereplication,
            retention=retention,
            attributes=kwargsDict,
            snap_mirror_label=snapmirrorlabel)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_CreateGroupSnapshotResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_CreateGroupSnapshotResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)
Ejemplo n.º 28
0
def create(
        ctx,
        # Mandatory main parameter
        name,
        # Optional main parameter
        initiators=None,
        # Optional main parameter
        volumes=None,
        # Optional main parameter
        virtualnetworkid=None,
        # Optional main parameter
        virtualnetworktags=None,
        # Optional main parameter
        attributes=None):
    """You can use CreateVolumeAccessGroup to create a new volume access group. When you create the volume access group, you need to give it a name, and you can optionally enter initiators and volumes. After you create the group, you can add volumes and initiator IQNs. Any initiator IQN that you add to the volume access group is able to access any volume in the group without CHAP authentication."""

    cli_utils.establish_connection(ctx)

    initiators = parser.parse_array(initiators)

    volumes = parser.parse_array(volumes)

    virtualnetworkid = parser.parse_array(virtualnetworkid)

    virtualnetworktags = parser.parse_array(virtualnetworktags)

    kwargsDict = None
    if (attributes is not None and attributes != ()):
        try:
            kwargsDict = simplejson.loads(attributes)
        except Exception as e:
            ctx.logger.error(e.__str__())
            exit(1)

    ctx.logger.info(""": """
                    """name = """ + str(name) + ";" + """initiators = """ +
                    str(initiators) + ";" + """volumes = """ + str(volumes) +
                    ";" + """virtualnetworkid = """ + str(virtualnetworkid) +
                    ";" + """virtualnetworktags = """ +
                    str(virtualnetworktags) + ";" + """attributes = """ +
                    str(kwargsDict) + """;""" + "")
    try:
        _CreateVolumeAccessGroupResult = ctx.element.create_volume_access_group(
            name=name,
            initiators=initiators,
            volumes=volumes,
            virtual_network_id=virtualnetworkid,
            virtual_network_tags=virtualnetworktags,
            attributes=kwargsDict)
    except common.ApiServerError as e:
        ctx.logger.error(e.message)
        exit()
    except BaseException as e:
        ctx.logger.error(e.__str__())
        exit()
    if ctx.json:
        print(
            simplejson.dumps(simplejson.loads(_CreateVolumeAccessGroupResult),
                             indent=4))
        return
    else:
        cli_utils.print_result(_CreateVolumeAccessGroupResult,
                               ctx.logger,
                               as_json=ctx.json,
                               as_pickle=ctx.pickle,
                               depth=ctx.depth,
                               filter_tree=ctx.filter_tree)