# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc import eventlet from dao.common import config from dao.common import log opts = [config.StrOpt('dhcp', 'driver', default='dao.control.worker.dhcp.neutron.NeutronHelper', help='Path to DHCP helper') ] config.register(opts) CONF = config.get_config() logger = log.getLogger(__name__) class DHCPBase(object): instance = None @classmethod def get_helper(cls, worker=None): """ :rtype: DHCPBase """ if cls.instance: return cls.instance
cfg.IntOpt('db', 'sql_retry_interval', default=10, help='interval between retries of opening a sql connection'), cfg.IntOpt('db', 'sql_max_overflow', default=None, help='If set, use this value for max_overflow with sqlalchemy'), cfg.IntOpt('db', 'sql_connection_debug', default=0, help='Verbosity of SQL debugging information. 0=None, ' '100=Everything'), cfg.BoolOpt('db', 'sql_connection_trace', default=False, help='Add python stack traces to SQL as comment strings'), ] cfg.register(sql_opts) CONF = cfg.get_config() LOG = log.getLogger(__name__) _ENGINE = None _MAKER = None def greenthread_yield(dbapi_con, con_record): """ Ensure other greenthreads get a chance to execute by forcing a context switch. With common database backends (eg MySQLdb and sqlite), there is no implicit yield caused by network I/O since they are implemented by C libraries that eventlet cannot monkey patch. """ eventlet.sleep(0)
from dao.common import log from dao.common import utils from dao.dhcp.db import api from dao.dhcp import base opts = [ config.StrOpt('dhcp', 'leases_dir', '/etc/dhcp/conf.d', help='Path to the directory with static leases'), config.IntOpt('dhcp', 'restart_delay', default=4, help='Delay before restarting dhcp') ] config.register(opts) CONF = config.get_config() LOG = log.getLogger(__name__) Subnet = base.Subnet class DHCPController(object): pending_restarts = False @classmethod def enable(cls): if cls.pending_restarts: return cls.pending_restarts = True
cfg.IntOpt('db', 'sql_max_overflow', default=None, help='If set, use this value for max_overflow with sqlalchemy'), cfg.IntOpt('db', 'sql_connection_debug', default=0, help='Verbosity of SQL debugging information. 0=None, ' '100=Everything'), cfg.BoolOpt('db', 'sql_connection_trace', default=False, help='Add python stack traces to SQL as comment strings'), ] cfg.register(sql_opts) CONF = cfg.get_config() LOG = log.getLogger(__name__) _ENGINE = None _MAKER = None def greenthread_yield(dbapi_con, con_record): """ Ensure other greenthreads get a chance to execute by forcing a context switch. With common database backends (eg MySQLdb and sqlite), there is no implicit yield caused by network I/O since they are implemented by C libraries that eventlet cannot monkey patch. """ eventlet.sleep(0)