def data_process_launch(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: files = request.session.get('col_cart', False) if files: fileList = files.split(';') fileList.remove('') else: fileList = [] count = len(fileList) files = request.session.get('col_algo', False) if files: fileList = files.split(';') fileList.remove('') else: fileList = [] counta = len(fileList) project = tName flavorList = nova.get_flavor_list(token, daobase.getTenantOSIDByName(tName)) return render_to_response('dp/process_launch.html', locals(), RequestContext(request)) else: messages.add_message(request, messages.ERROR, 'select your project.') return redirect('/dataProcessing/project/select/') else: messages.add_message(request, messages.WARNING, 'Please login first.', 'WARNING') return redirect('/login/')
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/')
def flavor_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: flavorList = nova.get_flavor_list(token, daobase.getTenantOSIDByName(tName)) return render_to_response('vh/flavor/flavor_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/')
def flavor_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: flavorList = nova.get_flavor_list( token, daobase.getTenantOSIDByName(tName)) return render_to_response('vh/flavor/flavor_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/')
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/')
def data_process_launch_submit(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: files = request.session.get('col_cart', False) if files: fileList = files.split(';') fileList.remove('') else: fileList = [] algos = request.session.get('col_algo', False) if algos: algoList = algos.split(';') algoList.remove('') else: algoList = [] output = request.POST['processOutput'] processName = request.POST['processName'] image = "http://192.168.0.50:9292/v2/images/be5823fe-d2bd-4de1-af40-7d09733fab5c" flavorURL = "http://192.168.0.51:8774/v2/%s/flavor/%s" % ( daobase.getTenantOSIDByName(tName), request.POST['serverFlavor']) serverCount = request.POST['serverCount'] serverLabel = request.POST['serverLabel'] serverMeta = 'defaultServerMeta' hadoopMeta = 'defaultHadoopMeta' if(algos and files): flag = daozo.data_processing_launch(processName, tName, lName, algos, files, output, serverLabel, int(serverCount), flavorURL, serverMeta, hadoopMeta) else: messages.add_message(request, messages.ERROR, 'please check datas and algos.') flag = False if flag: processid = daobase.getDataProcessingIDByName(processName) hadoopController.hadoop(token, daobase.getTenantOSIDByName(tName), processid, processName, int(serverCount), serverLabel, image, flavorURL, files, algos, output, serverMeta, hadoopMeta) try: del request.session['col_cart'] del request.session['col_algo'] messages.add_message(request, messages.SUCCESS, 'data processing launch successful.') return redirect('/dataProcessing/monitor/%s/' % (processid)) except: messages.add_message(request, messages.ERROR, 'data processing launch failedddd.') return redirect('/dataProcessing/launch/') else: count = len(fileList) counta = len(algoList) project = tName flavorList = nova.get_flavor_list(token, daobase.getTenantOSIDByName(tName)) messages.add_message(request, messages.ERROR, 'something wrong.') return render_to_response('dp/process_launch.html', locals(), RequestContext(request)) else: messages.add_message(request, messages.ERROR, 'select your project.') return redirect('/dataProcessing/project/select/') else: messages.add_message(request, messages.WARNING, 'Please login first.', 'WARNING') return redirect('/login/')