rename default lvm name from vm to lvm

This commit is contained in:
deflax 2018-02-04 20:30:32 +02:00
parent 7a81f35c93
commit 52828f6ca6

View file

@ -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('vm') local_storage = proxobject.nodes(real_slave_name).storage('lvm')
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=vm:' + image_name + ',discard=on', scsi0='file=lvm:' + 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('vm') # local_storage = proxobject.nodes(real_slave_name).storage('lvm')
# 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=vm:' + str(json['hdd']), rootfs='volume=lvm:' + str(json['hdd']),
swap=32, swap=32,
description=description) description=description)
except: except: