Resource Placement and Validation Callout

Overview

The CloudCenter platform has ability to deploy enterprise applications over public, private, or hybrid clouds by configuring user-specified cloud settings in the CCM UI > Deployments page.

The following integration features extend the CloudCenter platform capabilities:

  • Resource Placement allows users to define cloud settings based on third-party infrastructure tools or quota management tools using automated scripts instead of manually-selected settings.

  • Resource Validation blocks new deployments, if users reach a configured threshold limit when using Cloud Resources (for example, restricting VMs being launched only if cloud resources consume < 75% of your maximum capacity).

You can configure these integrations using an automation callout script.

Resource Placement Flow

The Resource Placement feature is only supported for AWS and VMware clouds. Effective 4.8.0.1, the CloudCenter platform also supports this feature for OpenStack Clouds.

This script is executed for each Node launch (called for each VM). For example, if you have a single-tier application with the minimum number of nodes set to 2, then this script is executed twice – 1 tier x 2 nodes = 2 executions. However, the CloudCenter platform passes variables such as service types which allows you to decide where to place it in the VM.

  1. Define Resource Callout by enabling the Resource Callout feature on the CCM UI > Deployments > Environments tab > Add a new or edit an existing deployment environment > Define Deployment Environment Defaults (see  Deployment Environment Defaults for additional context).

  2. Toggle the switch to YES in the Resource Placement section.

    If this feature is enabled, the Cloud Settings form in the Deployment Environments > Cloud Defaults page will be disabled.

  3. Identify the script location and the specific script for the Resource Placement Configuration.

  4. Be aware of the customizable options for AWS, OpenStack, and VMware:

    •  AWS Options
      • AWS-specific cloud settings for the resource placement callout script:

        AWS SettingDescription
        vpcIdThe VPC for the node to be deployed.
        subnetIdThe subnet where the node should be deployed in the above VPC.
        securityGroupListThe security groups where the node should be associated in the above VPC.
        vmTagsListThe AWS tags to associate with the node.
        assignPublicIpIdentifies if the node should be assigned with a public IP.
        nodeInfoCustomizable node Information detail that is displayed in the CCM UI Job Details Page for each node. If not provided CloudCenter generates the default nodeInfo based on the provided values.
      • Sample Amazon Resource Placement Callout Script
        #!/bin/bash
        
        . /utils.sh
        
        content="{\"vpcId\":\"vpc-1234abcd\",
        \"subnetId\":\"subnet-1234abcd\", \"securityGroupList\":\"sg-1234abcd\",
        \"vmTagsList\":\"Name:MyVm,PayProfile:Dev,BU:Engineering,User:DemoUser\",
        \"assignPublicIp\":\"true\", \"nodeInfo\":\"VpcID:
        vpc-1234abcd, subnetId: subnet-1234abcd,securityGroupList:sg-1234abcd \"}"
        
        print_ext_service_result "$content"
    •  OpenStack Options
      • OpenStack-specific cloud settings for the resource placement callout script:

        OpenStack SettingDescription
        TenantNameThe name of OpenStack tenant.
        zoneThe availability zone as described in Availability Sets and Zones > OpenStack.
        nicInfoThe OpenStack network interface information.
        privateIPAllocationModeThe private IP allocation strategy (DHCP or PREALLOCATE_IP)
        networkIDThe OpenStack Network ID.
        publicIpAllocateA flag to allocate the public IP address (Boolean: true/false).
        nodeInfoCustomizable node Information detail that is displayed in the CCM UI Job Details Page for each node. If not provided CloudCenter generates the default nodeInfo.
      • Sample Amazon Resource Placement Callout Script
        #!/bin/bash
        . /utils.sh
        content="{\"TenantName\":\"sample\",\"zone\":\"nova\",
        \"nicInfo\":\"
        [{\\\"privateIPAllocationMode\\\":\\\"DHCP\\\",\\\"networkID\\\":\\\"19f56fa2-babc-4q22-9q9b-20c4e3243b85\\\",\\\"publicIpAllocate\\\":true},
        {\\\"privateIPAllocationMode\\\":\\\"PREALLOCATE_IP\\\",\\\"networkID\\\":\\\"19f56fa2-babc-4q22-9q9b-20c4e3243b85\\\",\\\"publicIpAllocate\\\":true},
        {\\\"privateIPAllocationMode\\\":\\\"PREALLOCATE_IP\\\",\\\"networkID\\\":\\\"19f56fa2-babc-4q22-9q9b-20c4e3243b85\\\",\\\"publicIpAllocate\\\":false}]
        \",
        \"nodeInfo\":\"zone:nova, TenantName:sample\"}"
        print_ext_service_result "$content"
    •  VMware Options
      • VMware-specific cloud settings for the resource placement callout script:

        VMware SettingDescription
        vmTagsListThe AWS tags to associate with the node.
        UserDataCenterNameThe datacenter to deploy the node.
        UserClusterNameThe cluster to deploy the node in the above datacenter.
        UserResourcePoolNameThe resource pool used to deploy the node.
        UserDatastoreClusterThe datastore cluster to associate with the node.
        UserFolderNameThe user folder used for the node deployment.
        RootDiskResizableIdentifies if the the root disk is resizable (Boolean: true/false).
        FullCloneIdentifies if the node to be launched is with full clone (Boolean: true/false).
        VmRelocationEnabledIdentifies if node relocation is enabled (Boolean: true/false).
        LocalDataStoreEnabledBoolean if local datastore is enabled (Boolean: true/false).
        SystemFolderNameThe folder from which the template is selected.
        networkListThe list of networks to attach to the node.
        UserHostThe ESX host to which the node is launched.
        nodeInfoCustomizable node Information detail that is displayed in the CCM UI Job Details Page for each node. If not provided CloudCenter generates the default nodeInfo based on the provided values.
      • Sample VMware Resource Placement Callout Script
        #!/bin/bash
        
        . /utils.sh
        
        content="{\"UserDataCenterName\":\"SDC-01\",\"UserClusterName\":\"CloudCenter-Cluster\",\"UserResourcePoolName\":\"\",\"vmTagsList\":\"cloud:center\",\"UserDatastoreCluster\":\"CloudCenter-DS-Cluster\",
        \"RootFolderName\":\"vm\",
        \"UserFolderName\":\"CliqrUser-2\",
        \"RootDiskResizable\":\"false\”,
        \"FullClone\":\"true\",
        \"VmRelocationEnabled\":\"true\", \"LocalDataStoreEnabled\":\"true\",
        \"SystemFolderName\":\"CliqrTemplates\",
        \"networkList\":\"VLAN-ENG-NET (CC-DSwitch)\",
        \"UserHost\":\"sc2-esx02.abc.private\",\"nodeInfo\":\"UserDataCenterName:
        SDC-01, UserClusterName: CloudCenter-Cluster,
        UserDatastoreCluster:CloudCenter-DS-Cluster, networkList VLAN-ENG-NET
        (CC-DSwitch)\"}"
        
        print_ext_service_result "$content"
        
      • Sample VMTurbo Integration Script for Resource Placement for Vmware
        #!/bin/bash
        
        . /utils.sh
         
        export VMTURBO_URL="<VM_TURBO_HOST>"
        export VMTURBO_USER="<User>"
        export VMTURBO_PASSWORD="<pwd>"
        export VMTURBO_RESOURCE="http://$VMTURBO_USER:$VMTURBO_PASSWORD@$VMTURBO_URL"
        . /utils.sh
        
        #pre fixing a datacenter in the sample
        if [ -z $dcName ];
        then
            export dcName="SCL2"
        fi
        
        export vmTagsList="Name:myVm"
        export UserDataCenterName="$dcName"
        export UserClusterName="CliQr"
        export UserResourcePoolName="Eng"
        export RootFolderName="vm"
        export UserFolderName="CliqrUser-id"
        export RootDiskResizable="false"
        export FullClone="true"
        export VmRelocationEnabled="true"
        export LocalDataStoreEnabled="true"
        export SystemFolderName="CliqrTemplates"
        export networkList="10-DEV (DSwitch)"
        
        export instanceNameVar=`echo CliqrTier_"$eNV_cliqrAppTierName"_instanceType`
        eval instanceName='$'$instanceNameVar
        
        getProfileId() {
            result=`curl -s -X GET $VMTURBO_RESOURCE/vmturbo/api/templates 
        | grep $instanceName`
            export profileId=`echo $result | awk -F uuid=\" '{printf $2}' | awk -F \" '{printf $1}'`
        }
        getProfileId
        
        getDatacenterId() {
                DATACENTER=$1
            result=`curl -s -X GET
        $VMTURBO_RESOURCE/vmturbo/api/markets/Market/entities | grep
        \"DataCenter\" | grep $DATACENTER`
            export dcId=`echo $result | awk -F
        uuid=\" '{printf $2}' | awk -F \" '{printf $1}'`
        }
        getDatacenterId "$dcName"
        
        
        #echo "dcId=$dcId"
        
        getReservation() {
            reservationName="reserve-$RANDOM"
            export reserveId=`curl -s -X POST
        $VMTURBO_RESOURCE/vmturbo/api/reservations -d
        "reservationName=$reservationName&templateName=$profileId&count=1&segmentationUuid[]=$dcId"`
        }
        getReservation
        sleep 3
        
        getHostAndDS() {
            result=`curl -s -X GET
        $VMTURBO_RESOURCE/vmturbo/api/deployitems/$reserveId`
            export datastore=`echo $result |  awk -F datastore=\" '{printf $2}' | awk -F \" '{printf $1}'`-cluster
            export host=`echo $result |  awk -F host=\" '{printf $2}' | awk 
        -F
        \" '{printf $1}'`     
        }
        getHostAndDS
        export UserDatastoreCluster="$datastore" 
        export UserHost="$host"
        
        content="{\"UserDataCenterName\":\"$dcName\",\"UserClusterName\":\"$UserClusterName\",\"UserResourcePoolName\":\"$UserResourcePoolName\",\"vmTagsList\":\"$vmTagsList\",\"UserDatastoreCluster\":\"$UserDatastoreCluster\",
        \"RootFolderName\":\"$RootFolderName\",
        \"UserFolderName\":\"$UserFolderName\", \"RootDiskResizable\":\"$RootDiskResizable\”,
        \"FullClone\":\"$FullClone\", \"VmRelocationEnabled\":\"$VmRelocationEnabled\",
        \"LocalDataStoreEnabled\":\"$LocalDataStoreEnabled\",
        \"SystemFolderName\":\"$SystemFolderName\",
        \"networkList\":\"$networkList\", \"UserHost\":\"$UserHost\",\"nodeInfo\":\"UserDataCenterName:
        $dcName, UserClusterName: $UserClusterName, UserDatastoreCluster:
        $UserDatastoreCluster, networkList: $networkList \"}"
        
        print_ext_service_result "$content"
  5. Available environment variables for the Resource Placement script:

    Environment VariableDescription
    eNV_cliqrAppTierNameThe tier name
    CliqrTier_<tierName>_instanceTypeThe Instance Type of the tier
    eNV_imageNameThe image Name (for example: CentOS 6.x)
    serviceNameThe service name to identify settings like private subnet for a database service
    eNV_parentJobName

    The unique Job Name for the deployment

    CliqrCloudAccountIdThe CloudCenter cloud account ID
    CliqrCloudAccountPwdThe CloudCenter cloud account secret key
    CliqrCloudAccountNameThe CloudCenter cloud account access key and username
    Cloud_Setting_CloudFamilyThe cloud family of the region in the CloudCenter platform.

Resource Validation Flow

The Resource Validation feature is supported for all CloudCenter supported clouds.

The validation callout script is executed on a per-deployment basis, with environment variables containing details for all the tier-level hardware requirements along with summed up values for the hardware requirements required for the deployment.

To configure the Resource Validation feature, follow this procedure.

  1. Define Resource Callout by enabling the Resource Validation feature on the CCM UI > Deployments > Environments tab > Add a new or edit an existing deployment environment > Define Deployment Environment Defaults (see  Deployment Environment Defaults for additional context).

  2. Toggle the switch to YES in the Resource Validation section.

  3. Identify the script location and the specific script for the Validation Configuration.

    • Sample Resource Validation Callout Script
      #!/bin/bash
      
      . /utils.sh
      
      content="{\"validated\":\"false\",\"comment\":\"Not Enough Resources to Launch the nodes\"}"
      print_ext_service_result "$content" 
    • Available environment variables for the Resource Validation script:

      Environment VariableDescription
      CliqrCloudAccountIdThe CloudCenter cloud account ID
      CliqrCloudAccountPwdThe CloudCenter cloud account secret key
      CliqrCloudAccountNameThe CloudCenter cloud account access key and username
      CliqrTier_NameListThe comma separated list of all tiers in the application –  loop this variable for each tier in the script
      CliqrTier_Total_NumCpusThe total vCpus required to launch the complete App
      CliqrTier_Total_MemoryThe total memory required to launch the complete App
      CliqrTier_Total_Local_Storage

      The total local storage required to launch the complete App.

      CliqrTier_<tierName>_instanceTypeThe Instance Type for the tier
      CliqrTier_<tierName>_instanceName

      The Instance Type name (logical name) for the tier

      CliqrTier_<tierName>_cloudTypeThe Cloud Type for the tier.
      CliqrTier_<tierName>_numOfCPUs

      The number of CPU’s required for the tier

      CliqrTier_<tierName>_memorySize

      The memory required for the tier

      CliqrTier_<tierName>_localStorageSize

      The local storage required for the tier

      CliqrTier_<tierName>_minClusterSizeThe cluster size of the tier that is launched – Total vCPUs required for a tier would be minClusterSize x numOfCPUs