本文整理汇总了Python中NaServer.set_transport_type方法的典型用法代码示例。如果您正苦于以下问题:Python NaServer.set_transport_type方法的具体用法?Python NaServer.set_transport_type怎么用?Python NaServer.set_transport_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NaServer
的用法示例。
在下文中一共展示了NaServer.set_transport_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
def main():
s = NaServer("10.128.153.60", 1 , 21)
s.set_server_type("FILER")
s.set_transport_type("HTTPS")
s.set_port(443)
s.set_style("LOGIN")
s.set_admin_user("BNELAB\\duanes", "D3m0open")
cs = statsd.StatsClient('localhost',8125)
for v in get_volumes(s):
try:
v_cn = v['cluster-name']
v_svm = v['owning-vserver-name']
v_vol = v['name']
c = get_counters(s, v['instance-uuid'])
c_ts = c['timestamp']
c_read_ops = c['read_ops']
c_write_ops = c['write_ops']
c_total_ops = c['total_ops']
metric_string = "brisvegas.%s.%s.read_ops" % (v_svm, v_vol)
print metric_string, c_read_ops, c_write_ops
cs.gauge(metric_string, c_read_ops)
metric_string = "brisvegas.%s.%s.write_ops" % (v_svm, v_vol)
cs.gauge(metric_string, c_write_ops)
#print c
except KeyError:
continue
示例2: cdotconnect
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
def cdotconnect(filer, username, password) :
""" return a filer connection handle """
s = NaServer(filer, 1 , 31)
s.set_server_type("FILER")
s.set_transport_type("HTTP") # would like to use HTTPS but I get ssl cert errors on Ubuntu 15.x
s.set_port(80)
s.set_style("LOGIN")
s.set_admin_user(username, password)
return s
示例3: connect
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
def connect(hostname, user, password, minor_version=1, major_version=21):
global conn
conn = NaServer(hostname, minor_version, major_version)
conn.set_server_type('filer')
conn.set_transport_type('HTTPS')
conn.set_port(443)
conn.set_style('LOGIN')
conn.set_admin_user(user, password)
return conn
示例4: create_qtree_quota
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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")
示例5: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例6: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例7: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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")
示例8: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例9: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例10: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例11: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例12: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例13: connect_filer
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
def connect_filer(host,user,passwd):
plog.print_debug("Host: %s, User: %s" %(host,user))
s = NaServer(host, 1, 1)
s.set_server_type("Filer")
s.set_admin_user(user,passwd)
response = s.set_transport_type('HTTP')
if(response and response.results_errno() != 0 ):
r = response.results_reason()
plog.print_error("Unable to set HTTP transport " + r + "\n")
sys.exit (1)
response = s.set_style('LOGIN')
if(response and response.results_errno() != 0 ):
r = response.results_reason()
plog.print_error("Unable to set authentication style " + r + "\n")
sys.exit (1)
return s
示例14: main
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
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()
示例15: get_quota_info
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_transport_type [as 别名]
def get_quota_info():
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)
out = s.invoke( "quota-list-entries" )
if (out.results_status() == "failed"):
print(out.results_reason() + "\n")
sys.exit (2)
quota_info = out.child_get("quota-entries")
result = quota_info.children_get()
print("-----------------------------------------------------\n")
for quota in result :
if(quota.child_get_string("quota-target")):
quota_target = quota.child_get_string("quota-target")
print ("Quota Target: " + quota_target + " \n")
if(quota.child_get_string("volume")):
volume = quota.child_get_string("volume")
print ("Volume: " + volume + "\n")
if(quota.child_get_string("quota-type")):
quota_type = quota.child_get_string("quota-type")
print ("Quota Type: " + quota_type + "\n")
print ("-----------------------------------------------------\n")