json
This commit is contained in:
parent
e93bf16bf7
commit
b03ad0df9a
4
main.py
4
main.py
@ -1,14 +1,14 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
from bottle import run, route, request, template,get ,post
|
from bottle import run, route, request, template,get ,post
|
||||||
import libvirt
|
import libvirt, json
|
||||||
session = libvirt.open('qemu:///system')
|
session = libvirt.open('qemu:///system')
|
||||||
|
|
||||||
def listVDS():
|
def listVDS():
|
||||||
VdsListVar = list()
|
VdsListVar = list()
|
||||||
for domain in session.listAllDomains(0):
|
for domain in session.listAllDomains(0):
|
||||||
VdsListVar.append(dict(name=domain.name(),state=domain.isActive()))
|
VdsListVar.append(dict(name=domain.name(),state=domain.isActive()))
|
||||||
return VdsListVar
|
return json.dumps(VdsListVar)
|
||||||
|
|
||||||
@route('/')
|
@route('/')
|
||||||
def index():
|
def index():
|
||||||
|
Loading…
Reference in New Issue
Block a user