Overview
Comment: | Added checks for snapshots into cmd_commit. Fixes [b5f7b7a1e8] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
34605c20d1c459004518d21ed4ba58fe |
User & Date: | vitus on 2015-12-18 14:42:22 |
Other Links: | manifest | tags |
Context
2015-12-21
| ||
08:44 | Fixed some problems appeared when integrating create into vws check-in: fe4f40d658 user: vitus tags: trunk | |
2015-12-18
| ||
14:42 | Added checks for snapshots into cmd_commit. Fixes [b5f7b7a1e8] check-in: 34605c20d1 user: vitus tags: trunk | |
13:14 | Expanded config handling. Fixes [00962e4d5d] and [381a103023] check-in: 30d9fa306e user: vitus tags: trunk | |
Changes
Modified vws from [47bc1de06d] to [550bd4a08e].
︙ | ︙ | |||
345 346 347 348 349 350 351 | os.system('qemu-img create -f qcow2 -b "%s" "%s"'%(backing,drive)) def cmd_commit(options): # # Commits last snapshot changes into it's backing file # if options.stopped: | | | | | | > | > > > > > | | | | > > | > > > | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | os.system('qemu-img create -f qcow2 -b "%s" "%s"'%(backing,drive)) def cmd_commit(options): # # Commits last snapshot changes into it's backing file # if options.stopped: # # Stoppend vm - last snapshot is commited into its backing file. # Backing file is made current drive image # os.chdir(options.dir) found=0 for drive in get_drives(options.dir): backing=get_backing(drive) if backing is None: continue found=1 os.system('qemu-img commit "%s"'%drive) os.unlink(drive) os.rename(backing,drive) if not found: print >>sys.stderr,"No snapshots exist for this VM" sys.exit(1) else: # # # Check if we are running in the snapshot mode # answer=send_command(options.sock,"info block") if re.search(": /tmp",answer): send_command(options.sock,"commit") else: print >>sys.stderr,"VM is not running in snapshot mode" sys.exit(1) template="""#!/bin/sh # Get machine name from current directory name NAME=$(basename $(pwd)) |
︙ | ︙ | |||
510 511 512 513 514 515 516 | """ Adds a subparser and adds a machine name argument to it """ p=cmds.add_parser(name,**kwargs) p.add_argument('machine',type=str,help='name of vm to operate on') return p # | | > > > < > | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | """ Adds a subparser and adds a machine name argument to it """ p=cmds.add_parser(name,**kwargs) p.add_argument('machine',type=str,help='name of vm to operate on') return p # # prepare defaults for config # arch=os.uname()[4] if re.match("i[3-9]86",arch): arch="i386" elif arch.startswith("arm"): arch="arm" config=ConfigParser({'SharedVMs':'/var/cache/vws/shared', 'AutoStartVMs':'/var/cache/vws/autostart'}) config.add_section('directories') config.add_section('create options') for option,value in [('net','user'),('size','20G'),('mem','1G'), ('diskif','virtio'),('sound','hda'),('arch',arch), ('vga','qxl')]: config.set('create options',option,value) config.add_section('tools') config.set('tools','viewer','remote-viewer %s') config.set('tools','bridge_list','/sbin/brctl show') config.set('tools','lsusb','lsusb') # Read configration files config.read(['/etc/vws.conf',os.environ['HOME']+'/.vwsrc']) # Parse argument 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') |
︙ | ︙ |