Overview
Comment: | Added try-finally to the vws command execution. Fixes [5a1bd05199] |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
daa18d8131ea5abb48005576e2ff32d1 |
User & Date: | vitus on 2015-12-18 05:26:38.356 |
Other Links: | manifest | tags |
Context
2015-12-18
| ||
08:32 | Added function list_briges which disappeared somewhere when create command was incorporated in vws script check-in: 155c39c9b5 user: vitus tags: trunk | |
05:26 | Added try-finally to the vws command execution. Fixes [5a1bd05199] check-in: daa18d8131 user: vitus tags: trunk | |
2015-12-17
| ||
14:31 | Incremented version number to 0.2 check-in: b07302139d user: vitus tags: trunk | |
Changes
Deleted start.template version [92da85b8ac].
Modified vws
from [efb0c40873]
to [c15e09c135].
︙ | ︙ | |||
258 259 260 261 262 263 264 | result.append(m.group(1)) return result def cmd_snapshot(options): import os.path if not options.stopped: print >>sys.stderr,"Cannot make snapshot of running VW" | | | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | result.append(m.group(1)) return result def cmd_snapshot(options): import os.path if not options.stopped: print >>sys.stderr,"Cannot make snapshot of running VW" sys.exit(1) drives=get_drives(options.dir) os.chdir(options.dir) newnames={} for i in drives: name,ext=os.path.splitext(i) newnames[i]=name+"."+options.snapname+"."+ext if os.path.exists(newnames[i]): |
︙ | ︙ | |||
304 305 306 307 308 309 310 | return m.group(1) return None def cmd_revert(options): # Removes latest snapshot images and creates new ones instead if not options.stopped: print >>sys.stderr,"Cannot revert running VW to snapshot" | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | return m.group(1) return None def cmd_revert(options): # Removes latest snapshot images and creates new ones instead if not options.stopped: print >>sys.stderr,"Cannot revert running VW to snapshot" sys.exit(1) os.chdir(options.dir) for drive in get_drives(options.dir): # Check if first has backing file backing=get_backing(drive) if not backing: print >>sys.stderr,"Drive %s has no snapshots"%drive continue |
︙ | ︙ | |||
497 498 499 500 501 502 503 | config=ConfigParser({'SharedVMs':'/var/cache/vws/shared', 'AutoStartVMs':'/var/cache/vws/autostart'}) config.add_section('directories') config.read(['/etc/vws.conf',os.environ['HOME']+'/.vwsrc']) | | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | config=ConfigParser({'SharedVMs':'/var/cache/vws/shared', 'AutoStartVMs':'/var/cache/vws/autostart'}) config.add_section('directories') config.read(['/etc/vws.conf',os.environ['HOME']+'/.vwsrc']) args=ArgumentParser(description="Manage Virtual Workstations") cmds=args.add_subparsers(dest='command',help="sub-command help") p=cmds.add_parser("list",help="List existing VWs",description="List existing VWs") p.add_argument("--state",action='store_const',const=True,default=False, dest='state',help='Show state of the machine') p.add_argument("--addr",action='store_const',const=True,default=False, dest='addr',help='Show mac address and spice port') p.add_argument("--usb",action='store_const',const=True,default=False, |
︙ | ︙ | |||
557 558 559 560 561 562 563 | # Screenshoits and recording p=new_command(cmds,'screenshot',help='take a screenshot') 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') # Create new VM | | | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | # Screenshoits and recording p=new_command(cmds,'screenshot',help='take a screenshot') 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') # 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",dest="size",default="20G"); p.add_argument("--arch",metavar='cputype',help="Emulated architecture",dest="arch",default='x86_64'); p.add_argument("--no-sound",help="Disable sound card",action='store_const',const = None,default='hda', dest="sound") p.add_argument("--sound",metavar='cardtype',help="Specify sound card type",dest='sound',default='hda') p.add_argument("--vga",metavar='cardtype',help="specify video card type (cirrus,std,vmwae,qxl) default qxl",dest="vga",default="qxl") p.add_argument("--net",help="Network - 'user' or bridge name",dest='net',default="user") p.add_argument("--mem",metavar='size',help="Size of memory",dest="mem",default="1024M") p.add_argument("--diskif",metavar='interface-type',help="Disk interface (virtio, scsi, ide)",choices=['virtio','scsi','ide'],dest="diskif",default="virtio") p.add_argument('--shared',help='Create shared VW instead of private one',action='store_const',const= True,dest='shared',default=False) p.add_argument('--image',metavar='filename',help='Existing disk image to import',dest='image',default=None) p.add_argument('--install',metavar='filename.iso',help='ISO image to install OS from',dest='install',default=None) # Miscellenia p=new_command(cmds,'monitor',help='connect stdin/stdout to monitor of VM') p=new_command(cmds,'spiceuri',help='Output spice URI of machine') parsed_args=args.parse_args(sys.argv[1:]) |
︙ | ︙ | |||
595 596 597 598 599 600 601 | print >>sys.stderr, "Virtual machine %s is not running."%parsed_args.machine sys.exit(1) else: parsed_args.stopped = True funcname="cmd_"+parsed_args.command | > | | | | | | | | > | | | | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | print >>sys.stderr, "Virtual machine %s is not running."%parsed_args.machine sys.exit(1) else: parsed_args.stopped = True funcname="cmd_"+parsed_args.command try: if hasattr(parsed_args,"subcommand"): funcname+="_"+parsed_args.subcommand try: func=globals()[funcname] except KeyError: print >>sys.stderr,"Operation %s is not implemented"%funcname sys.exit(3) func(parsed_args) finally: if hasattr(parsed_args,'sock') and parsed_args.sock is not None: parsed_args.sock.shutdown(socket.SHUT_RDWR) parsed_args.sock.close() |
Added vws.mkd version [83850157de].