本文整理汇总了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")
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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")
示例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")
示例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)
示例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()
示例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()
示例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
示例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)