Diff
Not logged in

Differences From Artifact [7fbed0b83d]:

To Artifact [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