Fixed assignement of new services if pool is at 100% usage

This commit is contained in:
Adolfo Gómez García 2021-11-30 12:18:15 +01:00
parent 263071750c
commit 48557f96e4
2 changed files with 8 additions and 2 deletions

View File

@ -669,6 +669,12 @@ class UserServiceManager:
# Sort pools related to policy now, and xtract only pools, not sort keys
# Remove "full" pools (100%) from result and pools in maintenance mode, not ready pools, etc...
pools: typing.List[ServicePool] = [p[1] for p in sorted(sortPools, key=lambda x: x[0]) if p[1].usage() < 100 and p[1].isUsable()]
poolsFull: typing.List[ServicePool] = [
p[1]
for p in sorted(sortPools, key=lambda x: x[0])
if p[1].usage() == 100 and p[1].isUsable()
]
logger.debug('Pools: %s', pools)
@ -687,7 +693,7 @@ class UserServiceManager:
try:
alreadyAssigned: UserService = UserService.objects.filter(
deployed_service__in=pools,
deployed_service__in=pools+poolsFull,
state__in=State.VALID_STATES,
user=user,
cache_level=0

View File

@ -65,7 +65,7 @@ urlpatterns = [
# Login/logout
path(r'uds/page/login', uds.web.views.modern.login, name='page.login'),
re_path(r'^uds/page/login/(?P<tag>[a-zA-Z0-9-]+)$', uds.web.views.modern.login, name='page.login.tag'),
re_path(r'^uds/page/login/(?P<tag>[a-zA-Z0-9_-]+)$', uds.web.views.modern.login, name='page.login.tag'),
path(r'uds/page/logout', uds.web.views.modern.logout, name='page.logout'),