Example #1
0
 def update_server(self, disabled=False):
     try:
         self._unsafe_update_server(disabled)
         model.reload_server()
     except Exception:
         LOG.exception(_LE("Failed to update PNR for network: %s"),
                       self.network.id)
Example #2
0
 def update_server(self, disabled=False):
     try:
         self._unsafe_update_server(disabled)
         model.reload_server()
     except Exception:
         LOG.exception(_LE("Failed to update PNR for network: %s"),
                       self.network.id)
    def test_reload(self, mock_client):
        mock_client.return_value.reload_needed.return_value = False
        self.assertFalse(model.reload_needed())
        mock_client.return_value.reload_needed.return_value = True
        self.assertTrue(model.reload_needed())

        mock_client.return_value.get_version.return_value = "1"
        mock_client.return_value.get_dhcp_server.return_value = {"name": "fake"}
        mock_client.return_value.get_dns_server.return_value = {"name": "fake"}
        model.reload_server()
        self.assertTrue(mock_client.return_value.reload_server.called)
Example #4
0
    def test_reload(self, mock_client):
        mock_client.return_value.reload_needed.return_value = False
        self.assertFalse(model.reload_needed())
        mock_client.return_value.reload_needed.return_value = True
        self.assertTrue(model.reload_needed())

        mock_client.return_value.get_version.return_value = "1"
        mock_client.return_value.get_dhcp_server.return_value = {
            'name': 'fake'}
        mock_client.return_value.get_dns_server.return_value = {
            'name': 'fake'}
        model.reload_server()
        self.assertTrue(mock_client.return_value.reload_server.called)
Example #5
0
 def _process_queue(cls):
     global last_activity
     last_activity = time.time()
     pool = eventlet.greenpool.GreenPool(size=GREENPOOL_SIZE)
     while True:
         try:
             funcall = _queue.get(timeout=1)
         except eventlet.queue.Empty:
             funcall = None
         if funcall:
             pool.spawn_n(funcall[0], *funcall[1], **funcall[2])
             last_activity = time.time()
         if model.reload_needed() and time.time() - last_activity > 1:
             pool.waitall()
             model.reload_server()
             last_activity = time.time()
Example #6
0
 def _process_queue(cls):
     global last_activity
     last_activity = time.time()
     pool = eventlet.greenpool.GreenPool(size=GREENPOOL_SIZE)
     while True:
         try:
             funcall = _queue.get(timeout=1)
         except eventlet.queue.Empty:
             funcall = None
         if funcall:
             pool.spawn_n(funcall[0], *funcall[1], **funcall[2])
             last_activity = time.time()
         if model.reload_needed() and time.time() - last_activity > 1:
             pool.waitall()
             model.reload_server()
             last_activity = time.time()