Unsupported content This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Registering a custom hostname advisor


On the Configuration workspace, you can configure the length of the host name string and a predefined format for the string. if you want more control, you can use a custom host name advisor to control the host names assigned to servers provisioned. For example, based on whether it is a virtual machine or physical server, you might want to add a character (v or p) at a fixed position.

To control host names this way, you must implement a separate host name adviser provider. Then, you can define custom workflow and use its workflow ID when configuring the provider. Then, if you provide an ID, you can call TrueSight Orchestration workflow to configure the custom host name; otherwise, the default host name configuration from the Configuration workspace is used.

Even if this workflow is custom workflow and you can dynamically change the field, you cannot dynamically change the parameters passed to this workflow. Therefore, make sure that the provisioning workflow passes all of the necessary parameters to provide details of all infrastructure-related placement decisions (such as location, cluster, pod, network container, organization as well as service offering instance, resource set, and their specific objects).

This topic includes:

For additional information, see the following BMC Communities video (9:45), which describes how to register a custom host name advisor.


icon-play.png https://youtu.be/3WAhGw1Y0G0

To create a custom host name provider definition

  1. Generate the authentication token for SUPERUSER by using the utility provided in Knowledge article 000031948

  2. Make sure that the custom host name provider definition will be a child of Workload Manager provider definition so that the provider overrides the default host name provider that is a child of EFM provider.
  3. To obtain the GUID for the Workload Manager provider definition, search the provider definition through a REST utility via POST method with the following URL:
    http://<PlatformManager>:<Port>/csm/providerdefinition/search
  4. To create the definition of the custom host name provider, send the API call through a REST utility by providing the necessary access attributes. Ensure that you replace the configurationData attribute of HOST_CONSTRUCTOR provider operation. For example,

    "configurationData": "{\"WFName\":\":CSMTest:hostname_advice\"}"
  5. Use a REST utility via POST method with the following URL:
    http://<PlatformManager>:<Port>/csm/providerdefinition
    For examples of creating a custom host name provider definition, see the attached input and output files.

To register the custom host name provider

  1. To register the custom host name provider definition with the access attribute values, use a REST utility via the POST method. with the following URL:
    http://<PlatformManager>:<Port>/csm/provider

    The following table lists access attributes and sample values:

     Access attribute

    Sample value

    AO_SERVER_URL

    http://<AOServer>:<AOPort>/baocdp/orca

    AO_SERVER_USERNAME

    admin

    AO_SERVER_PASSWORD

    RKy3Q6NHz05RFC7CCzzKRQ==

    This should be an encrypted password.

    AO_SERVER_GRID_NAME

    GRID1

    AO_SERVER_ADAPTER_NAME

    Host_Adapter
  2. To obtain the GUID for the custom host name provider definition, search the provider definition through a REST utility via POST method with the following URL:
    http://<PlatformManager>:<Port>/csm/providerdefinition/search
    For examples of registering the custom host name provider, see attached input and output json files.

To create custom TrueSight Orchestration workflow for host name advisor

  1. Use TrueSight Orchestration Development Studio to create custom workflow.
    This workflow should contain the logic to generate the required host name.
    Make sure that the following parameters are passed to the TrueSight Orchestration workflow to generate the required host name.

    Parameter Name

    Type

    Purpose

    computeContainerSpec

    ComputeContainerSpec

    The "Compute Resources" details of the ResourceSet.

    deploymentParameterValue

    DeploymentParameterValue

    The app parameters and values for blueprint parameters defined in the SDD, if any.

    functionalComponentSpec

    FunctionalComponentSpec

    The FunctionalComponents associated with this ResourceSet.

    hostnamePrefix

    String

    The host name prefix specified by the user.

    location

    Location

    The placement target location as configured in BMC Cloud Lifeycycle Management.

    logicalHostingEnvironment

    LogicalHostingEnvironment

    The placement target Network Container or Logical Data Center (LDC).

    organization

    Organization

    The tenant info for the owner.

    resourceSetSpec

    ResourceSetSpec

    The ResourceSet specification.

    serviceOfferingInstanceName 

    String

    The SOI name.

    userParameters

    DeploymentParameterValue 

    The additional application parameters associated with this request, if any.

    See the sample custom_hostname_response.xml file. This example is for the single tier provisioning. For multi-tier provisioning, you get the following response:

    <CloudObjects>
     <CloudObject class="HostnameAdvice">
       <entry>
         <string>description</string>
         <string>Test hostname advice</string>
       </entry>
       <entry>
         <string>guid</string>
         <string>f1fd5af4-9eb8-48cf-add0-93c4b307b11a</string>
       </entry>
       <entry>
         <string>name</string>
         <string>TestHostnameAdvice</string>
       </entry>
       <entry>
         <string>hostname</string>
         <list>
           <string>Punetisrab11a</string>
         </list>
       </entry>
     </CloudObject>
     <CloudObject class="HostnameAdvice">
       <entry>
         <string>description</string>
         <string>Test hostname advice</string>
       </entry>
       <entry>
         <string>guid</string>
         <string>07855d91-1b61-4a04-91e3-2e6dc9417b34</string>
       </entry>
       <entry>
         <string>name</string>
         <string>TestHostnameAdvice</string>
       </entry>
       <entry>
         <string>hostname</string>
         <list>
           <string>Punetisra7b34</string>
         </list>
     <list>
           <string>Punetisrab11a</string>
           <string>Punetisrab11b</string>
         </list>
       </entry>
     </CloudObject>
    </CloudObjects>

    The workflow should return the list of HostnameAdvice objects as mentioned in ComputeContainerSpec “instances” attribute.

  2. Import the workflow into TrueSight Orchestration.

To create custom TrueSight Orchestration workflow for resource name advisor for Azure

  1. Use TrueSight Orchestration Development Studio to create custom workflow.
    This workflow should contain the logic to generate the required host name.
    Make sure that the following parameters are passed to the TrueSight Orchestration workflow to generate the required host name.

    Parameter Name

    Type

    Purpose

    ccSpecList

    ComputeContainerSpec

    The "Compute Resources" details of the ResourceSet.

    deploymentParameterValue

    DeploymentParameterValue

    The app parameters and values for blueprint parameters defined in the SDD, if any.

    fcSpecList

    FunctionalComponentSpec

    The FunctionalComponents associated with this ResourceSet.

    resourceNamePrefix

    String

    The resource name prefix specified by the user.

    location

    Location

    The placement target location as configured in BMC Cloud Lifeycycle Management.

    logicalHostingEnvironment

    LogicalHostingEnvironment

    The placement target Network Container or Logical Data Center (LDC).

    organization

    Organization

    The tenant info for the owner.

    rsSpecList

    ResourceSetSpec

    The ResourceSet specification.

    serviceOfferingInstanceName 

    String

    The SOI name.

    userParameters

    DeploymentParameterValue 

    The additional application parameters associated with this request, if any.

    user

    User

    The owner of the request.

    resources

    ResourceNameAdvice

    This is the list of recources for which name needs to be advised.

    See the sample ResourceNameAdvice-Request1.xmland ResourceNameAdvice-Request2.xmlfiles. 

    The workflow should return the list of ResourceNameAdvice objects. The request should send a list of resources as part of ResourceNameAdvice objects list and custom resource name advisor returns the same list by modifying the name for each resource. See the sample request and response files of a custom resource name advisor for BMC Cloud Lifecycle Management add disk workflow, where name advice is provided for a disk that is being added. 

    The following table displays the type, subtype, and attributes for Azure resource group and resources.

    Azure Resources

    Type

    SubType

    Attributes

    Resource Group

    RESOURCE_CONTAINER

    COMPUTE


    Availability Set         

    AVAILABILITY_SET

    MANAGED

    UNMANAGED

    SOI_NAME

    RESOURCESET_NAME

    IP Address

    IP_ADDRESS

    PUBLIC


    SERVER_NAME

    RESOURCESET_NAME

    NIC_NUMBER

    Load Balancer

    LOAD_BALANCER

    PUBLIC_FACING

    PRIVATE_FACING

    SOI_NAME

    RESOURCESET_NAME

    AVAILABILITYSET_NAME

    Storage Account

    STORAGE_ACCOUNT

    STANDARD

    PREMIUM

    SOI_NAME

    RESOURCESET_NAME

    NetworkInterface

    NIC

    STATIC

    DHCP


    SERVER_NAME

    RESOURCESET_NAME

    NIC_NUMBER

    Disk

    DISK

    MANAGED

    UNMANAGED

    SERVER_NAME

    RESOURCESET_NAME

    DISKNUMBER

    DISKTYPE

    Network Security Group

    NETWORK_SECURITY_GROUP

    NIC_LEVEL_NSG

    SERVER_NAME

    NIC_NUMBER

    NIC_NETWORK_NAME

    NIC_GUID

  2. Import the workflow into TrueSight Orchestration.

To un-register the custom host name provider

  1. Get the GUID of the host name advisor instance, perform a search POST API call on http://<platform manager machine>:<port>/csm/provider/Search.
  2. To unregister the advisor, perform a DELETE operation on the API:
    http://<platform manager machine>:<port>/csm/provider/<host name advisor instance GUID>The request body must be blank.
  3. To unregister the provider definition, look for the provider definition GUID by performing a search POST API call on http://<platform manager machine>:<port>/csm/providerdefinition/Search.
  4. Perform a DELETE operation on the API:
    http://<platform manager machine>:<port>/csm/providerdefinition/<hostname advisor provider definition guid>The request body must be blank.
  5. After deleting provider and provider definition, execute purge Reconciliation Job to clear all Mark as Deleted entries.

Example workflows

Following are two example workflows:

  • Workflow 1: Returns the list of host names in the "affix last four characters of GUID" format.
  • Workflow 2: Returns the list of host names in following format:
    • 1      OS       (W)indows, (L)inux
    • 2      LOC     (P)hoenix
    • 3      ENV     (L)ab, (D)ev, (Q)a, (P)rod
    • 4      ARB     CLD now but it's arbitrary - perhaps we can use for multiple vCDs
    • 56    TYPE    (WB)Web, (AP)App, (DB)Database, (UT)Utility, (WA)WebApp
    • XXXX    Incrementing number 01,02,03,04,99 then rolls to 100, and 999 then rolls to 1000 etc

Following are two example custom host names:

  • WPDCLDAP01 - Windows,Phoenix,Dev,CLOUD,App
  • LPQCLDDB01 - RHEL,Phoenix,CLOUD,QA,Database

As you create custom host names, remember these constraints:

  • The maximum length of a host name is 15 characters.
  • The configuration is global and applies to all host names that BMC Cloud Lifecycle Management generates.
  • When writing a custom host name advisor, keep concurrency and multi-thread aspects in mind. For example, two concurrent requests should not have the same host name.

Troubleshooting

Following are troubleshooting tips if you run into issues:

  • Check the custom provider definition.
    • After you create the custom provider definition, search the providers to confirm that it was created.
    • You can search by using a REST utility via POST Method by URL:
      http://<PlatformManager>:<Port>/csm/providerdefinition/search
  • Check the custom provider registration.
    • After you register the custom provider, search the providers to confirm that it was registered.
    • You can search by using a REST utility via POST Method by URL:
      http://<PlatformManager>:<Port>/csm/provider/search
  • De-register the custom host name provider.
    • If you need to use the out-of-the-box host name provider and de-register the custom host name provider, complete the following steps:

      1. Use the DELETE API call:
        DELETE ../csm/provider/<guid>DELETE ../csm/providerdefinition/<guid>

        Make sure that the custom host name provider is deleted first and then the custom host name provider definition is deleted.

        The entry in the CloudDB is set to Mark as Deleted. All relationships are then deleted.

      2. Remove the Mark as Deleted entries from the CloudDB.
        You can execute one Reconciliation Job (purge) to clear all Mark as Deleted entries.

Related links on BMC Communities

https://communities.bmc.com/docs/DOC-40842

https://communities.bmc.com/thread/93386

  • Request should send list of resources as part of ResourceNameAdvice objects list and custom resource name advisor will return same list by modifying the name  (with new name) for each resource.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*