def Destroy_Domain():
	args = request.args
        vm_id=args['vmid']
        vm_id1=int (vm_id)
        ans= CreateVM.destroy_domain(vm_id1,machine_list)
       
        if ans=="1":
	   st={"status":1}
	   n=json.dumps(st)
	   m=json.loads(n)
	   return jsonify(m)
	else:
	   st={"status":0}
	   n=json.dumps(st)
	   m=json.loads(n)
	   return jsonify(m)        
예제 #2
0
def Destroy_Domain():
    args = request.args
    vm_id = args['vmid']
    vm_id1 = int(vm_id)
    ans = CreateVM.destroy_domain(vm_id1, machine_list)

    if ans == "1":
        st = {"status": 1}
        n = json.dumps(st)
        m = json.loads(n)
        return jsonify(m)
    else:
        st = {"status": 0}
        n = json.dumps(st)
        m = json.loads(n)
        return jsonify(m)
def getQuery():
	 
	      answer_list=[]
              args = request.args
	      vm_id=args['vmid']
	      vm_id1=int (vm_id)
	      ans=CreateVM.domain_query(vm_id1)
              #print answer_list
              
              if(len(ans)>0):
                        	 m={'vmid':(ans[0]),'name':(ans[1]),'instance_type':(ans[2]),'pmid':(ans[3])}
				 n=json.dumps(m)
				 o=json.loads(n)
			         return jsonify(o)
              
			 
              else: 
                     return ("ERROR : Maybe some problem with the parameters")
def getParams():
	 
	      args = request.args
# print (args)
	      name1 = args['name']
	      instance_type1 = args['instance_type']
	      image_id1=args['image_id']
	      
	      #print name1
	      #print instance_type1
              #print image_id1
              #return ("<h2> name is "+ name1+" instance is "+instance_type1 + " image id is " + image_id1+ " </h2>")
	      ans= CreateVM.create_domain(name1,instance_type1,image_id1,machine_list,image_list,Vdesc,info)
	      m={'tr':'+','fl':'0'}
	      ans=str(ans)
	      n = json.dumps(m)
	      o=json.loads(n)
	      if ans=="0":
			return (o['fl'])
	      else:
			return (o['tr'])	    
예제 #5
0
def getQuery():

    answer_list = []
    args = request.args
    vm_id = args['vmid']
    vm_id1 = int(vm_id)
    ans = CreateVM.domain_query(vm_id1)
    #print answer_list

    if (len(ans) > 0):
        m = {
            'vmid': (ans[0]),
            'name': (ans[1]),
            'instance_type': (ans[2]),
            'pmid': (ans[3])
        }
        n = json.dumps(m)
        o = json.loads(n)
        return jsonify(o)

    else:
        return ("ERROR : Maybe some problem with the parameters")
예제 #6
0
def getParams():

    args = request.args
    # print (args)
    name1 = args['name']
    instance_type1 = args['instance_type']
    image_id1 = args['image_id']

    #print name1
    #print instance_type1
    #print image_id1
    #return ("<h2> name is "+ name1+" instance is "+instance_type1 + " image id is " + image_id1+ " </h2>")
    ans = CreateVM.create_domain(name1, instance_type1, image_id1,
                                 machine_list, image_list, Vdesc, info)
    m = {'tr': '+', 'fl': '0'}
    ans = str(ans)
    n = json.dumps(m)
    o = json.loads(n)
    if ans == "0":
        return (o['fl'])
    else:
        return (o['tr'])