mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
renew starrs during renewal, add ability to change vm cores
This commit is contained in:
parent
f3d69381c1
commit
9fa6bf051d
5 changed files with 133 additions and 15 deletions
11
proxmox.py
11
proxmox.py
|
@ -163,11 +163,11 @@ def check_user_usage(proxmox, user, vm_cpu, vm_mem, vm_disk):
|
|||
limits = get_user_usage_limits(user)
|
||||
cur_usage = get_user_usage(proxmox, user)
|
||||
if int(cur_usage['cpu']) + int(vm_cpu) > int(limits['cpu']):
|
||||
return 'Exceeds CPU limit!'
|
||||
return 'exceeds_cpu_limit'
|
||||
elif int(cur_usage['mem']) + (int(vm_mem) / 1024) > int(limits['mem']):
|
||||
return 'Exceeds memory limit!'
|
||||
return 'exceeds_memory_limit'
|
||||
elif int(cur_usage['disk']) + int(vm_disk) > int(limits['disk']):
|
||||
return 'Exceeds disk limit!'
|
||||
return 'exceeds_disk_limit'
|
||||
|
||||
|
||||
def get_user_usage_percent(proxmox, usage=None, limits=None):
|
||||
|
@ -222,6 +222,11 @@ def change_vm_power(proxmox, vmid, action):
|
|||
node.qemu(vmid).status.resume.post()
|
||||
|
||||
|
||||
def change_vm_cpu(proxmox, vmid, cores):
|
||||
node = proxmox.nodes(get_vm_node(proxmox, vmid))
|
||||
node.qemu(vmid).config.put(cores=cores)
|
||||
|
||||
|
||||
def get_isos(proxmox, storage):
|
||||
isos = []
|
||||
for iso in proxmox.nodes('proxmox01').storage(storage).content.get():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue