To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 498343e6 authored by Reto Da Forno's avatar Reto Da Forno

minor change

parent 55864659
......@@ -1104,16 +1104,16 @@ function update_add_test($xml_config, &$errors, $existing_test_id = NULL, $abort
acquire_db_lock('resource_allocation');
$r = schedule_test($testconfig, $resources, $existing_test_id);
if ($abort) { // update test to abort
// remove resource allocations
$db = db_connect();
$sql = 'DELETE from tbl_serv_resource_allocation WHERE `test_fk` = ' .$existing_test_id;
mysqli_query($db, $sql) or flocklab_die('Cannot abort test: ' . mysqli_error($db));
// update test entry
$end = $r['end_time'];
// only schedule abort procedure if test has been started and not yet finished
$sql = "SELECT `test_status` FROM tbl_serv_tests WHERE `serv_tests_key`=".$existing_test_id." AND `test_status` IN ('running', 'preparing')";
$res = mysqli_query($db, $sql);
if (mysqli_num_rows($res)) {
// remove resource allocations
$sql = 'DELETE from tbl_serv_resource_allocation WHERE `test_fk` = ' .$existing_test_id;
mysqli_query($db, $sql) or flocklab_die('Cannot abort test: ' . mysqli_error($db));
// update test entry
$end = $r['end_time'];
$sql = 'UPDATE `tbl_serv_tests` SET `time_end_wish`="'.mysqli_real_escape_string($db, $end->format(DATE_ISO8601)).'", `test_status`="aborting" WHERE `serv_tests_key`='.$existing_test_id;
mysqli_query($db, $sql) or flocklab_die('Cannot store test configuration in database because: ' . mysqli_error($db));
$testId = $existing_test_id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment