def listStorage(request,id):
if request.method == "GET":
try:
vServer = VmServer.objects.get(id=id)
except Exception,e:
return render_to_response('404.html',context_instance=RequestContext(request))
try:
VMS = LibvirtManage(vServer.server_ip,vServer.username, vServer.passwd, vServer.vm_type)
SERVER = VMS.genre(model='server')
if SERVER:
storageList = SERVER.getVmStorageInfo()
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/list_storage.html',
{"user":request.user,"localtion":[{"name":"??","url":'/'},{"name":"?????","url":'#'},
{"name":"?????","url":"/listStorage/%d/" % vServer.id}],
"vmServer":vServer,"storageList":storageList}, context_instance=RequestContext(request))
评论列表
文章目录