From 448645b834149a06a82d407cd8f003f6452b62f6 Mon Sep 17 00:00:00 2001 From: David Bigagli <david@schedmd.com> Date: Tue, 10 Jun 2014 11:14:50 -0700 Subject: [PATCH] Set the number of free licenses to be 0 if the global license count decreases and total is less than in use. --- NEWS | 2 ++ src/common/slurm_protocol_pack.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 7ede65ea8f9..2a0bc5fb3cf 100644 --- a/NEWS +++ b/NEWS @@ -89,6 +89,8 @@ documents those changes that are of interest to users and admins. is already running. -- Email messages for job array events print now use the job ID using the format "#_# (#)" rather than just the internal job ID. + -- Set the number of free licenses to be 0 if the global license count decreases + and total is less than in use. * Changes in Slurm 14.03.3-2 ============================ diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index 969ed3f0ff2..d06745ab90a 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -11834,10 +11834,15 @@ _unpack_license_info_msg(license_info_msg_t **msg, &zz, buffer); safe_unpack32(&((*msg)->lic_array[i]).total, buffer); safe_unpack32(&((*msg)->lic_array[i]).in_use, buffer); - (*msg)->lic_array[i].available = - (*msg)->lic_array[i].total - - (*msg)->lic_array[i].in_use; - xassert((*msg)->lic_array[i].available >= 0); + /* The total number of licenses can decrease + * at runtime. + */ + if ((*msg)->lic_array[i].total < (*msg)->lic_array[i].in_use) + (*msg)->lic_array[i].available = 0; + else + (*msg)->lic_array[i].available = + (*msg)->lic_array[i].total - + (*msg)->lic_array[i].in_use; safe_unpack8(&((*msg)->lic_array[i]).remote, buffer); } -- GitLab