Overview
Comment: | Implemented shutdown command. Added systemd servcice file |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f1d54672c8c4fa197a2edd800afc9690 |
User & Date: | vitus on 2016-04-15 14:28:17 |
Other Links: | manifest | tags |
Context
2016-04-15
| ||
14:58 | Debugged shutdown command check-in: bf2749a038 user: vitus tags: trunk | |
14:28 | Implemented shutdown command. Added systemd servcice file check-in: f1d54672c8 user: vitus tags: trunk | |
12:23 | vws list --state now outputs IP and mac addresses check-in: 5b974714bc user: vitus tags: trunk | |
Changes
Modified vws from [f9837316dc] to [7fbed0b83d].
︙ | |||
565 566 567 568 569 570 571 572 573 574 575 576 577 578 | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | cmd_start(start_opts) print name," ", finally: # pylint: disable=no-member start_opts.sock.shutdown(socket.SHUT_RDWR) 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: import grp dirlist += map(lambda x: os.path.expanduser("~"+x)+"/VWs", grp.getgrnam(config.get("permissions","vm_group")).gr_mem) else: dirlist.append(os.path.expanduser("~")+"/VWs") count = 1 #Fake positive values for there is not postcondition loop in the python forced_finish=time.time()+options.timeout while count > 0: count = 0 if time.time() < forced_finish: command = "system_powerdown" else: command = "quit" for dirname in dirlist: if not os.access(dirname, os.X_OK): continue for vm in os.listdir(dirname): mon = os.path.join(dirname,vm,"monitor") if os.access(mon,os.W_OK): sock=socket.socket(socket.AF_UNIX) try: sock.connect(mon) except IOError as ex: # virtual machine is not running continue count += 1 try: send_command(sock,command) except IOError: #When hard_stopping,socket might be closed by way pass sock.shutdown(socket.SHUT_RDWR) sock.close() if not options.wait: return time.sleep(10) TEMPLATE = """#!/bin/sh # Get machine name from current directory name NAME=$(basename $(pwd)) # if remote access is enabled, then there should be # SPICE_PASSWORD=password |
︙ | |||
769 770 771 772 773 774 775 | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | - - + + + + + | # 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.conf from [9d477542e2] to [c8201742a1].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + | [directories] SharedVMs=/home/virtual/vws/shared AutostartVMs=/home/virtual/vws/autostart [tools] viewer=remote-viewer %s bridge_list=/sbin/brigectl show lsusb=lsusb arp=/usr/sbin/arp [permissions] # User name of user which owns processes of autostart VM # Should be member of group which is able to access KVM device. autostart_user = kvm # Group all shared VM belongs to. Probably should be same group which # owns kvm device. Note that shutdown command knows how to stop private vms of # members of these groups |
︙ |
Added vws.service version [dda59bb750].
|