Notifications

91 views

Description

Discovery of Google Cloud Platform fails.

The discovery log contains an error message pointing at the missing relation to the LDC [cmdb_ci_logical_datacenter] for resources not listed in the Regions API response.

The following is an example of the error message:

In payload no relations defined for dependent class [cmdb_ci_<table_name>] that matches any containment/hosting rules: 
[cmdb_ci_<table_name> >> Hosted on >> cmdb_ci_logical_datacenter,cmdb_ci_<table_name> >> Hosted on >> cmdb_ci_cloud_service_account].
Add appropriate relations in payload for '{resource in cmdb_ci_<table_name> in the payload}'

or

Identifier: Identification CI Errors:
In payload no relations defined for dependent class [cmdb_ci_disk_type] that matches any containment/hosting rules:
[cmdb_ci_disk_type >> Hosted on >> cmdb_ci_logical_datacenter]. Add appropriate relations in payload for '{"className":"cmdb_ci_disk_type","values":

Cause

Discovery fails if Google API calls return values for resource location that are not defined in the list of Regions for LDC [cmdb_ci_logical_datacenter]. When such a value is returned, the pattern cannot create a relation to the Google LDC. At the next step, the pattern payload is passed to the IRE, and the identification fails, because there is no valid identification relating to the LDC [cmdb_ci_logical_datacenter].

Resolution

As a workaround, either

Import the attached "sa_pattern_b6bea16e0b72230059ec0d2835673aaf" and submit.

or   

Manually add the missing regions to the Google LDC table in the Google GCP - Get Logical Datacenter pattern shared library by following these steps:

  1. Add "Set Parameter Value" step before the step 1.17 "Create a relation between account and LDC" in "Google GCP - Get Logical Datacenter" pattern shared library
  2. On Value field type EVAL() and click on the edit button that would appear
  3. Input the following text - further regions may be added if necessary

    var table = new Packages.java.util.ArrayList()
    var region = "europe-west5"
    var row = new Packages.java.util.HashMap();
    row.put("object_id", region)
    row.put("name", region)
    row.put("region", region)
    row.put("short_description", region)
    row.put("state", "1")
    row.put("operational_status", "1")
    table.add(row)

    var region = "us-east2"
    var row = new Packages.java.util.HashMap();
    row.put("object_id", region)
    row.put("name", region)
    row.put("region", region)
    row.put("short_description", region)
    row.put("state", "1")
    row.put("operational_status", "1")
    table.add(row)

    var region = "us-east3"
    var row = new Packages.java.util.HashMap();
    row.put("object_id", region)
    row.put("name", region)
    row.put("region", region)
    row.put("short_description", region)
    row.put("state", "1")
    row.put("operational_status", "1")
    table.add(row)

    var region = "us-central2"
    var row = new Packages.java.util.HashMap();
    row.put("object_id", region)
    row.put("name", region)
    row.put("region", region)
    row.put("short_description", region)
    row.put("state", "1")
    row.put("operational_status", "1")
    table.add(row)

    CTX.setAttribute("ldc_workaround", table)         

  4. Save script
  5. Create 1 new step after this one of type "Merge Table"
  6. use the following values

                6.1 Pre-condition

                                $shouldFilterBasedOnLDC            Equals   "false"

                6.2. First Table

                                $cmdb_ci_google_datacenter

                6.3 Second table

                                $ldc_workaround

                6.4 Target Table

                                $cmdb_ci_google_datacenter

                6.5 Merge Criteria

                                Field matching

                6.6 First Table Field

                                region

                6.7 Second Table Field

                                region

                6.8 Unmatched Values

                                Keep

Note: Also, confirm that cloud resources in datacenters whose location is not defined under Regions should be discovered. If not, the related pattern can be modified to ignore such resources.

 

Article Information

Last Updated:2020-03-26 05:56:23
Published:2020-03-26
sa_pattern_b6bea16e0b72230059ec0d2835673aaf.xml