Check-in [e5904254e7]
Not logged in
Overview
Comment:Version 0.8.1 - support new info network format
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e5904254e7cf8fe9dbb1fb66ef84d0a72885c9c3
User & Date: vitus on 2022-07-28 15:22:58
Other Links: manifest | tags
Context
2023-07-17
10:43
Reformatted python code with black and silence some pylint warnings Leaf check-in: f8285bffb0 user: vitus tags: trunk
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
Changes

Modified Makefile from [0027921553] to [bff60bbb8e].

30
31
32
33
34
35
36
37
38
39
40
41
42
43
	[ -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
	$(INSTALL) -c -m 644 -o root vws.service $(DESTDIR)$(systemddir)
	$(INSTALL) -c -m 644 -o root vws.init $(DESTDIR)$(initddir)/vws

origtarball: vws find_free_port vws.init vws.service.in  Makefile vws.conf vws.mkd find_free_port.mkd .pylintrc README.md
	version=$$(sed -n 's/VERSION = //p' vws); \
	mkdir vws-$$version; cp $+ vws-$$version; \
	tar cjf ../vws_$$version.orig.tar.bz2 vws-$$version; \
	rm -rf vws-$$version

deb: origtarball
	debuild







|






30
31
32
33
34
35
36
37
38
39
40
41
42
43
	[ -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
	$(INSTALL) -c -m 644 -o root vws.service $(DESTDIR)$(systemddir)
	$(INSTALL) -c -m 644 -o root vws.init $(DESTDIR)$(initddir)/vws

origtarball: vws find_free_port vws.init vws.service.in  Makefile vws.conf vws.mkd find_free_port.mkd .pylintrc README.md
	version=$$(sed -n 's/VERSION = "\?\([^"]\+\)"\?/\1/p' vws); \
	mkdir vws-$$version; cp $+ vws-$$version; \
	tar cjf ../vws_$$version.orig.tar.bz2 vws-$$version; \
	rm -rf vws-$$version

deb: origtarball
	debuild

Modified debian/changelog from [1c63e77d42] to [7ec0b9f96e].







1
2
3
4
5
6
7






vws (0.8-1) unstable; urgency=medium

  * Switch to python3

 -- Victor Wagner <vitus@wagner.pp.ru>  Tue, 01 Oct 2019 22:07:09 +0300

vws (0.7-1) unstable; urgency=medium
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
vws (0.8.1-1) UNRELEASED; urgency=medium

  * Support of new info-network output style 

 -- Victor Wagner <v.wagner@postgrespro.ru>  Thu, 28 Jul 2022 18:04:45 +0300

vws (0.8-1) unstable; urgency=medium

  * Switch to python3

 -- Victor Wagner <vitus@wagner.pp.ru>  Tue, 01 Oct 2019 22:07:09 +0300

vws (0.7-1) unstable; urgency=medium

Modified debian/files from [f71c0396cf] to [076aab798c].

1
2
vws_0.8-1_all.deb otherosfs optional
vws_0.8-1_amd64.buildinfo otherosfs optional
|
|
1
2
vws_0.8.1-1_all.deb otherosfs optional
vws_0.8.1-1_amd64.buildinfo otherosfs optional

Modified vws from [c5b995c8c3] to [2460d33837].

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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")]
    for dirname in search_path:
        if not os.access(dirname, os.X_OK):







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import shlex
import shutil
import sys
import time
import pwd
import grp

VERSION = "0.8.1"
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):
142
143
144
145
146
147
148

149
150
151
152
153
154
155
                match = re.search("file=([^,\\s]*)", line)
                if match:
                    result.append(match.group(1))
    return result

def snapshot_mode(sock):
    """ Returns True if VM is running in snapshot mode """

    answer = send_command(sock, "info block")
    return re.search(": /tmp", answer) is not None

def read_netinfo(filename):
    """ Reads network information from start script """
    with open(filename, "r") as f:
        for line in f:







>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
                match = re.search("file=([^,\\s]*)", line)
                if match:
                    result.append(match.group(1))
    return result

def snapshot_mode(sock):
    """ Returns True if VM is running in snapshot mode """
    print("Entering snapshot_mode", file=sys.stderr)
    answer = send_command(sock, "info block")
    return re.search(": /tmp", answer) is not None

def read_netinfo(filename):
    """ Reads network information from start script """
    with open(filename, "r") as f:
        for line in f:
170
171
172
173
174
175
176




177
178
179
180
181
182
183
    match = re.search("bridge\\.0:.*,br=(\\S+).*macaddr=(\\S+)", answer, re.S)
    if match:
        return {"iface":match.group(1), "mac":match.group(2)}
    match = re.search("user.0:.*net=([^,]+).*\n.*macaddr=(\\S+)", answer)
    if match:
        return {"iface":"user", "ip":match.group(1),
                "mac":match.group(2)}




    print(answer, file=sys.stderr)
    return {"iface":"unknown", "ip":"?", "mac":"?", "card":"?"}
#
# command implementation
#

def cmd_spiceuri(options):







>
>
>
>







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
    match = re.search("bridge\\.0:.*,br=(\\S+).*macaddr=(\\S+)", answer, re.S)
    if match:
        return {"iface":match.group(1), "mac":match.group(2)}
    match = re.search("user.0:.*net=([^,]+).*\n.*macaddr=(\\S+)", answer)
    if match:
        return {"iface":"user", "ip":match.group(1),
                "mac":match.group(2)}
    match = re.search("hub0port1:.*.br=(\\S+).*hub0port0:.*macaddr=(\\S+)",
                      answer, flags=re.S)             
    if match:
        return {"iface":match.group(1), "mac":match.group(2)}
    print(answer, file=sys.stderr)
    return {"iface":"unknown", "ip":"?", "mac":"?", "card":"?"}
#
# command implementation
#

def cmd_spiceuri(options):
288
289
290
291
292
293
294

295
296
297
298
299
300
301
    if options.gui:
        os.system((config.get('tools', 'viewer') + "&") % uri)
    elif not options.stopped:
        print("VM already running use uri %s" % uri, file=sys.stderr)

def cmd_stop(options):
    """ vws stop """

    if options.hard or snapshot_mode(options.sock):
        try:
            send_command(options.sock, 'quit')
        except IOError as ex:
            # Expect IOError here
            if str(ex).find("EOF from monitor"):
                print("monitor socket closed")







>







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
    if options.gui:
        os.system((config.get('tools', 'viewer') + "&") % uri)
    elif not options.stopped:
        print("VM already running use uri %s" % uri, file=sys.stderr)

def cmd_stop(options):
    """ vws stop """
    print("entering cmd_stop", file=sys.stderr)
    if options.hard or snapshot_mode(options.sock):
        try:
            send_command(options.sock, 'quit')
        except IOError as ex:
            # Expect IOError here
            if str(ex).find("EOF from monitor"):
                print("monitor socket closed")