Index: vws ================================================================== --- vws +++ vws @@ -1,9 +1,8 @@ #!/usr/bin/python """ vws - script to control QEMU/KVM virtual workstations """ # pylint: disable=bad-builtin -# pylint: good-names: i,j,k,f,r,ex from ConfigParser import ConfigParser from argparse import ArgumentParser, Namespace import fcntl import socket, select import errno @@ -19,11 +18,11 @@ for dirname in search_path: if not os.access(dirname, os.X_OK): continue if (name in os.listdir(dirname) and os.access(os.path.join(dirname, name, "start"), os.X_OK)): - return os.path.join(dirname, name) + return os.path.join(dirname, name) raise ValueError("Machine %s not found." % name) def connect_vm(vm_dir): """ Connects to monitor of VM in vm_dir and returns connected socket""" @@ -358,12 +357,12 @@ else: print send_command(options.sock, "stopcapture " + match.group(1)) def cmd_sendkey(options): """ vws sendkey """ - print send_command(options.sock,"sendkey "+options.keyspec); - + print send_command(options.sock, "sendkey " + options.keyspec) + def cmd_version(dummy_options): """ vws cersion """ print VERSION @@ -509,11 +508,11 @@ """ def cmd_create(parsed_args): """ vws create - create new VM """ BADSIZE = "Invalid size of %s specifed %s. Should have K, M or G suffix" - global TEMPLATE + global TEMPLATE if not parsed_args.image and not validate_size(parsed_args.size): print >>sys.stderr, BADSIZE % ("disk", parsed_args.size) sys.exit(1) if not validate_size(parsed_args.mem): print >>sys.stderr, BADSIZE % ("memory", parsed_args.size) @@ -545,11 +544,11 @@ sys.exit(1) options["net"] = ("-net nic,macaddr=%s -net bridge,br=%s" % (macaddr, parsed_args.net)) else: options["net"] = "-net nic,macaddr=%s -net user" % (macaddr,) - options["qemubinary"] = 'qemu-system-'+parsed_args.arch + options["qemubinary"] = 'qemu-system-' + parsed_args.arch options["vga"] = parsed_args.vga NOACCEL = "KVM acceleration disabled due to " if not parsed_args.arch in ('i386', 'x86_64'): print >>sys.stderr, NOACCEL + "target architecture" options.accel = '' @@ -578,11 +577,11 @@ # Creating directory for VM os.makedirs(machinedir, dirmode) driveopts = {"interface":parsed_args.diskif, "image":drivename} if parsed_args.install: install_image = os.path.abspath(parsed_args.install) - + if parsed_args.image: # Copying image file print >>sys.stderr, ("Copying %s to %s" % (parsed_args.image, os.path.join(machinedir, drivename))) @@ -717,11 +716,11 @@ p.add_argument('filename', help='PPM image filename to write screenshot to') p = new_command(cmds, 'record', help='Record audio output from VM') p.add_argument('filename', help='wav file to record autdio to') new_command(cmds, 'stoprecord', help='stop recording audio') p = new_command(cmds, 'sendkey', help='Send a keystroke to VM') -p.add_argument('keyspec',help='key specification like ctrl-alt-delete'); +p.add_argument('keyspec', help='key specification like ctrl-alt-delete') # Create new VM p = new_command(cmds, 'create', help="Create new VW") p.add_argument("--no-usb", help="Disable USB controller", action='store_const', const=False, default=True, dest="usb") p.add_argument("--size", metavar='size', help="Size of primary disk images",