コード例 #1
0
ファイル: views.py プロジェクト: honj51/dataservice2
def image_list(request):
    lName = request.session.get('name', False)
    tName = request.session.get('tenant', False)
    token = request.session.get('token', False)
    if lName:
        if tName and token:
            imageList = glance.get_image_list(token)
            return render_to_response('vh/image/image_list.html', locals(), RequestContext(request))
        else:
            messages.add_message(request, messages.ERROR, 'select your project.')
            return redirect('/virtualHost/project/select/')
    else:
        messages.add_message(request, messages.WARNING, 'Please login first.', 'WARNING')
        return redirect('/login/')
コード例 #2
0
def image_list(request):
    lName = request.session.get('name', False)
    tName = request.session.get('tenant', False)
    token = request.session.get('token', False)
    if lName:
        if tName and token:
            imageList = glance.get_image_list(token)
            return render_to_response('vh/image/image_list.html', locals(),
                                      RequestContext(request))
        else:
            messages.add_message(request, messages.ERROR,
                                 'select your project.')
            return redirect('/virtualHost/project/select/')
    else:
        messages.add_message(request, messages.WARNING, 'Please login first.',
                             'WARNING')
        return redirect('/login/')
コード例 #3
0
ファイル: views.py プロジェクト: honj51/dataservice2
def server_creat(request):
    lName = request.session.get('name', False)
    tName = request.session.get('tenant', False)
    token = request.session.get('token', False)
    if lName:
        if tName and token:
            sourceTypeList = [{'key':'Image', 'value':'Image'},
                          {'key':'Snapshot', 'value':'Snapshot'}]
            imageList = glance.get_image_list(token)
            snapshotList = glance.get_server_snapshot_list(token)
            flavorList = nova.get_flavor_list(token, daobase.getTenantOSIDByName(tName))
            keypairList = nova.get_keypair_list(token, daobase.getTenantOSIDByName(tName))
            securityGroupList = nova.get_security_group_list(token, daobase.getTenantOSIDByName(tName))
            return render_to_response('vh/server/server_create.html', locals(), RequestContext(request))
        else:
            messages.add_message(request, messages.ERROR, 'select your project.')
            return redirect('/virtualHost/project/select/')
    else:
        messages.add_message(request, messages.WARNING, 'Please login first.', 'WARNING')
        return redirect('/login/')