Overview
Comment: | Fix quoting of arguments of start command. Support per user configuration in .config/vws/vws.conf as well as .vwsrc Fix some pylint warnings |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7d648e5be3cc98ccc00e286915c4ff7e |
User & Date: | vitus on 2022-02-08 17:27:14 |
Other Links: | manifest | tags |
Context
2022-07-28
| ||
15:22 | Version 0.8.1 - support new info network format check-in: e5904254e7 user: vitus tags: trunk | |
2022-02-08
| ||
17:27 | Fix quoting of arguments of start command. Support per user configuration in .config/vws/vws.conf as well as .vwsrc Fix some pylint warnings check-in: 7d648e5be3 user: vitus tags: trunk | |
2020-01-16
| ||
18:18 | Fix moninor command for python3 check-in: 9be36c3e65 user: vitus tags: trunk | |
Changes
Modified vws from [0a5a51e7d3] to [c5b995c8c3].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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 27 | + + + + | #!/usr/bin/env python3 # -*- encoding: utf-8 -*- """ vws - script to control QEMU/KVM virtual workstations """ # pylint: disable=too-many-lines from configparser import ConfigParser from argparse import ArgumentParser, Namespace import fcntl import socket import select import errno import re import os import os.path import fnmatch import shlex import shutil import sys import time import pwd import grp VERSION = 0.8 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")] |
︙ | |||
39 40 41 42 43 44 45 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | - + - + | try: sock.connect(monitor_path) except IOError as ex: if ex.errno == errno.ECONNREFUSED: # virtal machine is not running return None raise ex |
︙ | |||
226 227 228 229 230 231 232 | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | - + + - + - + - + + + - + - + | return None def make_start_cmdline(options): """ Append options passed from vws commandline to start script commandline """ |
︙ | |||
314 315 316 317 318 319 320 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | - + | idx = answer.index('\n') print(answer[idx+1:], end="") eol = answer.endswith("\n") sys.stdout.flush() elif options.sock in readfd: print("UNSOLICITED MESSAGE %" + options.sock.recv(1000).decode("utf-8").rstrip()) |
︙ | |||
476 477 478 479 480 481 482 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | - + - | arp_data.update(parse_arp(bridge)) for vminfo in listing: if "mac" in vminfo and not "ip" in vminfo: if vminfo["mac"] in arp_data: vminfo["ip"] = arp_data[vminfo["mac"]] else: vminfo["ip"] = "-" |
︙ | |||
528 529 530 531 532 533 534 | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | - - + - - + | else: print(f["name"]) if not count: sys.exit(1) def cmd_screenshot(options): """ vws screenshot """ |
︙ | |||
708 709 710 711 712 713 714 | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | - | print("") def cmd_shutdown(options): """ Search for all running machines and stops all of them """ dirlist = [config.get("directories", "AutostartVMs"), config.get("directories", "SharedVms")] if os.getresuid()[1] == 0: |
︙ | |||
843 844 845 846 847 848 849 | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | - + - + + - | 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")): |
︙ | |||
938 939 940 941 942 943 944 945 | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | + + - + | 'permissions':{'vm_group':'kvm', 'autostart_user':'root', 'setgid_vm':'yes'}}) def read_config(conf): """ Read configration files """ if os.getuid() != 0: home = pwd.getpwuid(os.getuid()).pw_dir conf.read(['/etc/vws.conf', os.path.join(home, ".config", "vws", "vws.conf"), |
︙ | |||
1088 1089 1090 1091 1092 1093 1094 | 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | - | # Create command is totally different, so it is handled separately if parsed_args.command == 'create': try: cmd_create(parsed_args) except Exception as ex: # pylint: disable=broad-except print(str(ex), file=sys.stderr) if hasattr(parsed_args, "dir"): |
︙ |