Changeset 1854

Show
Ignore:
Timestamp:
01/16/12 06:27:15 (4 months ago)
Author:
Dylan
Message:

unxsVZ moving to normal remote datacenter clones.

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/tcontainer.c

    r1723 r1854  
    495495                { 
    496496                        char cAutoCloneSyncTime[256]={""}; 
     497                        char cAutoCloneNode[256]={""}; 
     498                        unsigned uTargetDatacenter=0; 
     499 
     500                        MYSQL_RES *res; 
     501                        MYSQL_ROW field; 
    497502 
    498503                        OpenRow("Clone target node","black"); 
    499                         tTablePullDownDatacenter("tNode;cuTargetNodePullDown","cLabel","cLabel",uTargetNode,1, 
    500                                 cuTargetNodePullDown,0,uDatacenter);//0 does not use tProperty, uses uDatacenter 
     504                        GetConfiguration("cAutoCloneNode",cAutoCloneNode,uDatacenter,uNode,0,0); 
     505                        sprintf(gcQuery,"SELECT uNode,uDatacenter FROM tNode WHERE cLabel='%s'",cAutoCloneNode); 
     506                        MYSQL_RUN_STORE(res); 
     507                        if((field=mysql_fetch_row(res))) 
     508                        { 
     509                                sscanf(field[0],"%u",&uTargetNode); 
     510                                sscanf(field[1],"%u",&uTargetDatacenter); 
     511                        } 
     512                        tTablePullDown("tNode;cuTargetNodePullDown","cLabel","cLabel",uTargetNode,0); 
    501513 
    502514                        OpenRow("Clone start uIPv4","black"); 
    503515                        tTablePullDownOwnerAvailDatacenter("tIP;cuWizIPv4PullDown","cLabel","cLabel",uWizIPv4,1, 
    504                                 uDatacenter,uForClient); 
     516                                uTargetDatacenter,uForClient); 
    505517 
    506518                        OpenRow("Keep clone stopped","black"); 
  • trunk/tcontainerfunc.h

    r1853 r1854  
    15961596                                unsigned uHostnameLen=0; 
    15971597                                unsigned uLabelLen=0; 
     1598                                unsigned uTargetDatacenter=0; 
    15981599 
    15991600                                ProcesstContainerVars(entries,x); 
     
    17111712                                                        "Select another."); 
    17121713 
    1713                                         sscanf(ForeignKey("tNode","uDatacenter",uTargetNode),"%u",&uNodeDatacenter); 
    1714                                         if(uDatacenter!=uNodeDatacenter) 
    1715                                                 tContainer("<blink>Error:</blink> The specified clone uNode does not " 
    1716                                                         "belong to the specified uDatacenter."); 
     1714                                        //We are moving to normal remote datacenter clone containers 
     1715                                        sscanf(ForeignKey("tNode","uDatacenter",uTargetNode),"%u",&uTargetDatacenter); 
     1716                                        //if(uDatacenter!=uTargetDatacenter) 
     1717                                        //      tContainer("<blink>Error:</blink> The specified clone uNode does not " 
     1718                                        //              "belong to the specified uDatacenter."); 
    17171719                                        if(!uWizIPv4) 
    17181720                                                tContainer("<blink>Error:</blink> You must select an IP for the clone"); 
     
    17211723                                                                                " clone"); 
    17221724                                        sscanf(ForeignKey("tIP","uDatacenter",uWizIPv4),"%u",&uIPv4Datacenter); 
    1723                                         if(uDatacenter!=uIPv4Datacenter) 
    1724                                                 tContainer("<blink>Error:</blink> The specified uIPv4 does not " 
    1725                                                         "belong to the specified uDatacenter."); 
     1725                                        if(uTargetDatacenter!=uIPv4Datacenter) 
     1726                                                tContainer("<blink>Error:</blink> The specified clone uIPv4 does not " 
     1727                                                        "belong to the specified uTargetDatacenter."); 
    17261728                                        if(cNCCloneRange[0] && !uIpv4InCIDR4(ForeignKey("tIP","cLabel",uWizIPv4),cNCCloneRange)) 
    17271729                                                tContainer("<blink>Error:</blink> Clone start uIPv4 must be in datacenter clone IP range"); 
     
    17881790                                { 
    17891791                                        sprintf(gcQuery,"SELECT cLabel FROM tIP WHERE uIP=%u AND uAvailable=1" 
    1790                                                 " AND uOwner=%u AND uDatacenter=%u",uWizIPv4,uForClient,uDatacenter); 
     1792                                                " AND uOwner=%u AND uDatacenter=%u",uWizIPv4,uForClient,uTargetDatacenter); 
    17911793                                        mysql_query(&gMysql,gcQuery); 
    17921794                                        if(mysql_errno(&gMysql)) 
     
    18191821                                        sprintf(gcQuery,"SELECT COUNT(uIP) FROM tIP WHERE uAvailable=1 AND uOwner=%u" 
    18201822                                                        " AND cLabel LIKE '%s%%' AND uDatacenter=%u", 
    1821                                                                 uForClient,cIPv4ClassCClone,uDatacenter); 
     1823                                                                uForClient,cIPv4ClassCClone,uTargetDatacenter); 
    18221824                                        mysql_query(&gMysql,gcQuery); 
    18231825                                        if(mysql_errno(&gMysql)) 
     
    20022004                                                                        uSearchdomain, 
    20032005                                                                        uDatacenter, 
    2004                                                                         uDatacenter, 
     2006                                                                        uTargetDatacenter, 
    20052007                                                                        uForClient, 
    20062008                                                                        cLabel, 
     
    20242026                                                sprintf(gcQuery,"SELECT uIP FROM tIP WHERE uAvailable=1 AND uOwner=%u" 
    20252027                                                        " AND cLabel LIKE '%s%%' AND uDatacenter=%u LIMIT 1", 
    2026                                                                 uForClient,cIPv4ClassCClone,uDatacenter); 
     2028                                                                uForClient,cIPv4ClassCClone,uTargetDatacenter); 
    20272029                                                mysql_query(&gMysql,gcQuery); 
    20282030                                                if(mysql_errno(&gMysql))