Skip to content

Commit

Permalink
Fixed assignement of new services if pool is at 100% usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmstr committed Nov 30, 2021
1 parent 2630717 commit 48557f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion server/src/uds/core/managers/user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ def getMeta(
# 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)

Expand All @@ -687,7 +693,7 @@ def ensureTransport(pool: ServicePool) -> typing.Optional[typing.Tuple[ServicePo

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
Expand Down
2 changes: 1 addition & 1 deletion server/src/uds/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

# 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'),

Expand Down

0 comments on commit 48557f9

Please sign in to comment.