Changeset 1860
- Timestamp:
- 02/01/12 07:07:07 (4 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
tcontainerfunc.h (modified) (6 diffs)
-
tdatacenterfunc.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tcontainerfunc.h
r1854 r1860 2796 2796 { 2797 2797 ProcesstContainerVars(entries,x); 2798 if( uStatus==uACTIVE&& uAllowMod(uOwner,uCreatedBy))2798 if( (uStatus==uACTIVE||uStatus==uSTOPPED) && uAllowMod(uOwner,uCreatedBy)) 2799 2799 { 2800 2800 guMode=0; … … 2814 2814 { 2815 2815 ProcesstContainerVars(entries,x); 2816 if( uStatus==uACTIVE&& uAllowMod(uOwner,uCreatedBy))2816 if( (uStatus==uACTIVE||uStatus==uSTOPPED) && uAllowMod(uOwner,uCreatedBy)) 2817 2817 { 2818 2818 unsigned uTargetDatacenter=0; … … 2859 2859 tContainer("<blink>Error:</blink> Create job for unxsBind," 2860 2860 " but no cunxsBindARecordJobZone"); 2861 2862 //label-cloneN and hostname.cloneN mess change to new format 2863 // new hostname is based on source cLabel and cHostname 2864 char cPrevHostname[100]={""}; 2865 if(uSource) 2866 { 2867 char cSourceHostname[100]={""}; 2868 char cWizLabel[33]={""}; 2869 char cNewLabel[33]={""}; 2870 char *cp=NULL; 2871 unsigned uWizLabelLoop=1; 2872 unsigned uWizLabelSuffix=0; 2873 2874 sprintf(cPrevHostname,"%s",cHostname); 2875 2876 sprintf(cLabel,"%.25s",ForeignKey("tContainer","cLabel",uSource)); 2877 //Get first available <cLabel>-clone<uNum> 2878 while(uWizLabelLoop) 2879 { 2880 uWizLabelSuffix++; 2881 if(uWizLabelSuffix>9) tContainer("<blink>Error:</blink> Clone limit reached"); 2882 sprintf(cWizLabel,"%.25s-clone%u",cLabel,uWizLabelSuffix); 2883 sprintf(gcQuery,"SELECT uContainer FROM tContainer WHERE cLabel='%s'",cWizLabel); 2884 mysql_query(&gMysql,gcQuery); 2885 if(mysql_errno(&gMysql)) 2886 htmlPlainTextError(mysql_error(&gMysql)); 2887 res=mysql_store_result(&gMysql); 2888 uWizLabelLoop=mysql_num_rows(res); 2889 mysql_free_result(res); 2890 } 2891 sprintf(cNewLabel,"%.25s-clone%u",cLabel,uWizLabelSuffix); 2892 sprintf(cLabel,"%.32s",cNewLabel); 2893 2894 sprintf(cSourceHostname,"%.99s",ForeignKey("tContainer","cHostname",uSource)); 2895 if((cp=strchr(cSourceHostname,'.'))) 2896 { 2897 sprintf(cHostname,"%.32s.%.64s",cLabel,cp+1); 2898 } 2899 } 2900 2861 2901 uHostnameLen=strlen(cHostname); 2862 2902 if(!strstr(cHostname+(uHostnameLen-strlen(cunxsBindARecordJobZone)-1),cunxsBindARecordJobZone)) 2863 tContainer("<blink>Error:</blink> cHostname must end with cunxsBindARecordJobZone"); 2903 tContainer("<blink>Error:</blink> cHostname must end with cunxsBindARecordJobZone"); 2904 if(uSource) 2905 { 2906 sprintf(gcQuery,"UPDATE tContainer SET cHostname='%s',cLabel='%s'" 2907 " WHERE uContainer=%u",cHostname,cLabel,uContainer); 2908 mysql_query(&gMysql,gcQuery); 2909 if(mysql_errno(&gMysql)) 2910 htmlPlainTextError(mysql_error(&gMysql)); 2911 } 2864 2912 2865 2913 guMode=0; … … 2894 2942 if(!cIPOld[0]) 2895 2943 htmlPlainTextError("Unexpected !cIPOld"); 2896 //Note that job is for new node 2944 2945 //Note that these jobs are for new node 2897 2946 //Then this job must run after migration. 2898 if(IPContainerJob(uTargetDatacenter,uTargetNode,uContainer,uOwner,guLoginClient,cIPOld)) 2899 2947 IPContainerJob(uTargetDatacenter,uTargetNode,uContainer,uOwner,guLoginClient,cIPOld); 2900 2948 //Create unxsBind DNS 2901 2949 CreateDNSJob(uWizIPv4,uOwner,NULL,cHostname,uDatacenter,guLoginClient); 2950 2951 //Create change hostname job 2952 if(uSource) 2953 HostnameContainerJob(uTargetDatacenter,uTargetNode,uContainer,cPrevHostname); 2902 2954 2903 2955 sscanf(ForeignKey("tContainer","uModDate",uContainer),"%lu",&uModDate); … … 3981 4033 { 3982 4034 htmlHealth(uContainer,3); 3983 printf("<p><input title='Migrate container to another datacenter node'"3984 " type=submit class=largeButton"3985 " name=gcCommand value='Remote Migration'><br>\n");3986 4035 if(!strstr(cLabel,"-clone")) 3987 printf("< input title='Clone a container to this or another hardware node."4036 printf("<p><input title='Clone a container to this or another hardware node." 3988 4037 " The clone will be an online container with another IP and hostname." 3989 4038 " It will be kept updated via rsync on a configurable basis.'" … … 4033 4082 " type=submit class=largeButton" 4034 4083 " name=gcCommand value='Migration Wizard'><br>\n"); 4084 printf("<input title='Migrate container to another datacenter node'" 4085 " type=submit class=largeButton" 4086 " name=gcCommand value='Remote Migration'><br>\n"); 4035 4087 printf("<input title='Change current container name and hostname'" 4036 4088 " type=submit class=largeButton" -
trunk/tdatacenterfunc.h
r1855 r1860 705 705 mysql_free_result(res); 706 706 707 //4b-. Last 5 min top diff talkers 708 if(uTargetNode) 709 sprintf(gcQuery,"SELECT ABS(CONVERT(t2.cValue,SIGNED)-CONVERT(t1.cValue,SIGNED)),t1.uKey,t1.uKey FROM" 710 " tProperty AS t1, tProperty AS t2 WHERE" 711 " t1.uKey IN (SELECT uContainer from tContainer where uStatus=%u AND uDatacenter=%u AND uNode=%u) AND" 712 " t1.uKey=t2.uKey AND t1.uType=3 AND t1.cName='Venet0.luInDelta' AND" 713 " t2.uKey=t2.uKey AND t2.uType=3 AND t2.cName='Venet0.luOutDelta'" 714 " ORDER BY ABS(CONVERT(t2.cValue,SIGNED)-CONVERT(t1.cValue,SIGNED)) DESC LIMIT 10",uACTIVE,uDatacenter,uTargetNode); 715 else 716 sprintf(gcQuery,"SELECT ABS(CONVERT(t2.cValue,SIGNED)-CONVERT(t1.cValue,SIGNED)),t1.uKey,t1.uKey FROM" 717 " tProperty AS t1, tProperty AS t2 WHERE" 718 " t1.uKey IN (SELECT uContainer from tContainer where uStatus=%u AND uDatacenter=%u) AND" 719 " t1.uKey=t2.uKey AND t1.uType=3 AND t1.cName='Venet0.luInDelta' AND" 720 " t2.uKey=t2.uKey AND t2.uType=3 AND t2.cName='Venet0.luOutDelta'" 721 " ORDER BY ABS(CONVERT(t2.cValue,SIGNED)-CONVERT(t1.cValue,SIGNED)) DESC LIMIT 10",uACTIVE,uDatacenter); 722 mysql_query(&gMysql,gcQuery); 723 if(mysql_errno(&gMysql)) 724 { 725 printf("<p><u>tDatacenterHealth</u><br>\n"); 726 printf("5-. %s",mysql_error(&gMysql)); 727 return; 728 } 729 res=mysql_store_result(&gMysql); 730 if(mysql_num_rows(res)) 731 { 732 printf("<p><u>Last 5min top diff</u><br>\n"); 733 734 while((field=mysql_fetch_row(res))) 735 printf("<a class=darkLink href=unxsVZ.cgi?gcFunction=tContainer&uContainer=%s>" 736 "%s %sB/s</a><br>\n",field[1],field[2],field[0]); 737 } 738 mysql_free_result(res); 739 707 740 //4-. Top talkers 708 741 if(uTargetNode)
