Verified Commit cc677815 authored by Jenny's avatar Jenny
Browse files

added support for containers

parent 3ea28f73
......@@ -10,7 +10,7 @@ import re
def print_dw_table(vmdata):
print('^ Name ^ MAC-Adressen + VLANs ^ CPU-Sockets ^ CPU-Cores ^ RAM in MB ^ PVE-Benutzer '
print('^ Name ^ Typ ^ MAC-Adressen + VLANs ^ CPU-Sockets ^ CPU-Cores ^ RAM in MB ^ PVE-Benutzer '
'^ Autostart? ^ Bemerkung ^')
for vmid, data in sorted(vmdata.items()):
line = '| '
......@@ -18,7 +18,7 @@ def print_dw_table(vmdata):
line = line + data['wikilink']
else:
line = line + '[[technik:server:{0}|{0}]]'.format(data['name'])
line = line + ' | '
line = line + ' | ' + data['type'] + ' | '
lastnet = len(data['net']) - 1
for idx, net in enumerate(sorted(data['net'])):
if idx != lastnet:
......@@ -111,11 +111,21 @@ def main():
print('Login against Proxmox-API failed!')
return 1
lxcs = pve.nodes(args.node).lxc.get()
vms = pve.nodes(args.node).qemu.get()
vmdata = dict()
for vm in vms:
if 'template' not in vm or not vm['template']:
vmdata[vm['vmid']] = dict()
vmid = int(vm['vmid'])
vmdata[vmid] = dict()
vmdata[vmid]['type'] = 'VM'
for lxc in lxcs:
vmid = int(lxc['vmid'])
vmdata[vmid] = dict()
vmdata[vmid]['type'] = 'LXC'
acls = pve.access.acl.get()
usedgroups = dict()
......@@ -129,11 +139,16 @@ def main():
memberlist.append(member)
for vmid, data in vmdata.items():
config = pve.nodes(args.node).qemu(vmid).config.get()
if data['type'] == 'VM':
config = pve.nodes(args.node).qemu(vmid).config.get()
data['sockets'] = config['sockets']
data['name'] = config['name']
else:
config = pve.nodes(args.node).lxc(vmid).config.get()
data['sockets'] = 1
data['name'] = config['hostname']
data['ram'] = config['memory']
data['sockets'] = config['sockets']
data['cores'] = config['cores']
data['name'] = config['name']
if 'onboot' in config and config['onboot'] == 1:
data['autostart'] = True
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment