Overview
Comment: | Make vws list --stated distinguish between stopped and hyberated (by vws save) machines |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a51866b638cfc6209625eac79ff7ffe8 |
User & Date: | vitus on 2019-10-03 07:54:53 |
Other Links: | manifest | tags |
Context
2019-10-03
| ||
10:26 | Fixed random mac generation for python3 check-in: 7eafff75ba user: vitus tags: trunk | |
07:54 | Make vws list --stated distinguish between stopped and hyberated (by vws save) machines check-in: a51866b638 user: vitus tags: trunk | |
07:27 | More info on bridge configuration check-in: 46b8264cac user: vitus tags: trunk | |
Changes
Modified vws from [d549c75576] to [0aa3cad620].
︙ | ︙ | |||
209 210 211 212 213 214 215 | """ Checks if there is snapshot of running vm which should be restored Returns either id of this snapshot or None """ nxt = 0 with os.popen("qemu-img info \"%s\"" % | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | """ Checks if there is snapshot of running vm which should be restored Returns either id of this snapshot or None """ nxt = 0 with os.popen("qemu-img info \"%s\"" % (os.path.join(vmdir, get_drives(vmdir)[0])), "r") as f: for line in f: if line == 'Snapshot list:\n': nxt = 2 elif nxt == 2 and line.startswith('ID'): nxt = 1 elif nxt == 1: nxt = 0 |
︙ | ︙ | |||
281 282 283 284 285 286 287 | 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 """ | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | 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") else: |
︙ | ︙ | |||
328 329 330 331 332 333 334 | def cmd_save(options): """ vws save """ answer = send_command(options.sock, 'savevm') if re.search("Error", answer): print(answer, file=sys.stderr) sys.exit(1) else: | > | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | def cmd_save(options): """ vws save """ answer = send_command(options.sock, 'savevm') if re.search("Error", answer): print(answer, file=sys.stderr) sys.exit(1) else: options.hard = True cmd_stop(options) def cmd_cdrom(options): """ vws cdrom """ if options.id is None: # Search for devices which could be interpreted as CDROM devlist = send_command(options.sock, "info block") for dev in re.findall("([-\\w]+): [^\n]+\n Removable device:", |
︙ | ︙ | |||
425 426 427 428 429 430 431 | print(answer) def make_vm_listing(vmname, dirname, vmtype): """ makes dict with vm properties for short index """ f = {"name":vmname, "type":vmtype} sock = connect_vm(dirname) if sock is None: | > > > > | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | print(answer) def make_vm_listing(vmname, dirname, vmtype): """ makes dict with vm properties for short index """ f = {"name":vmname, "type":vmtype} sock = connect_vm(dirname) if sock is None: if check_for_snapshot(dirname): f['state'] = "sleeping" else: f['state'] = 'stopped ' f.update({"uri":"-", "ip":"-"}) f.update(read_netinfo(os.path.join(dirname, "start"))) else: uri = spiceurl(sock) if uri is None: f.update({"state":"problem", "uri":"None", "ip":"-"}) f.update(read_netinfo(os.path.join(dirname, "start"))) else: |
︙ | ︙ |