mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
add ability to set and reset user usage limits
This commit is contained in:
parent
79fff2e762
commit
05e08fb92d
7 changed files with 248 additions and 13 deletions
16
proxmox.py
16
proxmox.py
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue