summaryrefslogtreecommitdiffstats
path: root/tests/basic.py
blob: a4ff4c4931c36b24ec473e1c4e79059799798d7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python -u
import libvirt
import sys

conn = libvirt.openReadOnly(None)
if conn == None:
    print 'Failed to open connection to the hypervisor'
    sys.exit(1)

# print conn

dom0 = conn.lookupByName("Domain-0")
if dom0 == None:
    print 'Failed to find the main domain'
    sys.exit(1)

# print dom0

print "Domain 0: id %d running %s" % (dom0.ID(), dom0.OSType())
print dom0.info()
del dom0
del conn
print "OK"

sys.exit(0)