I have a relatively simple Python script which receives no results when connecting with an account that has an acl applied to '/' of PVEAuditor. I presume the issue to relate to storage not being accessible when logging in to the WebUI as that account:
Nothing shows when selecting shared storage when logged in as that user:
I'm able to view all cluster, node and VM settings though, for example:
Simple Python ProxmoxAPI script which doesn't work with this account but is fine when run with an administrator account:
Regards
David Herselman
Code:
[admin@kvm1e ~]# grep inventory@pve /etc/pve/user.cfg
user:inventory@pve:1:0:inventory:Collector::::
acl:1:/:inventory@pve:PVEAuditor:
Nothing shows when selecting shared storage when logged in as that user:
I'm able to view all cluster, node and VM settings though, for example:
Simple Python ProxmoxAPI script which doesn't work with this account but is fine when run with an administrator account:
Code:
from proxmoxer import ProxmoxAPI
from collections import defaultdict
import getpass
import csv
import pandas
proxmox = ProxmoxAPI('kvm1e.redacted', user='inventory@pve',password='*************************', verify_ssl=True)
titles = ['VMID', 'Name', 'vCPUs', 'vRAM', 'Disk']
l1 = []
l2 = []
l3 = []
l4 = []
for node in proxmox.nodes.get():
for vm in proxmox.nodes(node['node']).qemu.get():
l1.append({'VMID': vm['vmid'], 'Name': vm['name'], 'vCPU' : vm['cpus'], 'VRam' : vm['maxmem']/1073741824})
for vm in proxmox.nodes.kvm1e.storage.rbd_hdd.content.get():
l2.append({'VMID': vm['vmid'], 'Size' : vm['size']/1073741824})
c = defaultdict(int)
for d in l2:
c[d['VMID']] += d['Size']
l2 = [{'VMID': vmid, 'Size': size} for vmid, size in c.items()]
for x in l1:
for y in l2:
if int(y['VMID']) == int(x['VMID']):
l3.append((x['VMID'],x['Name'],x['vCPU'],x['VRam'],y['Size']))
pd = pandas.DataFrame(l3)
pd.to_csv('kvm1.csv',index=False,header=False)
Regards
David Herselman