vStorage.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:VManagePlatform 作者: welliamcao 项目源码 文件源码
def viewStorage(request,id,name): 
    if request.method == "GET":
        try:
            vServer = VmServer.objects.get(id=id)
        except:
            return render_to_response('404.html',context_instance=RequestContext(request))        
        try:
            VMS = LibvirtManage(vServer.server_ip,vServer.username, vServer.passwd, vServer.vm_type)
            STORAGE = VMS.genre(model='storage')
            if STORAGE:
                storage = STORAGE.getStorageInfo(name)
                VMS.close()
            else:return render_to_response('404.html',context_instance=RequestContext(request))
        except Exception,e:
            return render_to_response('404.html',context_instance=RequestContext(request))    
        return render_to_response('vmStorage/view_storage.html',
                                  {"user":request.user,"localtion":[{"name":"??","url":'/'},{"name":"?????","url":'#'},
                                                                    {"name":"?????","url":"/listStorage/%d/" % vServer.id},
                                                                    {"name":"?????","url":"/viewStorage/%d/%s/" % (vServer.id,name)}],
                                    "vmServer":vServer,"storage":storage}, context_instance=RequestContext(request))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号