def get_minimum_version(cls, context, binary, use_slave=False): version = db.service_get_minimum_version(context, binary, use_slave=use_slave) if version is None: return 0 # NOTE(danms): Since our return value is not controlled by object # schema, be explicit here. return int(version)
def get_minimum_version(cls, context, binary, use_slave=False): if not binary.startswith('nova-'): LOG.warning(_LW('get_minimum_version called with likely-incorrect ' 'binary `%s\''), binary) raise exception.ObjectActionError(action='get_minimum_version', reason='Invalid binary prefix') version = db.service_get_minimum_version(context, binary, use_slave=use_slave) if version is None: return 0 # NOTE(danms): Since our return value is not controlled by object # schema, be explicit here. return int(version)
def get_minimum_version(cls, context, binary, use_slave=False): if not binary.startswith('nova-'): LOG.warning(_LW('get_minimum_version called with likely-incorrect ' 'binary `%s\''), binary) raise exception.ObjectActionError(action='get_minimum_version', reason='Invalid binary prefix') if cls._SERVICE_VERSION_CACHING: cached_version = cls._MIN_VERSION_CACHE.get(binary) if cached_version: return cached_version version = db.service_get_minimum_version(context, binary, use_slave=use_slave) if version is None: return 0 # NOTE(danms): Since our return value is not controlled by object # schema, be explicit here. version = int(version) cls._MIN_VERSION_CACHE[binary] = version return version
def _db_service_get_minimum_version(context, binaries, use_slave=False): return db.service_get_minimum_version(context, binaries)