• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python common.get_params_from_request函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中storlever.rest.common.get_params_from_request函数的典型用法代码示例。如果您正苦于以下问题:Python get_params_from_request函数的具体用法?Python get_params_from_request怎么用?Python get_params_from_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_params_from_request函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: put_service

def put_service(request):
    service_name = request.matchdict["service_name"]
    cmd = get_params_from_request(request, service_mod_schema)

    service_mgr = servicemgr.service_mgr()      # get service manager
    service = service_mgr.get_service_by_name(service_name)

    if "state" in cmd:
        if cmd["state"]:
            service.start(request.client_addr)
        else:
            service.stop(request.client_addr)
    elif "restart" in cmd:
        if cmd["restart"]:
            service.restart(request.client_addr)
    elif "reload" in cmd:
        if cmd["restart"]:
            service.reload(request.client_addr)

    if "auto_start" in cmd:
        if cmd["auto_start"]:
            service.enable_auto_start(request.client_addr)
        else:
            service.disable_auto_start(request.client_addr)

    return Response(status=200)
开发者ID:OpenSight,项目名称:StorLever,代码行数:26,代码来源:system.py


示例2: post_tgt_target_lun_list

def post_tgt_target_lun_list(request):
    iqn = request.matchdict['target_iqn']
    tgt_mgr = tgtmgr.TgtManager
    target = tgt_mgr.get_target_by_iqn(iqn)
    new_lun_conf = get_params_from_request(request, lun_conf_schema)
    if "path" not in new_lun_conf:
        raise StorLeverError("New LUN's path must be configured", 400)

    target.add_lun(new_lun_conf["lun"],
                   new_lun_conf["path"],
                   new_lun_conf.get("device_type", "disk"),
                   new_lun_conf.get("bs_type", "rdwr"),
                   new_lun_conf.get("direct_map", False),
                   new_lun_conf.get("write_cache", True),
                   new_lun_conf.get("readonly", False),
                   new_lun_conf.get("online", True),
                   new_lun_conf.get("scsi_id", ""),
                   new_lun_conf.get("scsi_sn", ""),
                   operator=request.client_addr)

    # generate 201 response
    resp = Response(status=201)
    resp.location = request.route_url('tgt_target_lun_info',
                                      target_iqn=iqn,
                                      lun_number=new_lun_conf["lun"])
    return resp
开发者ID:OpenSight,项目名称:StorLever,代码行数:26,代码来源:san.py


示例3: check_password

def check_password(request):
    check_web_password_request = get_params_from_request(request, web_password_check_schema)
    if webconfig.WebPassword().check_password(check_web_password_request['login'],
                                              check_web_password_request['password']):
        return Response(status=200)
    else:
        raise StorLeverError('Wrong user name or password')
开发者ID:OpenSight,项目名称:StorLever,代码行数:7,代码来源:system.py


示例4: post_send_mail

def post_send_mail(request):
    mail_mgr = mailmgr.MailManager
    send_mail_conf = get_params_from_request(request, send_mail_schema)
    info = mail_mgr.send_email(
        send_mail_conf["to"], send_mail_conf["subject"], send_mail_conf["content"], send_mail_conf["debug"]
    )
    return {"debug_info": info}
开发者ID:dulton,项目名称:StorLever,代码行数:7,代码来源:utils.py


示例5: set_scsi_dev_smart

def set_scsi_dev_smart(request):
    scsi_id = request.matchdict['scsi_id']
    scsi_mgr =  scsimgr.scsi_mgr()
    scsi_dev_info = scsi_mgr.get_scsi_dev_by_id(scsi_id)
    params = get_params_from_request(request, scsi_dev_smart_schema)
    smart_set = params.get("smart", None),
    offline_set = params.get("offline_auto", None),
    scsi_dev_info.set_smart_config(smart_set,offline_set)
    return Response(status=200)



#@get_view(route_name='adapter_list')
#def adapters_get(request):
    #pass


#@get_view(route_name='adapter')
#def adapters_get(request):
    #pass


#@get_view(route_name='adapter_disk_list')
#def adapters_get(request):
    #pass


#@get_view(route_name='adapter_vdisk_list')
#def adapters_get(request):
    #pass
开发者ID:ntvis,项目名称:StorLever,代码行数:30,代码来源:block.py


示例6: del_quota_user

def del_quota_user(request):
    fs_name = request.matchdict['fsname']
    fs_mrg = fsmgr.fs_mgr()
    fs = fs_mrg.get_fs_by_name(fs_name)
    params = get_params_from_request(request, del_quoat_group_schema)
    user = params["user"]
    fs.quota_group_set(user,0,0,0,0)
    return Response(status=200)
开发者ID:OpenSight,项目名称:StorLever,代码行数:8,代码来源:fs.py


示例7: get_fs_ls

def get_fs_ls(request):
    fs_name = request.matchdict['fsname']
    fs_mrg = fsmgr.fs_mgr()
    fs = fs_mrg.get_fs_by_name(fs_name)
    params = get_params_from_request(request, get_fs_ls_schema)
    path = params["path"]
    ls_info = fs.ls_dir(path)
    return ls_info
开发者ID:OpenSight,项目名称:StorLever,代码行数:8,代码来源:fs.py


示例8: change_password

def change_password(request):
    change_password_request = get_params_from_request(request, web_password_change_schema)
    if webconfig.WebPassword().change_password(change_password_request['login'],
                                               change_password_request['old_password'],
                                               change_password_request['new_password']):
        return Response(status=200)
    else:
        raise StorLeverError('Unable to change password')
开发者ID:OpenSight,项目名称:StorLever,代码行数:8,代码来源:system.py


示例9: set_block_opt

def set_block_opt(request):
    scsi_id = request.matchdict['scsi_id']
    scsi_mgr =  scsimgr.scsi_mgr()
    scsi_dev_info = scsi_mgr.get_scsi_dev_by_id(scsi_id)
    params = get_params_from_request(request, scsi_dev_smart_schema)
    smart_set = params.get("smart", None),
    offline_set = params.get("offline_auto", None),
    scsi_dev_info.set_smart_config(smart_set,offline_set)
    return Response(status=200)
开发者ID:ntvis,项目名称:StorLever,代码行数:9,代码来源:block.py


示例10: post_lv_snapshot

def post_lv_snapshot(request):
    params = get_params_from_request(request, lv_snapshot_schema)
    vg_name = request.matchdict['vg']
    lv_name = request.matchdict['lv']
    lvm_mng = lvm.lvm_mgr()
    vg = lvm_mng.get_vg(vg_name)
    lv = vg.get_lv(lv_name)
    lv.snapshot(params['name'], params['size'])
    return Response(status=200)
开发者ID:OpenSight,项目名称:StorLever,代码行数:9,代码来源:lvm.py


示例11: post_tgt_target_iqn_list

def post_tgt_target_iqn_list(request):
    tgt_mgr = tgtmgr.TgtManager
    new_target_conf = get_params_from_request(request, target_conf_schema)
    tgt_mgr.create_target(new_target_conf["iqn"], operator=request.client_addr)

    # generate 201 response
    resp = Response(status=201)
    resp.location = request.route_url('tgt_target_info',
                                      target_iqn=new_target_conf["iqn"])
    return resp
开发者ID:OpenSight,项目名称:StorLever,代码行数:10,代码来源:san.py


示例12: add_group

def add_group(request):
    group_info = get_params_from_request(request, group_info_schema)
    user_mgr = usermgr.user_mgr()
    user_mgr.group_add(group_info["name"], group_info.get("gid"),
                       user=request.client_addr)

    # generate 201 response
    resp = Response(status=201)
    resp.location = request.route_url('group_info', group_name=group_info["name"])
    return resp
开发者ID:OpenSight,项目名称:StorLever,代码行数:10,代码来源:system.py


示例13: put_snmp_agent_monitor_info

def put_snmp_agent_monitor_info(request):
    monitor_name = request.matchdict["monitor_name"]
    snmp_agent = snmpagent.SnmpAgentManager
    monitor_info = get_params_from_request(request, snmp_monitor_mod_schema)

    snmp_agent.update_monitor_conf(
        monitor_name, monitor_info.get("expression"), monitor_info.get("option"), operator=request.client_addr
    )

    return Response(status=200)
开发者ID:dulton,项目名称:StorLever,代码行数:10,代码来源:utils.py


示例14: scan_bus

def scan_bus(request):
    scsi_mgr =  scsimgr.scsi_mgr()
    params = get_params_from_request(request, scan_bus_schema)
    remove = params.get("remove", None),
    force_rescan = params.get("force_rescan", None),
    force_remove = params.get("force_remove", None),
    if params['opt'] == "re_scan":  
        scsi_mgr.rescan_bus(params['host'], params['channels'], params['targets'],\
                             params['luns'],remove,force_rescan, force_remove)
    return Response(status=200)
开发者ID:ntvis,项目名称:StorLever,代码行数:10,代码来源:block.py


示例15: post_port_op

def post_port_op(request):
    op_info = get_params_from_request(request, port_op_schema)
    port_name = request.matchdict['port_name']
    eth_face = ifmgr.if_mgr()
    eth = eth_face.get_interface_by_name(port_name)
    if op_info["opcode"] == "enable":
        eth.up(user=request.client_addr)
    elif op_info["opcode"] == "disable":
        eth.down(user=request.client_addr)
    return Response(status=200)
开发者ID:OpenSight,项目名称:StorLever,代码行数:10,代码来源:network.py


示例16: add_bond_group

def add_bond_group(request):
    params = get_params_from_request(request, bond_add_schema)
    bond_manager = bond.bond_mgr()
    bond_name = bond_manager.add_group(params['miimon'], params['mode'], params['ifs'],
                                       params['ip'], params['netmask'], params['gateway'],
                                       request.client_addr)

    resp = Response(status=201)
    resp.location = request.route_url('bond_port', port_name=bond_name)
    return resp
开发者ID:OpenSight,项目名称:StorLever,代码行数:10,代码来源:network.py


示例17: modify_single_port

def modify_single_port(request):
    port_info = get_params_from_request(request, port_mod_schema)
    port_name = request.matchdict['port_name']
    eth_face = ifmgr.if_mgr()
    eth = eth_face.get_interface_by_name(port_name)
    eth.set_ip_config(ip=port_info.get("ip", None),
                      netmask=port_info.get("netmask", None),
                      gateway=port_info.get("gateway", None),
                      user=request.client_addr)
    return Response(status=200)
开发者ID:OpenSight,项目名称:StorLever,代码行数:10,代码来源:network.py


示例18: change_fs

def change_fs(request):
    params = get_params_from_request(request, change_fs_schema)
    fs_name = request.matchdict['fsname']
    fs_mrg = fsmgr.fs_mgr()
    fs = fs_mrg.get_fs_by_name(fs_name)
    
    if(params['opt']) == 'grow' :
        fs.grow_size()
        return Response(status=200) 
    else :
        return Response(status=403)
开发者ID:OpenSight,项目名称:StorLever,代码行数:11,代码来源:fs.py


示例19: post_vg_op

def post_vg_op(request):
    params = get_params_from_request(request, vg_op_schema)
    vg_name = request.matchdict['vg']
    lvm_mng = lvm.lvm_mgr()
    vg = lvm_mng.get_vg(vg_name)
    if(params['opt']) == 'grow' :
        vg.grow(params['dev'])
    elif(params['opt']) == 'shrink' :
        vg.shrink(params['dev'])
               
    return Response(status=200)
开发者ID:ntvis,项目名称:StorLever,代码行数:11,代码来源:lvm.py


示例20: mod_user_info

def mod_user_info(request):
    user_name = request.matchdict["user_name"]
    user_info = get_params_from_request(request)
    user_info["name"] = user_name
    user_info = user_info_schema.validate(user_info)
    user_mgr = usermgr.user_mgr()
    user_mgr.user_mod(user_info["name"], user_info.get("password"), user_info.get("uid"),
                      user_info.get("primary_group"), user_info.get("groups"),
                      user_info.get("home_dir"), user_info.get("login"),
                      user_info.get("comment"), user=request.client_addr)
    return Response(status=200)
开发者ID:OpenSight,项目名称:StorLever,代码行数:11,代码来源:system.py



注:本文中的storlever.rest.common.get_params_from_request函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python storm.emit函数代码示例发布时间:2022-05-27
下一篇:
Python logger.log函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap