mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-24 00:58:54 +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:
@ -8,10 +8,10 @@ import libxml2
|
||||
import pdb
|
||||
|
||||
def usage():
|
||||
print 'Usage: %s DIR' % sys.argv[0]
|
||||
print ' Restore all the domains contained in DIR'
|
||||
print ' It is assumed that all files in DIR are'
|
||||
print ' images of domU\'s previously created with save'
|
||||
print('Usage: %s DIR' % sys.argv[0])
|
||||
print(' Restore all the domains contained in DIR')
|
||||
print(' It is assumed that all files in DIR are')
|
||||
print(' images of domU\'s previously created with save')
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
usage()
|
||||
@ -22,15 +22,14 @@ imgs = os.listdir(dir)
|
||||
|
||||
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)
|
||||
|
||||
for img in imgs:
|
||||
file = os.path.join(dir, img)
|
||||
print "Restoring %s ... " % img,
|
||||
sys.stdout.flush()
|
||||
print("Restoring %s ... " % img)
|
||||
ret = conn.restore(file)
|
||||
if ret == 0:
|
||||
print "done"
|
||||
print("done")
|
||||
else:
|
||||
print "error %d" % ret
|
||||
print("error %d" % ret)
|
||||
|
Reference in New Issue
Block a user