| | 1168 | |
| | 1169 | //Check 1-. Check to make sure container is on this node, if not |
| | 1170 | // give job back to queue |
| | 1171 | sprintf(gcQuery,"/usr/sbin/vzlist %u > /dev/null 2>&1",uContainer); |
| | 1172 | if(system(gcQuery)) |
| | 1173 | { |
| | 1174 | logfileLine("ChangeHostnameContainer","Job returned to queue no such container"); |
| | 1175 | tJobWaitingUpdate(uJob); |
| | 1176 | return; |
| | 1177 | } |
| | 1178 | |
| | 1179 | //Check 2-. Wait till any other jobs currently in the job queue for this |
| | 1180 | // container are done. |
| | 1181 | sprintf(gcQuery,"SELECT uJob FROM tJob" |
| | 1182 | " WHERE uContainer=%u AND (uJobStatus=%u OR uJobStatus=%u)",uContainer,uWAITING,uRUNNING); |
| | 1183 | mysql_query(&gMysql,gcQuery); |
| | 1184 | if(mysql_errno(&gMysql)) |
| | 1185 | { |
| | 1186 | logfileLine("ChangeHostnameContainer",mysql_error(&gMysql)); |
| | 1187 | exit(2); |
| | 1188 | } |
| | 1189 | res=mysql_store_result(&gMysql); |
| | 1190 | if((field=mysql_fetch_row(res))) |
| | 1191 | { |
| | 1192 | logfileLine("ChangeHostnameContainer","Job returned to queue other jobs pending"); |
| | 1193 | tJobWaitingUpdate(uJob); |
| | 1194 | mysql_free_result(res); |
| | 1195 | return; |
| | 1196 | } |
| | 1197 | mysql_free_result(res); |