add ability to set and reset user usage limits

This commit is contained in:
Jordan Rodgers 2017-12-11 17:45:58 -05:00
parent 79fff2e762
commit 05e08fb92d
7 changed files with 248 additions and 13 deletions

View file

@ -1,5 +1,6 @@
import time
from proxmoxer import ProxmoxAPI
from db import *
def connect_proxmox(host, user, password):
@ -119,14 +120,6 @@ def get_vm_iso(proxmox, vmid, config=None):
return iso
def get_user_usage_limits(user):
limits = dict()
limits['cpu'] = 4
limits['mem'] = 4
limits['disk'] = 100
return limits
def get_user_usage(proxmox, user):
usage = dict()
usage['cpu'] = 0
@ -247,3 +240,10 @@ def eject_vm_iso(proxmox, vmid):
def mount_vm_iso(proxmox, vmid, iso):
node = proxmox.nodes(get_vm_node(proxmox, vmid))
node.qemu(vmid).config.post(ide2="{},media=cdrom".format(iso))
def get_pools(proxmox):
pools = []
for pool in proxmox.pools.get():
pools.append(pool['poolid'])
return pools