rename default lvm name from lvm to vm

This commit is contained in:
deflax 2018-02-04 18:44:53 +02:00
parent aeea2cda26
commit 7a81f35c93

View file

@ -41,8 +41,8 @@ def create(json):
except Exception as e: except Exception as e:
ioconfig.logger.warning('grid> slave not predefined. I will query for a capable one.') ioconfig.logger.warning('grid> slave not predefined. I will query for a capable one.')
#slave_name = str(grid.query_happiness(region_id, weight)) #slave_name = str(grid.query_happiness(region_id, weight))
#slave_name = 'warrior' slave_name = 'warrior'
slave_name = 'lexx' #slave_name = 'lexx'
ioconfig.logger.info('{}> slave selected'.format(slave_name)) ioconfig.logger.info('{}> slave selected'.format(slave_name))
proxobject = auth(slave_name) proxobject = auth(slave_name)
real_slave_name = proxobject.cluster.status.get()[0]['name'] real_slave_name = proxobject.cluster.status.get()[0]['name']
@ -59,7 +59,7 @@ def create(json):
vm_name = unidecode(vm_name_utf8) vm_name = unidecode(vm_name_utf8)
image_name = 'vm-' + str(phy_id) + '-disk-1' image_name = 'vm-' + str(phy_id) + '-disk-1'
try: try:
local_storage = proxobject.nodes(real_slave_name).storage('lvm') local_storage = proxobject.nodes(real_slave_name).storage('vm')
storage_create_result = local_storage.content.post(vmid=phy_id, filename=image_name, size=json['hdd'] + 'G') storage_create_result = local_storage.content.post(vmid=phy_id, filename=image_name, size=json['hdd'] + 'G')
ioconfig.logger.info('%s[%s]> allocated %s as %s' % (json['clientemail'], slave_name, json['hdd'], image_name)) ioconfig.logger.info('%s[%s]> allocated %s as %s' % (json['clientemail'], slave_name, json['hdd'], image_name))
except: except:
@ -74,7 +74,7 @@ def create(json):
cores=json['cpu'], cores=json['cpu'],
memory=json['mem'], memory=json['mem'],
scsihw='virtio-scsi-pci', scsihw='virtio-scsi-pci',
scsi0='file=lvm:' + image_name + ',discard=on', scsi0='file=vm:' + image_name + ',discard=on',
net0='virtio=8A:32:CD:E4:EE:11,bridge=' + json['net0if'] + ',tag=' + str(phy_id), net0='virtio=8A:32:CD:E4:EE:11,bridge=' + json['net0if'] + ',tag=' + str(phy_id),
description=description) description=description)
except Exception as e: except Exception as e:
@ -99,7 +99,7 @@ def create(json):
vm_name = unidecode(vm_name_utf8) vm_name = unidecode(vm_name_utf8)
image_name = 'vm-' + str(phy_id) + '-disk-1' image_name = 'vm-' + str(phy_id) + '-disk-1'
#try: #try:
# local_storage = proxobject.nodes(real_slave_name).storage('lvm') # local_storage = proxobject.nodes(real_slave_name).storage('vm')
# storage_create_result = local_storage.content.post(vmid=phy_id, filename=image_name, size=json['hdd'] + 'G') # storage_create_result = local_storage.content.post(vmid=phy_id, filename=image_name, size=json['hdd'] + 'G')
# ioconfig.logger.info('%s[%s]> allocated %s as %s' % (json['clientemail'], slave_name, json['hdd'], image_name)) # ioconfig.logger.info('%s[%s]> allocated %s as %s' % (json['clientemail'], slave_name, json['hdd'], image_name))
#except: #except:
@ -121,7 +121,7 @@ def create(json):
net0='name=eth0,bridge=' + json['net0if'] + ',ip=' + json['net0ip'] + '/' + json['net0mask'], net0='name=eth0,bridge=' + json['net0if'] + ',ip=' + json['net0ip'] + '/' + json['net0mask'],
net1='name=eth1,bridge=' + json['net1if'] + ',ip=' + json['net1ip'] + '/' + json['net1mask'] + ',gw=' + json['net1gw'], net1='name=eth1,bridge=' + json['net1if'] + ',ip=' + json['net1ip'] + '/' + json['net1mask'] + ',gw=' + json['net1gw'],
ostemplate='backup:vztmpl/debian-9.0-standard_9.0-2_amd64.tar.gz', ostemplate='backup:vztmpl/debian-9.0-standard_9.0-2_amd64.tar.gz',
rootfs='volume=lvm:' + str(json['hdd']), rootfs='volume=vm:' + str(json['hdd']),
swap=32, swap=32,
description=description) description=description)
except: except: