コード例 #1
0
 def testNoSignalFnArgument(self):
     myawaker = daemon.AsyncAwaker()
     self.assertRaises(socket.error, myawaker.handle_read)
     myawaker.signal()
     myawaker.handle_read()
     self.assertRaises(socket.error, myawaker.handle_read)
     myawaker.signal()
     myawaker.signal()
     myawaker.handle_read()
     self.assertRaises(socket.error, myawaker.handle_read)
     myawaker.close()
コード例 #2
0
ファイル: masterd.py プロジェクト: ribag/ganeti-experiments
    def __init__(self, address, uid, gid):
        """MasterServer constructor

    @param address: the unix socket address to bind the MasterServer to
    @param uid: The uid of the owner of the socket
    @param gid: The gid of the owner of the socket

    """
        temp_name = tempfile.mktemp(dir=os.path.dirname(address))
        daemon.AsyncStreamServer.__init__(self, self.family, temp_name)
        os.chmod(temp_name, 0770)
        os.chown(temp_name, uid, gid)
        os.rename(temp_name, address)

        self.awaker = daemon.AsyncAwaker()

        # We'll only start threads once we've forked.
        self.context = None
        self.request_workers = None

        self._shutdown_check = None
コード例 #3
0
 def setUp(self):
     testutils.GanetiTestCase.setUp(self)
     self.mainloop = daemon.Mainloop()
     self.awaker = daemon.AsyncAwaker(signal_fn=self.handle_signal)
     self.signal_count = 0
     self.signal_terminate_count = 1