Overview
Comment: | Fixed [edb14da425] - remove partially created VM if creation fails |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
46aebd7c092fe18f8ea0c9d480ab8af5 |
User & Date: | vitus on 2017-01-14 16:34:49 |
Other Links: | manifest | tags |
Context
2017-01-14
| ||
16:48 | Removed files no more planned to develop. Added target to create orig.tar.bz2 check-in: 47e3e4a17d user: vitus tags: trunk | |
16:34 | Fixed [edb14da425] - remove partially created VM if creation fails check-in: 46aebd7c09 user: vitus tags: trunk | |
15:33 | Don't try to start spice client if DISPLAY env var doesn't present check-in: 7a641a0a0e user: vitus tags: trunk | |
Changes
Modified vws from [55b3a303d0] to [fff489ba36].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | - + | #!/usr/bin/python """ vws - script to control QEMU/KVM virtual workstations """ # pylint: disable=bad-builtin from ConfigParser import ConfigParser from argparse import ArgumentParser, Namespace import fcntl import socket, select import errno import re import os, sys, time, os.path import pwd |
︙ | |||
177 178 179 180 181 182 183 184 185 186 187 188 189 190 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | + + | arg = "" if options.cdrom: arg = " -cdrom " + os.path.abspath(options.cdrom[0]) if options.snapshot: arg = arg+" -snapshot" if options.args: arg = arg + " " + "".join(options.args) if options.password: os.environ["SPICE_PASSWORD"]=options.password print arg cwd = os.getcwd() os.chdir(options.dir) # Check for snapshot nxt = 0 snapshot_id = None with os.popen("qemu-img info \"%s\"" % |
︙ | |||
203 204 205 206 207 208 209 | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | - + | os.system("./start%s" % arg) os.chdir(cwd) time.sleep(2) options.sock = connect_vm(options.dir) if snapshot_id: send_command(options.sock, "delvm " + snapshot_id) else: |
︙ | |||
685 686 687 688 689 690 691 | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | - + - - + - - + - - + + - | """ 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 if not parsed_args.image and not validate_size(parsed_args.size): |
︙ | |||
745 746 747 748 749 750 751 | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | - - + + - + - + | options["memory"] = parsed_args.mem if parsed_args.localtime: options["rtc"] = "-rtc base=localtime,clock=host \\\n" if os.path.exists(machinedir): if os.path.exists(os.path.join(machinedir, "start")): |
︙ | |||
871 872 873 874 875 876 877 878 879 880 881 882 883 884 | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | + + | default=True, help='do not open console window') p.add_argument('--cdrom', metavar='filename.iso', dest='cdrom', nargs=1, help='connect specified iso image to VMs cdrom on start') p.add_argument('--args', metavar='string', dest='args', nargs=1, default="", help="Specify extra QEMU options") p.add_argument("--snapshot", action='store_const', const=True, default=False, help="Run without modifying disk image") p.add_argument("--password", metavar='string', dest='password',nargs=1, default=None, help="Set password for remote spice connection") p = new_command(cmds, 'stop', help='Shut down virtual machine', description="Terminate the VW, gracefully or ungracefully") p.add_argument('--hard', help='Power off immediately', action='store_const', dest='hard', const=True, default=False) new_command(cmds, 'save', help='Save VW state and stop emulation', description="Save VW state and stop emulation") new_command(cmds, 'reset', help='Reboot a guest OS', |
︙ | |||
960 961 962 963 964 965 966 | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | + - + + + + + + + | p = new_command(cmds, 'spiceuri', help='Output spice URI of machine') parsed_args = args.parse_args(sys.argv[1:]) os.umask(002) # Create command is totally different, so it is handled separately if parsed_args.command == 'create': try: |
︙ |