Overview
Comment: | Fix working without /home/vitus env var. Fixes [370911207add19] . Add full path to vws script into service file. Autostart from systemd now works |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
83e14cb5366b899a0fddac6a911ba2fa |
User & Date: | vitus on 2017-01-13 15:09:46 |
Original Comment: | Fix working without /home/vitus env var. Fixes #370911207add19. Add full path to vws script into service file. Autostart from systemd now works |
Other Links: | manifest | tags |
References
2017-01-13
| ||
15:11 | • Fixed ticket [370911207a]: vws autostart fails if no HOME env var in the environment plus 5 other changes artifact: 8d751d27b3 user: vitus | |
Context
2017-01-13
| ||
19:42 | Added support for machine name patterns in the list command. Added preprocessing of vws.service.in check-in: cd20fc353b user: vitus tags: trunk | |
15:09 | Fix working without /home/vitus env var. Fixes [370911207add19] . Add full path to vws script into service file. Autostart from systemd now works check-in: 83e14cb536 user: vitus tags: trunk | |
2017-01-09
| ||
16:24 | Incremented delay waiting for unsolicited prompt upon connect check-in: 34d65aa483 user: vitus tags: trunk | |
Changes
Modified vws from [46101f1ba1] to [bd152d8839].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/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 VERSION = 0.4 def find_vm(name): """ Search and return VM directory """ | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/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 VERSION = 0.4 def find_vm(name): """ Search and return VM directory """ search_path = [os.path.join(pwd.getpwuid(os.getuid()).pw_dir, "VWs"), config.get("directories", "SharedVMs"), config.get("directories", "AutostartVMs")] 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)): |
︙ | ︙ | |||
353 354 355 356 357 358 359 | address = find_usb(options, get_vm_devices(options.sock)) answer = send_command(options.sock, "usb_del %s" % address) print answer def cmd_list(options): """ vws list """ count = 0 | | | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | address = find_usb(options, get_vm_devices(options.sock)) answer = send_command(options.sock, "usb_del %s" % address) print answer def cmd_list(options): """ vws list """ count = 0 search_path = [("private",os.path.join(pwd.getpwuid(os.getuid()).pw_dir, "VWs")), ("shared",config.get("directories", "SharedVMs")), ("autostart",config.get("directories", "AutostartVMs"))] maxlen = 0 vms = [] bridges = set() for (vmtype,dirname) in search_path: |
︙ | ︙ | |||
545 546 547 548 549 550 551 | print >>sys.stderr, "VM is not running in snapshot mode" sys.exit(1) def cmd_autostart(options): """ Starts all VMs which are in the autostart directory """ | < | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | print >>sys.stderr, "VM is not running in snapshot mode" sys.exit(1) def cmd_autostart(options): """ Starts all VMs which are in the autostart directory """ dirname = config.get("directories", "AutostartVMs") userinfo=pwd.getpwnam(config.get("permissions","autostart_user")) if not userinfo: print >>sys.stderr, ("User %s doesn't exists %s" % config.get("permissions","autostart_user")) sys.exit(1) os.setgid(userinfo.pw_gid) |
︙ | ︙ | |||
695 696 697 698 699 700 701 | "usb":"-usb"} macaddr = ":".join(["%02x" % ord(x) for x in chr(0x52) + os.urandom(5)]) if parsed_args.shared: machinedir = os.path.join(config.get("directories", "SharedVMs"), parsed_args.machine) dirmode = 0775 else: | | | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | "usb":"-usb"} macaddr = ":".join(["%02x" % ord(x) for x in chr(0x52) + os.urandom(5)]) if parsed_args.shared: machinedir = os.path.join(config.get("directories", "SharedVMs"), parsed_args.machine) dirmode = 0775 else: machinedir = os.path.join(pwd.getpwuid(os.getuid()).pw_dir, "VWs", parsed_args.machine) dirmode = 0775 if parsed_args.net != 'user': bridges = list_bridges() if not parsed_args.net in bridges: print >>sys.stderr, ("No such bridge %s. Available ones %s" % |
︙ | ︙ | |||
824 825 826 827 828 829 830 | config.set('tools', 'lsusb', 'lsusb') config.set('tools', 'arp', '/usr/sbin/arp') config.add_section('permissions') config.set('permissions','vm_group','kvm') config.set('permissions','autostart_user','root') config.set('permissions','setgid_vm','yes') # Read configration files | > > > | | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | config.set('tools', 'lsusb', 'lsusb') config.set('tools', 'arp', '/usr/sbin/arp') config.add_section('permissions') config.set('permissions','vm_group','kvm') config.set('permissions','autostart_user','root') config.set('permissions','setgid_vm','yes') # Read configration files if os.getuid() != 0: config.read(['/etc/vws.conf',os.path.join(pwd.getpwuid(os.getuid()).pw_dir + '.vwsrc')]) else: config.read(['/etc/vws.conf']) # 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') |
︙ | ︙ |
Modified vws.service from [e9ec62b9e8] to [d6ec7e4063].
1 2 3 4 5 6 | [Unit] Description=Virtual Workstation Autostart Documentation=man:vws(1) After=network.target dnsmasq.service [Service] Type=forking | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | [Unit] Description=Virtual Workstation Autostart Documentation=man:vws(1) After=network.target dnsmasq.service [Service] Type=forking ExecStart=/usr/local/bin/vws autostart ExecStop=/usr/local/bin/vws shutdown --wait Restart=no [Install] WantedBy=muiti-user.target Alias=vws.service |