Check-in [bf2749a038]
Not logged in
Overview
Comment:Debugged shutdown command
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bf2749a038fbe7fcb350702dde1fa7675cfabf2b
User & Date: vitus on 2016-04-15 14:58:00
Other Links: manifest | tags
Context
2016-04-15
14:58
Set version to 0.4 check-in: 52e0b8ea22 user: vitus tags: trunk
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
Changes

Modified vws from [7fbed0b83d] to [5b41293860].

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
        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







|
>
|
|
<
|
<
|
|
|
|
|
|
|
|




>
>
|







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
621
        else:
            command = "quit"
            
        for dirname in dirlist:
            if not os.access(dirname, os.X_OK):
                continue
            for vm in os.listdir(dirname):
                if not os.access(os.path.join(dirname,vm,"start"),os.X_OK):
                    # Not a VM
                    continue
                sock=connect_vm(os.path.join(dirname,vm))

                if not sock:

                    # 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
        print "%d machines left running" % count
        if count>0:
            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

Modified vws.service from [dda59bb750] to [e9ec62b9e8].

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=vws autostart
ExecStop=vws shutdown
Restart=no
[Install]
WantedBy=muiti-user.target
Alias=vws.service







|




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=vws autostart
ExecStop=vws shutdown --wait
Restart=no
[Install]
WantedBy=muiti-user.target
Alias=vws.service