當前位置: 首頁>>代碼示例>>Python>>正文


Python NaServer類代碼示例

本文整理匯總了Python中NaServer的典型用法代碼示例。如果您正苦於以下問題:Python NaServer類的具體用法?Python NaServer怎麽用?Python NaServer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了NaServer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

def main():
    s = NaServer(filer, 1, 3)
    resp = s.set_style('LOGIN')

    if (resp and resp.results_errno() != 0) :
        r = resp.results_reason()
        print ("Failed to set authentication style " + r + "\n")
        sys.exit (2)

    s.set_admin_user(user, pw)
    resp = s.set_transport_type('HTTP')

    if (resp and resp.results_errno() != 0) :
        r = resp.results_reason()
        print ("Unable to set HTTP transport " + r + "\n")
        sys.exit (2)

    if((command == "raw-capacity") or (command == "formatted-capacity")	or (command == "spare-capacity")) :
        calc_raw_fmt_spare_capacity(s)

    elif((command == "raid-overhead") or (command == "wafl-overhead")) :
        calc_raid_wafl_overhead(s)

    elif(command == "allocated-capacity") :
        calc_allocated_capacity(s)

    elif(command == "avail-user-data-capacity") :
        calc_avail_user_data_capacity(s)

    elif(command == "provisioning-capacity") :
        calc_provisioning_capacity(s)

    else :
        print ("Invalid operation\n")
開發者ID:jcihain,項目名稱:docs,代碼行數:34,代碼來源:unified_capacity_mgmt.py

示例2: main

def main():
    
    s = NaServer(filer, 1, 3)
    response = s.set_style('LOGIN')

    if(response and response.results_errno() != 0 ):
        r = response.results_reason()
        print ("Unable to set authentication style " + r + "\n")
        sys.exit (2)

    s.set_admin_user(user, pw)
    response = s.set_transport_type('HTTP')

    if(response and response.results_errno() != 0 ):
        r = response.results_reason()
        print ("Unable to set HTTP transport " + r + "\n")
        sys.exit (2)

    if(option == "get"):
        get_option_info(s)

    elif(option == "set"):
        set_option_info(s)

    elif(option == "optionsList"):
        options_list_info(s)

    else:
        print("Invalid Option \n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:30,代碼來源:optmgmt.py

示例3: main

def main():
    s = NaServer (filer, 1, 3)
    response = s.set_style('LOGIN')
    
    if (response and response.results_errno() != 0) :
        r = response.results_reason()
        print ("Unable to set authentication style " + r + "\n")
        sys.exit (2)
        
    s.set_admin_user(user, pw)
    response = s.set_transport_type('HTTP')

    if (response and response.results_errno() != 0) :
        r = response.results_reason()
        print ("Unable to set HTTP transport" + r + "\n")
        sys.exit (2)

    if(command == "get"):
        snmp_get(s)

    elif(command == "status"):
        snmp_status(s)

    elif(command == "addCommunity"):
        add_community(s)

    elif(command == "deleteCommunity"):
        delete_community(s)

    else:
        print ("Invalid operation\n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:32,代碼來源:snmp.py

示例4: main

def main():
    s = NaServer(filer, 1, 3)
    response = s.set_style('LOGIN')
    
    if (response and response.results_errno() != 0) :
        r = response.results_reason()
        print ("Unable to set authentication style " + r + "\n")
        sys.exit (2)
        
    s.set_admin_user(user, pw)
    response = s.set_transport_type('HTTP')

    if (response and response.results_errno() != 0) :
        r = response.results_reason()
        print ("Unable to set HTTP transport" + r + "\n")
        sys.exit (2)

    if(command == "getStatus"):
        get_status(s)

    elif(command == "getVolStatus"):
        get_vol_status(s)

    elif(command == "off"):
        snapmirror_off(s)

    elif(command == "on"):
        snapmirror_on(s)

    else:
        print ("Invalid operation\n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:32,代碼來源:snapmirror.py

示例5: main

def main() :
    s = NaServer(filer, 1, 3)

    out = s.set_transport_type('HTTP')
    if (out and out.results_errno() != 0) :
        r = out.results_reason()
        print ("Connection to filer failed: " + r + "\n")
        sys.exit(2)

    out = s.set_style('LOGIN')
    
    if (out and out.results_errno() != 0) :
        r = out.results_reason()
        print ("Connection to filer failed: " + r + "\n")
        sys.exit(2)

    out = s.set_admin_user(user, pw)

    if(command == "object-list"):
        get_object_list(s)

    elif(command == "instance-list"):
        get_instance_list(s)

    elif(command == "counter-list"):
        get_counter_list(s)

    elif(command == "get-counter-values"):
        get_counter_values(s)

    else:
        print ("Invalid operation\n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:33,代碼來源:perf_operation.py

示例6: main

def main():
    s = NaServer (filer, 1, 3)
    resp = s.set_transport_type('HTTP')

    if (resp and resp.results_errno() != 0) :
        r = resp.results_reason()
        print ("Unable to set HTTP transport " + r + "\n")
        sys.exit (2)

    resp = s.set_style('LOGIN')
    
    if (resp and resp.results_errno() != 0) :
        r = resp.results_reason()
        print ("Failed to set authentication style " + r + "\n")
        sys.exit (2)

    s.set_admin_user(user, pw)

    if(command == "file-get-snaplock-retention-time"):
        file_get_retention(s)

    elif(command == "file-set-snaplock-retention-time"):
        file_set_retention(s)

    elif(command == "file-snaplock-retention-time-list-info"):
        file_get_retention_list(s)

    elif(command == "file-get-snaplock-retention-time-list-info-max"):
        file_get_retention_list_info_max(s)

    else:
        print ("Invalid operation\n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:33,代碼來源:file_snaplock.py

示例7: main

def main():
    s = NaServer (filer, 1, 3)
    response = s.set_style('LOGIN')

    if (response and response.results_errno() != 0) :
        r = response.results_reason()
        print ("Unable to set authentication style " + r + "\n")
        sys.exit (2)

    s.set_admin_user(user, pw)
    response = s.set_transport_type('HTTP')

    if (response and response.results_errno() != 0) :
        r = response.results_reason()
        print ("Unable to set HTTP transport" + r + "\n")
        sys.exit (2)

    if(command == "lun"):
        process_LUN(s)

    elif(command == "igroup"):
        process_igroup(s)

    elif(command == "fcp"):
        process_fcp(s)

    elif(command == "iscsi"):
        process_iscsi(s)

    else:
        print ("Invalid operation\n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:32,代碼來源:san_mgmt.py

示例8: main

def main() :
    SevenMode = Get7ModeSystems()

    for toaster in SevenMode:
        drives_mapped = defaultdict(list)
        filer = toaster[0]
        user = toaster[1]
        pw = toaster[2]

        s = NaServer(filer, 1, 3)
        out = s.set_transport_type('HTTPS')

        if (out and out.results_errno() != 0) :
            r = out.results_reason()
            print ("Connection to filer failed: " + r + "\n")
            sys.exit(2)

        out = s.set_style('LOGIN')
    
        if (out and out.results_errno() != 0) :
            r = out.results_reason()
            print ("Connection to filer failed: " + r + "\n")
            sys.exit(2)

        out = s.set_admin_user(user, pw)

        if(command == "object-list"):
            get_object_list(s)

        elif(command == "instance-list"):
            get_instance_list(s)

        elif(command == "counter-list"):
           get_counter_list(s)

        elif(command == "get-counter-values"):
            message_lines = []
            #turn the filer FQDN into something more Graphite Friendly
            filername = filer.split(".")[0]
            message_lines = get_counter_values(filername, s)
            message = '\n'.join(message_lines) + '\n' 
            #print message
            SendToGraphite(message)


        else:
            print ("Invalid operation\n")
            print_usage()
開發者ID:kript,項目名稱:Monitoring-Stuff,代碼行數:48,代碼來源:Generate_NetApp_Perf_stats.py

示例9: Connect

    def Connect(self):
        """
        connect to the netapp via the API
        """

        #self.s = NaServer(self.filer, 1, 3)
        self.s = NaServer(self.filer, 1, 9)
        self.out = self.s.set_transport_type('HTTPS')
        _log.debug("attempting to connect to filer via HTTPS")

        if (self.out and self.out.results_errno() != 0) :
            r = self.out.results_reason()
            _log.warn("Connection to filer failed: " + r + "\n")
            sys.exit(3)

        self.out = self.s.set_style('LOGIN')
        _log.debug("attempting to login to " + self.filer + "\n")
    
        if (self.out and self.out.results_errno() != 0) :
            r = self.out.results_reason()
            _log.warn("Connection to filer failed: " + r + "\n")
            sys.exit(3)

        self.out = self.s.set_admin_user(self.user, self.pw)
        _log.debug("set admin user to" + self.user + "\n")
開發者ID:kript,項目名稱:NagiosChecks,代碼行數:25,代碼來源:NACheck_netapp_interface.py

示例10: create_qtree_quota

def create_qtree_quota():
    
    s = NaServer(filer, 1, 3)
    response = s.set_style('LOGIN')

    if(response and response.results_errno() != 0 ):
        r = response.results_reason()
        print ("Unable to set authentication style " + r + "\n")
        sys.exit (2)

    s.set_admin_user(user, pw)
    response = s.set_transport_type('HTTP')

    if(response and response.results_errno() != 0 ):
        r = response.results_reason()
        print ("Unable to set transport type " + r + "\n")
        sys.exit (2)

    if(args >  5):
        out = s.invoke("qtree-create", "qtree", qtree, "volume", volume, "mode", mode )

    else :
        out = s.invoke( "qtree-create", "qtree", qtree, "volume", volume)

    if (out.results_status() == "failed"):
        print(out.results_reason())
        print("\n")
        sys.exit (2)

    print ("Created new qtree\n")
開發者ID:raykuan,項目名稱:docs,代碼行數:30,代碼來源:qtree_quota.py

示例11: __init__

    def __init__(self, cluster_name, cluster_ip, username, password, sdk_ver, server_type="FILER", transport_type="HTTPS", port="443", style="LOGIN"):
	major, minor = string.split(sdk_ver, '.')
	self.CLUSTER_NAME = cluster_name
	self.MAX_VOLUMES  = 2000
	self.s = NaServer(cluster_ip, major, minor)
	self.s.set_server_type(server_type)
	self.s.set_transport_type(transport_type)
	self.s.set_port(port)
	self.s.set_style(style)
	self.s.set_admin_user(username, password)
開發者ID:duane23,項目名稱:cdot_api_pull,代碼行數:10,代碼來源:qos_report.py

示例12: main

def main():

    if(not ((command == "create") or (command == "estimate") or (command == "split") or (command == "status"))):
        print(command + " is not a valid command\n")
        print_usage()

    if ((command == "create") and (parent_vol == None)):
        print(command + " operation requires <parent-volname>\n")
        print("Usage: flexclone.py <filer> <user> <password>" + command + " <clone-volname> <parent-volname>\n")
        sys.exit (2)

    s = NaServer(filer, 1, 3)
    resp = s.set_style('LOGIN')

    if (resp and resp.results_errno() != 0) :
        r = resp.results_reason()
        print ("Failed to set authentication style " + r + "\n")
        sys.exit (2)

    s.set_admin_user(user, pw)
    resp = s.set_transport_type('HTTP')

    if (resp and resp.results_errno() != 0) :
        r = resp.results_reason()
        print ("Unable to set HTTP transport " + r + "\n")
        sys.exit (2)

    if(command == "create"):
        create_flexclone(s)

    elif(command == "estimate") :
        estimate_flexclone_split(s)

    elif(command == "split") :
        start_flexclone_split(s)

    elif(command == "status"):
        flexclone_split_status(s)

    else :
        print ("Invalid operation\n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:42,代碼來源:flexclone.py

示例13: main

def main():
    # check for valid number of parameters
    s = NaServer (filer, 1, 3)

    s.set_admin_user(user, pw)
    response = s.set_transport_type('HTTP')

    if (response and response.results_errno() != 0) :
        r = response.results_reason()
        print ("Unable to set HTTP transport" + r + "\n")
        sys.exit (2)
        
    if(command == "cg-start"):
        cg_start(s)

    elif(command == "cg-commit"):
        cg_commit(s)

    else:
        print ("Invalid operation\n")
        print_usage()
開發者ID:raykuan,項目名稱:docs,代碼行數:21,代碼來源:cg_operation.py

示例14: __init__

  def __init__(self, hostname, user, passwd):
      self.api = NaServer(hostname, 1, 3)
      response = self.api.set_style('LOGIN')

      if (response and response.results_errno() != 0):
        r = response.results_reason()
        print ("Unable to set authentication style " + r + "\n")
        sys.exit (2)

      self.api.set_admin_user(user, passwd)
      self.api.set_transport_type('HTTPS')

      self.name = hostname
開發者ID:optionalg,項目名稱:netapp_replication_report,代碼行數:13,代碼來源:Netapp.py

示例15: run

    def run(self):
        self.filer_metrics = {}
        metric = self.MetricName
        filer = self.FilerName
        s = NaServer(filerdict[filer]['ipaddr'], 1, 3)
        out = s.set_transport_type('HTTPS')
        if (out and out.results_errno() != 0) :
            r = out.results_reason()
            print ("Connection to filer failed: " + r + "\n")
            sys.exit(2)
            
        out = s.set_style('LOGIN')
        if (out and out.results_errno() != 0) :
            r = out.results_reason()
            print ("Connection to filer failed: " + r + "\n")
            sys.exit(2)
        out = s.set_admin_user(filerdict[filer]['user'], filerdict[filer]['password'])

        #Get the volume performance metrics
        self.volume_perf_metrics(s)
        self.volume_capacity_metrics(s)
        self.quota_metrics(s)
開發者ID:Earne,項目名稱:gmond_python_modules,代碼行數:22,代碼來源:netapp_cmode_api.py


注:本文中的NaServer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。