1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-02 04:21:59 +03:00

examples: Invoke print("...") instead of print "..."

The 'print' method must be called as a function in python3,
ie with brackets.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange
2013-12-03 15:34:56 +00:00
parent bb3301ba78
commit 3f4e32c6a1
8 changed files with 82 additions and 85 deletions

View File

@ -20,11 +20,11 @@ def read_domain(fname):
return (name, xmldesc)
def usage():
print 'Usage: %s domain.xml' % sys.argv[0]
print ' Check that the domain described by DOMAIN.XML is running'
print ' If the domain is not running, create it'
print ' DOMAIN.XML must be a XML description of the domain'
print ' in libvirt\'s XML format'
print('Usage: %s domain.xml' % sys.argv[0])
print(' Check that the domain described by DOMAIN.XML is running')
print(' If the domain is not running, create it')
print(' DOMAIN.XML must be a XML description of the domain')
print(' in libvirt\'s XML format')
if len(sys.argv) != 2:
usage()
@ -34,17 +34,16 @@ if len(sys.argv) != 2:
conn = libvirt.open(None)
if conn is None:
print 'Failed to open connection to the hypervisor'
print('Failed to open connection to the hypervisor')
sys.exit(1)
try:
dom = conn.lookupByName(name)
except libvirt.libvirtError:
print "Starting domain %s ... " % name,
sys.stdout.flush()
print("Starting domain %s ... " % name)
dom = conn.createLinux(xmldesc, 0)
if dom is None:
print "failed"
print("failed")
sys.exit(1)
else:
print "done"
print("done")