Discussion:
Bug (?) and Bugfix in update reservation
Oliver Fortmeier
2014-09-21 14:28:32 UTC
Permalink
Dear all,

Having been informed that an update of a reservation has an unexpected behavior, I have had deeper look in the slurm (version 14.03.8) code.

Observation:
============
When creating a reservation with a start and end time, and updating the start time of the reservation afterwards, the slurm updates the end time, invalidly.

[***@oliver-vm ~]# scontrol create reservation=test starttime=now endtime=2014-09-21T16:00:00 nodes=n0 flags=IGNORE_JOBS user=root
Reservation created: test
[***@oliver-vm ~]# scontrol update reservationname=test starttime=2014-09-21T16:00
Reservation updated.
[***@oliver-vm ~]# scontrol show res
ReservationName=test StartTime=2014-09-21T16:00:00 EndTime=2150-10-28T21:26:16 Duration=49710-06:26:16
Nodes=n0 NodeCnt=1 CoreCnt=12 Features=(null) PartitionName=(null) Flags=IGNORE_JOBS,SPEC_NODES
Users=root Accounts=(null) Licenses=(null) State=INACTIVE


Suggested Bugfix:
=================

I suggest to check for "duration != NO_VAL" in line 2176 in reservation.c. (Maybe, slurm should also check for != INFINITE?) That is, I suggest to modify the code for updating the start time in the function "update_resv" by:

if (resv_desc_ptr->start_time != (time_t) NO_VAL) {
if (resv_desc_ptr->start_time < (now - 60)) {
info("Reservation request has invalid start time");
error_code = ESLURM_INVALID_TIME_VALUE;
goto update_failure;
}
resv_ptr->start_time_prev = resv_ptr->start_time;
resv_ptr->start_time = resv_desc_ptr->start_time;
resv_ptr->start_time_first = resv_desc_ptr->start_time;
if ( resv_ptr->duration != NO_VAL ) {
/* ABOVE YOU CAN FIND THE MODIFIED LINE */
resv_ptr->end_time = resv_ptr->start_time_first +
(resv_ptr->duration * 60);
}
}
if (resv_desc_ptr->end_time != (time_t) NO_VAL) {
if (resv_desc_ptr->end_time < (now - 60)) {
info("Reservation request has invalid end time");
error_code = ESLURM_INVALID_TIME_VALUE;
goto update_failure;
}
resv_ptr->end_time = resv_desc_ptr->end_time;
resv_ptr->duration = 0;
}


Best regards,
Oliver
--
Dr. Oliver Fortmeier
Technical Analyst High-Performance Computing
Phone: +49 (0) 2203 / 305 2465
Mobile: +49 (0) 173 / 5887589
E-mail: ***@bull.de

Bull GmbH
Sitz Köln, Amtsgericht Köln, HR B 8173
Ust-Id-Nr.: DE 121965133, WEEE-Reg.-Nr. DE 64193985
Geschäftsführer: Gerd-Lothar Leonhart, Michael Heinrichs, Philippe Miltin
Zentrale:
51149 Köln, Von-der-Wettern-Strasse 27
Telefon: +49 (0) 2203 305-0
Telefax: +49 (0) 2203 305-1699
http://www.bull.de

Bull, an Atos company
** Folgen Sie uns auf Twitter: http://twitter.com/bull_de
** Bull Firmenprofil bei XING: https://www.xing.com/companies/bullgm
David Bigagli
2014-09-22 20:46:33 UTC
Permalink
Hi,
indeed this was a bug. Your patch was applied in commit
d2dabd07047837803ef8 and it will be available in the 14.03.9 release.

Thanks for your contribution.
Post by Oliver Fortmeier
Dear all,
Having been informed that an update of a reservation has an unexpected behavior, I have had deeper look in the slurm (version 14.03.8) code.
============
When creating a reservation with a start and end time, and updating the start time of the reservation afterwards, the slurm updates the end time, invalidly.
Reservation created: test
Reservation updated.
ReservationName=test StartTime=2014-09-21T16:00:00 EndTime=2150-10-28T21:26:16 Duration=49710-06:26:16
Nodes=n0 NodeCnt=1 CoreCnt=12 Features=(null) PartitionName=(null) Flags=IGNORE_JOBS,SPEC_NODES
Users=root Accounts=(null) Licenses=(null) State=INACTIVE
=================
if (resv_desc_ptr->start_time != (time_t) NO_VAL) {
if (resv_desc_ptr->start_time < (now - 60)) {
info("Reservation request has invalid start time");
error_code = ESLURM_INVALID_TIME_VALUE;
goto update_failure;
}
resv_ptr->start_time_prev = resv_ptr->start_time;
resv_ptr->start_time = resv_desc_ptr->start_time;
resv_ptr->start_time_first = resv_desc_ptr->start_time;
if ( resv_ptr->duration != NO_VAL ) {
/* ABOVE YOU CAN FIND THE MODIFIED LINE */
resv_ptr->end_time = resv_ptr->start_time_first +
(resv_ptr->duration * 60);
}
}
if (resv_desc_ptr->end_time != (time_t) NO_VAL) {
if (resv_desc_ptr->end_time < (now - 60)) {
info("Reservation request has invalid end time");
error_code = ESLURM_INVALID_TIME_VALUE;
goto update_failure;
}
resv_ptr->end_time = resv_desc_ptr->end_time;
resv_ptr->duration = 0;
}
Best regards,
Oliver
--
Dr. Oliver Fortmeier
Technical Analyst High-Performance Computing
Phone: +49 (0) 2203 / 305 2465
Mobile: +49 (0) 173 / 5887589
Bull GmbH
Sitz Köln, Amtsgericht Köln, HR B 8173
Ust-Id-Nr.: DE 121965133, WEEE-Reg.-Nr. DE 64193985
Geschäftsführer: Gerd-Lothar Leonhart, Michael Heinrichs, Philippe Miltin
51149 Köln, Von-der-Wettern-Strasse 27
Telefon: +49 (0) 2203 305-0
Telefax: +49 (0) 2203 305-1699
http://www.bull.de
Bull, an Atos company
** Folgen Sie uns auf Twitter: http://twitter.com/bull_de
** Bull Firmenprofil bei XING: https://www.xing.com/companies/bullgmbh
--
Thanks,
/David/Bigagli

www.schedmd.com
Loading...