Changeset 1857

Show
Ignore:
Timestamp:
01/20/12 10:03:42 (4 months ago)
Author:
Colin
Message:

unxsVZ added wait to change hostname also.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jobqueue.c

    r1856 r1857  
    11381138 
    11391139                //Everything ok 
     1140                sprintf(gcQuery,"/usr/sbin/vzctl set %u --onboot yes --save",uContainer); 
     1141                if(system(gcQuery)) 
     1142                        logfileLine("ChangeIPContainer",gcQuery); 
    11401143                SetContainerStatus(uContainer,1);//Active 
    11411144                tJobDoneUpdate(uJob); 
     
    11631166        MYSQL_RES *res; 
    11641167        MYSQL_ROW field; 
     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); 
    11651198 
    11661199