Esempio n. 1
0
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/')
Esempio n. 2
0
def security_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:
            securityGroupList = nova.get_security_group_list(token, daobase.getTenantOSIDByName(tName))
            return render_to_response('vh/security/security_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/')
Esempio n. 3
0
def security_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:
            securityGroupList = nova.get_security_group_list(
                token, daobase.getTenantOSIDByName(tName))
            return render_to_response('vh/security/security_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/')
Esempio n. 4
0
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/')