mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-11 16:55:33 +00:00
migrate.py: python3: raw_input and more
There is no raw_input() in python3 -- define it as input() Use decode() when writing subprocess output to the log, to make sure the argument for write is a string (in python3 stdout.read() returns bytes). There is no has_key in python3 -- use "in" instead Signed-off-by: Uri Lublin <uril@redhat.com>
This commit is contained in:
parent
d109bd3577
commit
7318565ecc
@ -47,6 +47,10 @@ import datetime
|
||||
import atexit
|
||||
import argparse
|
||||
|
||||
# python3 does not have raw_input
|
||||
if sys.version_info[0] == 3:
|
||||
raw_input = input
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(description='Process some integers.')
|
||||
parser.add_argument('--qmp1', dest='qmp1', default='/tmp/migrate_test.1.qmp')
|
||||
@ -125,7 +129,7 @@ def wait_active(q, active):
|
||||
# ValueError
|
||||
time.sleep(0.1)
|
||||
continue
|
||||
if ret and ret.has_key("return"):
|
||||
if ret and "return" in ret.keys():
|
||||
if ret["return"]["running"] == active:
|
||||
break
|
||||
for e in q.get_events():
|
||||
@ -213,7 +217,8 @@ class Migrator(object):
|
||||
new_spice_port = dead.spice_port
|
||||
new_qmp_filename = dead.qmp_filename
|
||||
self.log.write("# STDOUT dead %s\n" % dead.pid)
|
||||
self.log.write(dead.stdout.read())
|
||||
outstr = dead.stdout.read().decode(encoding='utf-8', errors='ignore')
|
||||
self.log.write(outstr)
|
||||
del dead
|
||||
self.active = self.target
|
||||
self.target = start_qemu(spice_port=new_spice_port,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user