Overview
Comment: | Added support for machine name patterns in the list command. Added preprocessing of vws.service.in |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cd20fc353b5d7bfcfe3bad2183867920 |
User & Date: | vitus on 2017-01-13 19:42:27 |
Other Links: | manifest | tags |
Context
2017-01-13
| ||
19:54 | Cleaned up installation procedure check-in: 6d27dc1088 user: vitus tags: trunk | |
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 | |
Changes
Modified Makefile from [c8d4867043] to [e6aed3cffe].
1 2 3 4 5 6 7 8 9 10 11 12 | prefix=/usr/local mandir=$(prefix)/share/man bindir=$(prefix)/bin sysconfdir=/etc INSTALL=/usr/bin/install man: vws.1 find_free_port.1 %.1:%.mkd pandoc -s -t man -o $@ $+ clean: | > | > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | prefix=/usr/local mandir=$(prefix)/share/man bindir=$(prefix)/bin sysconfdir=/etc INSTALL=/usr/bin/install man: vws.1 find_free_port.1 %.1:%.mkd pandoc -s -t man -o $@ $+ clean: rm -f *.1 vws.service vws.service: vws.service.in sed 's!@bindir@!$(bindir)!' $+ > $@ install: vws vws.1 find_free_port.1 vws.conf vws.service [ -d $(DESTDIR)$(bindir) ] || $(INSTALL) -d -m 755 -o root $(DESTDIR)$(bindir) [ -d $(DESTDIR)$(mandir) ] || $(INSTALL) -d -m 755 -o root $(DESTDIR)$(mandir) [ -d $(DESTDIR)$(mandir)/man1 ]||$(INSTALL) -d -m 755 -o root $(DESTDIR)$(mandir)/man1 $(INSTALL) -c -m 755 -o root find_free_port $(DESTDIR)$(bindir) $(INSTALL) -c -m 755 -o root vws $(DESTDIR)$(bindir) [ -f $(DESTDIR)$(sysconfdir)/vws.conf ]|| $(INSTALL) -c -m 644 -o root vws.conf $(DESTDIR)$(sysconfdir) $(INSTALL) -c -m 644 -o root vws.1 $(DESTDIR)$(mandir)/man1 $(INSTALL) -c -m 644 -o root find_free_port.1 $(DESTDIR)$(mandir)/man1 |
Modified vws from [bd152d8839] to [65984fa43e].
︙ | ︙ | |||
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 | """ vws usb remove """ 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: if not os.access(dirname + "/.", os.X_OK): continue for vmname in os.listdir(dirname): if os.access(dirname + "/" + vmname + "/start", os.X_OK): count += 1 f = {"name":vmname} if maxlen < len(vmname): maxlen = len(vmname) if options.state: f["type"]=vmtype sock = connect_vm(dirname + "/" + vmname) | > > > > > > > > | 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 | """ vws usb remove """ 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 """ import fnmatch 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: if not os.access(dirname + "/.", os.X_OK): continue for vmname in os.listdir(dirname): if os.access(dirname + "/" + vmname + "/start", os.X_OK): matches=False for p in options.pattern: if fnmatch.fnmatch(vmname,p): matches=True break if not matches: continue count += 1 f = {"name":vmname} if maxlen < len(vmname): maxlen = len(vmname) if options.state: f["type"]=vmtype sock = connect_vm(dirname + "/" + vmname) |
︙ | ︙ | |||
837 838 839 840 841 842 843 844 845 846 847 848 849 850 | 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("--usb", action='store_const', const=True, default=False, dest='usb', help='Show connected USB devices') p = cmds.add_parser("version", help="show vws version") p = cmds.add_parser("autostart",help="Autostart all VMs marked as autostartable") p = cmds.add_parser("shutdown",help="shut down all running VMs") p.add_argument("--wait",help="wait until all machines would be shoutdown", action="store_const", const=True, default=False, dest="wait") p.add_argument("--timeout",type=int,default=90, help="how long to way for VMs shutdown before forcing it off") | > | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | 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("--usb", action='store_const', const=True, default=False, dest='usb', help='Show connected USB devices') p.add_argument("pattern", nargs='*',default='*',help="Name patterns") p = cmds.add_parser("version", help="show vws version") p = cmds.add_parser("autostart",help="Autostart all VMs marked as autostartable") p = cmds.add_parser("shutdown",help="shut down all running VMs") p.add_argument("--wait",help="wait until all machines would be shoutdown", action="store_const", const=True, default=False, dest="wait") p.add_argument("--timeout",type=int,default=90, help="how long to way for VMs shutdown before forcing it off") |
︙ | ︙ |
Modified vws.mkd from [5adaaaef70] to [423c253021].
︙ | ︙ | |||
8 9 10 11 12 13 14 | *vws* - manage Virtual Workstations SYNOPSIS ======== **vws create** *name* [ **--install** *isoimage* ] | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | *vws* - manage Virtual Workstations SYNOPSIS ======== **vws create** *name* [ **--install** *isoimage* ] **vws list** \[**--state**\] \[**--usb**\] \[ *pattern* ... \] **vws start** *name* [**--no-gui**] \[**--cdrom** *iso-image*\] **vws stop** *name* [**--hard**] **vws save** *name* |
︙ | ︙ | |||
356 357 358 359 360 361 362 | interaction with it. **vws spiceuri** *machine* Prints out URI you should feed into your spice viewer to access this machine. | | | | > > > | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | interaction with it. **vws spiceuri** *machine* Prints out URI you should feed into your spice viewer to access this machine. **vws list** [ **--state** ] \[ **--usb** \] \[ *pattern* .. \] Lists available virtual machines. If **--state** option is given, prints out state (running or stopped) type (private or shared) spice URI (if machine is running), mac and IP address. Pattern is shell-style wildcard which limits machines to be shown. Don't forget to quote pattern from shell. It should be expanded. **--usb** option lists USB devices connected to the virtual machine using **vws usb** command. **vws sendkey** *machine* *keyspec* Allows to send some key combination to the virtual machine. For example if windows screen is locked spice client is sometimes unable to deliver key stroke to the virtual machine in order to get it out of sleep. |
︙ | ︙ |
Modified vws.service.in from [d6ec7e4063] to [6b9249971a].
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=@bindir@/vws autostart ExecStop=@bindir@/vws shutdown --wait Restart=no [Install] WantedBy=muiti-user.target Alias=vws.service |