summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2012-03-04 23:11:02 +0200
committerAlon Levy <alevy@redhat.com>2012-03-04 23:11:02 +0200
commit7390f6acb02c6229ab2287c9e0059811d8f52876 (patch)
tree09a8a71c15100c7bf8f551d4fb9a408cac26cf3a
parentcf036a452c277599e71875973ccc8be410e26525 (diff)
host_subject probably broken. small fixes for easy library usage for bz750682
-rwxr-xr-xspice_migrate.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/spice_migrate.py b/spice_migrate.py
index 9f66f17..f6cfbe2 100755
--- a/spice_migrate.py
+++ b/spice_migrate.py
@@ -68,6 +68,7 @@ def get_args():
parser.add_argument('--vdagent', choices=['on', 'off'], default='on')
parser.add_argument('--usbtablet', choices=['on', 'off'], default='on')
parser.add_argument('--secure', choices=['on', 'off'], default='off')
+ parser.add_argument('--host-subject', default=None)
parser.add_argument('--sleep', default=20, type=float)
parser.add_argument('--glib', default=False, action='store_true')
parser.add_argument('--gtk', default=False, action='store_true')
@@ -369,13 +370,13 @@ class Migrator(object):
return False
single()
-def start_migrator(args, extra_args, extra_per_vm):
+def start_migrator(log, args, extra_args, extra_per_vm):
migrator = Migrator(client=args.client, qemu_exec=args.qemu_exec,
image=args.image, log=log, monitor_files=[args.qmp1, args.qmp2],
migration_port=args.migrate_port, spice_ports=[args.spice_port1,
args.spice_port2], client_count=args.client_count, vdagent=(args.vdagent=='on'),
usbtablet=(args.usbtablet=='on'),
- secure=(args.secure=='on'), host_subject=host_subject,
+ secure=(args.secure=='on'), host_subject=args.host_subject,
extra_args=extra_args, extra_per_vm=extra_per_vm, sound=False)
atexit.register(cleanup, migrator)
return migrator
@@ -402,15 +403,15 @@ def qmp_gui(args, migrator):
migrator.on_migrate = on_migrate
return mainloop
-def main_gui(args, extra_args, extra_per_vm=([], [])):
- migrator = start_migrator(args=args, extra_args=extra_args,
+def main_gui(log, args, extra_args, extra_per_vm=([], [])):
+ migrator = start_migrator(log=log, args=args, extra_args=extra_args,
extra_per_vm=extra_per_vm)
migrator.start_clients()
mainloop = qmp_gui(args, migrator)
mainloop.run()
-def main_console(args, extra_args):
- migrator = start_migrator(args, extra_args=extra_args,
+def main_console(log, args, extra_args):
+ migrator = start_migrator(log=log, args=args, extra_args=extra_args,
extra_per_vm=([], []))
if args.glib:
migrator.loop(args.sleep*1000)
@@ -431,11 +432,11 @@ if __name__ == '__main__':
if args.secure == 'on':
if any([not os.path.exists(f) for f in "ca-key.pem ca-cert.pem server-cert.pem server-key.pem".split()]):
os.system('./spice_make_certs.sh')
- host_subject = ','.join(os.popen('openssl x509 -noout -text -in server-cert.pem | grep Subject: | cut -f 10- -d " "').read().strip().split(', '))
+ args.host_subject = ','.join(os.popen('openssl x509 -noout -text -in server-cert.pem | grep Subject: | cut -f 10- -d " "').read().strip().split(', '))
print "log file %s" % args.log_filename
log = open(args.log_filename, "a+")
log.write("# "+str(datetime.datetime.now())+"\n")
if args.gtk:
- main_gui(args, extra_args)
+ main_gui(log, args, extra_args)
else:
- main_console(args, extra_args)
+ main_console(log, args, extra_args)