forked from shaba/openuds
Fixed assignement of new services if pool is at 100% usage
This commit is contained in:
parent
263071750c
commit
48557f96e4
@ -669,6 +669,12 @@ class UserServiceManager:
|
|||||||
# Sort pools related to policy now, and xtract only pools, not sort keys
|
# 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...
|
# 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()]
|
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)
|
logger.debug('Pools: %s', pools)
|
||||||
|
|
||||||
@ -687,7 +693,7 @@ class UserServiceManager:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
alreadyAssigned: UserService = UserService.objects.filter(
|
alreadyAssigned: UserService = UserService.objects.filter(
|
||||||
deployed_service__in=pools,
|
deployed_service__in=pools+poolsFull,
|
||||||
state__in=State.VALID_STATES,
|
state__in=State.VALID_STATES,
|
||||||
user=user,
|
user=user,
|
||||||
cache_level=0
|
cache_level=0
|
||||||
|
@ -65,7 +65,7 @@ urlpatterns = [
|
|||||||
|
|
||||||
# Login/logout
|
# Login/logout
|
||||||
path(r'uds/page/login', uds.web.views.modern.login, name='page.login'),
|
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'),
|
path(r'uds/page/logout', uds.web.views.modern.logout, name='page.logout'),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user