fixing vmcreate

This commit is contained in:
deflax 2016-11-03 06:22:47 +02:00
parent f0a1efe454
commit 234c754444

View file

@ -70,16 +70,16 @@ def vmcreate(req):
vm_pass = 'kvm-no-pass'
#generators
slave_name = 'lexx' #staic route
#slave_name = str(grid.query_happiness(region_id, weight)) #TODO: provide weight parameters here and calculate route
vmid = 4500
slave_name = 'lexx' #staic route
#vmid = str(grid.generate_vmid()) #TODO: this should be between 100 and 65000
vmid = random.randint(200, 62000)
cube_id = time.time() #TODO: make sure this is unique. time since epoch is not random enough but should do the trick for now
ipv4_list = grid.generate_ipv4(req['region'], req['vps_ipv4'])
#metadata
deploy = { 'cube': int(cube_id),
'type': req['type'],
'type': req['vps_type'],
'host': vm_name,
'region': region_fullname,
'slave': slave_name,
@ -92,7 +92,7 @@ def vmcreate(req):
'ipv4': ipv4_list }
proxobject = auth(slave_name)
slave_name = proxobject.cluster.status.get()[0]['name']
#slave_name = proxobject.cluster.status.get()[0]['name']
ipv4_dict = {}
ipidx = 0
@ -116,7 +116,7 @@ def vmcreate(req):
name=vm_name,
sockets=1,
cores=req['vps_cpu'],
memory=req['vps_ram'],
memory=req['vps_mem'],
virtio0='lvm:' + image_name,
ide1='skyblue:iso/' + req['vps_os'] + ',media=cdrom',
net0='e1000,bridge=pub',
@ -129,7 +129,7 @@ def vmcreate(req):
password=vm_pass,
sockets=1,
cores=req['vps_cpu'],
memory=req['vps_ram'],
memory=req['vps_mem'],
virtio0='lvm:' + image_name,
ip_address=vm_ipv4[0],
onboot=1,