Repository: vmware/govmomi
Pull request #2113 (2020-09-14 06:49:15)

Add ClusterDistribution field for CNS telemetry
This pull request is adding a go binding for ClusterDistribution to support CNS telemetry and also make cns/client.go backward compatible to vsan67u3 and vsan70 by dropping optional fields not known to the prior releases.

Testing:
For VC version > 7.0
```
% export CNS_VC_URL='https://Administrator@vsphere.local:Admin!23@10.78.100.14/sdk'
% export CNS_DATACENTER='VSAN-DC'
% export CNS_DATASTORE='vsanDatastore'

% go test -v
=== RUN   TestClient
--- PASS: TestClient (32.61s)
    client_test.go:128: Creating volume using the spec: types.CnsVolumeCreateSpec{
            Name:       "pvc-901e87eb-c2bd-11e9-806f-005056a0c9a0",
            VolumeType: "BLOCK",
            Datastores: []types.ManagedObjectReference{
                {Type:"Datastore", Value:"datastore-36"},
            },
            Metadata: types.CnsVolumeMetadata{
                ContainerCluster: types.CnsContainerCluster{
                    ClusterType:         "KUBERNETES",
                    ClusterId:           "demo-cluster-id",
                    VSphereUser:         "Administrator@vsphere.local",
                    ClusterFlavor:       "VANILLA",
                    ClusterDistribution: "OpenShift",
                },
                EntityMetadata:        nil,
                ContainerClusterArray: nil,
            },
            BackingObjectDetails: &types.CnsBlockBackingDetails{
                CnsBackingObjectDetails: types.CnsBackingObjectDetails{
                    CapacityInMb: 5120,
                },
                BackingDiskId:      "",
                BackingDiskUrlPath: "",
            },
            Profile:    nil,
            CreateSpec: nil,
        }
.
.
.
client_test.go:217: Successfully Queried Volumes. queryResult: &types.CnsQueryResult{
            Volumes: []types.CnsVolume{
                {
                    VolumeId: types.CnsVolumeId{
                        Id: "0cdfb822-2ddd-4897-a067-3fe37682371d",
                    },
                    DatastoreUrl:    "ds:///vmfs/volumes/vsan:524f0c83003d697c-b67ae4bec09d8333/",
                    Name:            "pvc-901e87eb-c2bd-11e9-806f-005056a0c9a0",
                    VolumeType:      "BLOCK",
                    StoragePolicyId: "aa6d5a82-1c88-45da-85d3-3d74b91a5bad",
                    Metadata:        types.CnsVolumeMetadata{
                        ContainerCluster: types.CnsContainerCluster{
                            ClusterType:         "KUBERNETES",
                            ClusterId:           "demo-cluster-id",
                            VSphereUser:         "Administrator@vsphere.local",
                            ClusterFlavor:       "VANILLA",
                            ClusterDistribution: "OpenShift",
                        },
                        EntityMetadata:        nil,
                        ContainerClusterArray: []types.CnsContainerCluster{
                            {
                                ClusterType:         "KUBERNETES",
                                ClusterId:           "demo-cluster-id",
                                VSphereUser:         "Administrator@vsphere.local",
                                ClusterFlavor:       "VANILLA",
                                ClusterDistribution: "OpenShift",
                            },
                        },
                    },
.
.
.
PASS
ok  	github.com/vmware/govmomi/cns	32.642s
```
simulator test
```
=== RUN   TestSimulator
--- PASS: TestSimulator (0.04s)
PASS
ok  	github.com/vmware/govmomi/cns/simulator	0.064s
```
For VC version <= 7.0
Before modifying the dropping unknown fields:
```
% export CNS_VC_URL='https://Administrator@vsphere.local:Admin!23@10.182.2.135/sdk'
% export CNS_DATACENTER='VSAN-DC'
% export CNS_DATASTORE='vsanDatastore'
% go test -v

    client_test.go:131: Failed to create volume. Error: ServerFaultCode:
        Unexpected element tag "clusterDistribution" seen

   client_test.go:380: Failed to update volume metadata. Error: ServerFaultCode:
        Unexpected element tag "clusterDistribution" seen

```
After modify:
```
=== RUN   TestClient
--- PASS: TestClient (46.75s)
    client_test.go:128: Creating volume using the spec: types.CnsVolumeCreateSpec{
            Name:       "pvc-901e87eb-c2bd-11e9-806f-005056a0c9a0",
            VolumeType: "BLOCK",
            Datastores: []types.ManagedObjectReference{
                {Type:"Datastore", Value:"datastore-36"},
            },
            Metadata: types.CnsVolumeMetadata{
                ContainerCluster: types.CnsContainerCluster{
                    ClusterType:         "KUBERNETES",
                    ClusterId:           "demo-cluster-id",
                    VSphereUser:         "Administrator@vsphere.local",
                    ClusterFlavor:       "VANILLA",
                    ClusterDistribution: "OpenShift",
                },
                EntityMetadata:        nil,
                ContainerClusterArray: nil,
            },
            BackingObjectDetails: &types.CnsBlockBackingDetails{
                CnsBackingObjectDetails: types.CnsBackingObjectDetails{
                    CapacityInMb: 5120,
                },
                BackingDiskId:      "",
                BackingDiskUrlPath: "",
            },
            Profile:    nil,
            CreateSpec: nil,
        }
    client_test.go:153: Volume created sucessfully. volumeId: f5a9e13a-e2f7-4621-a416-60eda374f23f
.
.
.
client_test.go:211: Calling QueryVolume using queryFilter: types.CnsQueryFilter{
            VolumeIds: []types.CnsVolumeId{
                {
                    Id: "f5a9e13a-e2f7-4621-a416-60eda374f23f",
                },
            },
            Names:                        nil,
            ContainerClusterIds:          nil,
            StoragePolicyId:              "",
            Datastores:                   nil,
            Labels:                       nil,
            ComplianceStatus:             "",
            DatastoreAccessibilityStatus: "",
            Cursor:                       (*types.CnsCursor)(nil),
            healthStatus:                 "",
        }
    client_test.go:217: Successfully Queried Volumes. queryResult: &types.CnsQueryResult{
            Volumes: []types.CnsVolume{
                {
                    VolumeId: types.CnsVolumeId{
                        Id: "f5a9e13a-e2f7-4621-a416-60eda374f23f",
                    },
                    DatastoreUrl:    "ds:///vmfs/volumes/vsan:52216ea322833634-e5928c73810e5a3d/",
                    Name:            "pvc-901e87eb-c2bd-11e9-806f-005056a0c9a0",
                    VolumeType:      "BLOCK",
                    StoragePolicyId: "aa6d5a82-1c88-45da-85d3-3d74b91a5bad",
                    Metadata:        types.CnsVolumeMetadata{
                        ContainerCluster: types.CnsContainerCluster{
                            ClusterType:         "KUBERNETES",
                            ClusterId:           "demo-cluster-id",
                            VSphereUser:         "Administrator@vsphere.local",
                            ClusterFlavor:       "VANILLA",
                            ClusterDistribution: "",
                        },
.
.
.
    client_test.go:376: Updating volume using the spec: {DynamicData:{} VolumeId:{DynamicData:{} Id:f5a9e13a-e2f7-4621-a416-60eda374f23f} Metadata:{DynamicData:{} ContainerCluster:{DynamicData:{} ClusterType:KUBERNETES ClusterId:demo-cluster-id VSphereUser:Administrator@vsphere.local ClusterFlavor:VANILLA ClusterDistribution:OpenShift} EntityMetadata:[0xc00040ea00 0xc00040ea80 0xc00040eb00] ContainerClusterArray:[{DynamicData:{} ClusterType:KUBERNETES ClusterId:demo-cluster-id VSphereUser:Administrator@vsphere.local ClusterFlavor:VANILLA ClusterDistribution:OpenShift}]}}
    client_test.go:401: Successfully updated volume metadata
client_test.go:410: Successfully Queried Volumes. queryResult: &types.CnsQueryResult{
            Volumes: []types.CnsVolume{
                {
                    VolumeId: types.CnsVolumeId{
                        Id: "f5a9e13a-e2f7-4621-a416-60eda374f23f",
                    },
                    DatastoreUrl:    "ds:///vmfs/volumes/vsan:52216ea322833634-e5928c73810e5a3d/",
                    Name:            "pvc-901e87eb-c2bd-11e9-806f-005056a0c9a0",
                    VolumeType:      "BLOCK",
                    StoragePolicyId: "aa6d5a82-1c88-45da-85d3-3d74b91a5bad",
                    Metadata:        types.CnsVolumeMetadata{
                        ContainerCluster: types.CnsContainerCluster{
                            ClusterType:         "KUBERNETES",
                            ClusterId:           "demo-cluster-id",
                            VSphereUser:         "Administrator@vsphere.local",
                            ClusterFlavor:       "VANILLA",
                            ClusterDistribution: "",
                        },
.
.
.
PASS
ok  	github.com/vmware/govmomi/cns	46.777s

```

@SandeepPissay @divyenpatel  

divyenpatel: @yuyiying Can you make this change backward compatible.

Refer how we are dropping unknown fields for prior releases of vSphere. - https://github.com/vmware/govmomi/blob/master/cns/cns_util.go#L71-L105

SandeepPissay: > @yuyiying Can you make this change backward compatible.
> 
> Refer how we are dropping unknown fields for prior releases of vSphere. - https://github.com/vmware/govmomi/blob/master/cns/cns_util.go#L71-L105

@divyenpatel Why is this required? Does older CNS fail an API request that has newer fields?
divyenpatel: Yes @SandeepPissay, if we do not drop unknown elements, call with fail on the older release with the message `Unexpected element tag seen while parsing serialized DataObject`. 

With this [code](https://github.com/vmware/govmomi/blob/master/cns/cns_util.go#L71-L105), we are making sure the latest CSI driver works on older releases of vSphere.



SandeepPissay: @divyenpatel This looks like a problem in govmomi. Govmomi should ignore those fields that the server does not understand. IIRC this is how other vmomi clients behave. Cc @dougm 
divyenpatel: @yuyiying Can you squash all your commits. Change looks good to me.
yuyiying: @divyenpatel  Already squashed. Thanks!

Patch:
diff --git a/cns/cns_util.go b/cns/cns_util.go
index ec949250..80441601 100644
--- a/cns/cns_util.go
+++ b/cns/cns_util.go
@@ -70,11 +70,12 @@ func GetTaskResultArray(ctx context.Context, taskInfo *vim25types.TaskInfo) ([]c
 
 // dropUnknownCreateSpecElements helps drop newly added elements in the CnsVolumeCreateSpec, which are not known to the prior vSphere releases
 func dropUnknownCreateSpecElements(c *Client, createSpecList []cnstypes.CnsVolumeCreateSpec) []cnstypes.CnsVolumeCreateSpec {
-	var updatedcreateSpecList []cnstypes.CnsVolumeCreateSpec
 	if c.serviceClient.Version == ReleaseVSAN67u3 {
 		// Dropping optional fields not known to vSAN 6.7U3
+		updatedcreateSpecList := make([]cnstypes.CnsVolumeCreateSpec, 0, len(createSpecList))
 		for _, createSpec := range createSpecList {
 			createSpec.Metadata.ContainerCluster.ClusterFlavor = ""
+			createSpec.Metadata.ContainerCluster.ClusterDistribution = ""
 			createSpec.Metadata.ContainerClusterArray = nil
 			var updatedEntityMetadata []cnstypes.BaseCnsEntityMetadata
 			for _, entityMetadata := range createSpec.Metadata.EntityMetadata {
@@ -92,7 +93,9 @@ func dropUnknownCreateSpecElements(c *Client, createSpecList []cnstypes.CnsVolum
 		}
 		createSpecList = updatedcreateSpecList
 	} else if c.serviceClient.Version == ReleaseVSAN70 {
+		updatedcreateSpecList := make([]cnstypes.CnsVolumeCreateSpec, 0, len(createSpecList))
 		for _, createSpec := range createSpecList {
+			createSpec.Metadata.ContainerCluster.ClusterDistribution = ""
 			_, ok := createSpec.BackingObjectDetails.(*cnstypes.CnsBlockBackingDetails)
 			if ok {
 				createSpec.BackingObjectDetails.(*cnstypes.CnsBlockBackingDetails).BackingDiskUrlPath = ""
@@ -106,11 +109,12 @@ func dropUnknownCreateSpecElements(c *Client, createSpecList []cnstypes.CnsVolum
 
 // dropUnknownVolumeMetadataUpdateSpecElements helps drop newly added elements in the CnsVolumeMetadataUpdateSpec, which are not known to the prior vSphere releases
 func dropUnknownVolumeMetadataUpdateSpecElements(c *Client, updateSpecList []cnstypes.CnsVolumeMetadataUpdateSpec) []cnstypes.CnsVolumeMetadataUpdateSpec {
+	// Dropping optional fields not known to vSAN 6.7U3
 	if c.serviceClient.Version == ReleaseVSAN67u3 {
-		// Dropping optional fields not known to vSAN 6.7U3
-		var updatedUpdateSpecList []cnstypes.CnsVolumeMetadataUpdateSpec
+		updatedUpdateSpecList := make([]cnstypes.CnsVolumeMetadataUpdateSpec, 0, len(updateSpecList))
 		for _, updateSpec := range updateSpecList {
 			updateSpec.Metadata.ContainerCluster.ClusterFlavor = ""
+			updateSpec.Metadata.ContainerCluster.ClusterDistribution = ""
 			var updatedEntityMetadata []cnstypes.BaseCnsEntityMetadata
 			for _, entityMetadata := range updateSpec.Metadata.EntityMetadata {
 				k8sEntityMetadata := interface{}(entityMetadata).(*cnstypes.CnsKubernetesEntityMetadata)
@@ -123,6 +127,19 @@ func dropUnknownVolumeMetadataUpdateSpecElements(c *Client, updateSpecList []cns
 			updatedUpdateSpecList = append(updatedUpdateSpecList, updateSpec)
 		}
 		updateSpecList = updatedUpdateSpecList
+	} else if c.serviceClient.Version == ReleaseVSAN70 {
+		updatedUpdateSpecList := make([]cnstypes.CnsVolumeMetadataUpdateSpec, 0, len(updateSpecList))
+		for _, updateSpec := range updateSpecList {
+			updateSpec.Metadata.ContainerCluster.ClusterDistribution = ""
+			var updatedContainerClusterArray []cnstypes.CnsContainerCluster
+			for _, containerCluster := range updateSpec.Metadata.ContainerClusterArray {
+				containerCluster.ClusterDistribution = ""
+				updatedContainerClusterArray = append(updatedContainerClusterArray, containerCluster)
+			}
+			updateSpec.Metadata.ContainerClusterArray = updatedContainerClusterArray
+			updatedUpdateSpecList = append(updatedUpdateSpecList, updateSpec)
+		}
+		updateSpecList = updatedUpdateSpecList
 	}
 	return updateSpecList
 }
diff --git a/cns/types/types.go b/cns/types/types.go
index 843d1505..401017ca 100644
--- a/cns/types/types.go
+++ b/cns/types/types.go
@@ -287,10 +287,11 @@ type CnsQueryAllVolumeResponse struct {
 type CnsContainerCluster struct {
 	types.DynamicData
 
-	ClusterType   string `xml:"clusterType"`
-	ClusterId     string `xml:"clusterId"`
-	VSphereUser   string `xml:"vSphereUser"`
-	ClusterFlavor string `xml:"clusterFlavor,omitempty"`
+	ClusterType         string `xml:"clusterType"`
+	ClusterId           string `xml:"clusterId"`
+	VSphereUser         string `xml:"vSphereUser"`
+	ClusterFlavor       string `xml:"clusterFlavor,omitempty"`
+	ClusterDistribution string `xml:"clusterDistribution,omitempty"`
 }
 
 func init() {
diff --git a/vsan/client.go b/vsan/client.go
index 6d50f7c7..3648da29 100644
--- a/vsan/client.go
+++ b/vsan/client.go
@@ -84,28 +84,3 @@ func (c *Client) VsanPerfQueryPerf(ctx context.Context, cluster *vimtypes.Manage
 	}
 	return res.Returnval, nil
 }
-
-// Creates the vsan object identities instance. This is to be queried from vsan health.
-var (
-	VsanQueryObjectIdentitiesInstance = vimtypes.ManagedObjectReference{
-		Type:  "VsanObjectSystem",
-		Value: "vsan-cluster-object-system",
-	}
-)
-
-// VsanQueryObjectIdentities return host uuid
-func (c *Client) VsanQueryObjectIdentities(ctx context.Context, cluster vimtypes.ManagedObjectReference) (*vsantypes.VsanObjectIdentityAndHealth, error) {
-	req := vsantypes.VsanQueryObjectIdentities{
-		This:    VsanQueryObjectIdentitiesInstance,
-		Cluster: cluster,
-	}
-
-	res, err := methods.VsanQueryObjectIdentities(ctx, c.serviceClient, &req)
-
-	if err != nil {
-		return nil, err
-	}
-
-	return &res.Returnval, nil
-
-}
diff --git a/vsan/methods/methods.go b/vsan/methods/methods.go
index 732c5961..a94d5c5e 100644
--- a/vsan/methods/methods.go
+++ b/vsan/methods/methods.go
@@ -44,29 +44,6 @@ func VsanPerfGetSupportedEntityTypes(ctx context.Context, r soap.RoundTripper, r
 	return resBody.Res, nil
 }
 
-//Object Identities
-
-type VsanQueryObjectIdentitiesBody struct {
-	Req    *types.VsanQueryObjectIdentities         `xml:"urn:vsan VsanQueryObjectIdentities,omitempty"`
-	Res    *types.VsanQueryObjectIdentitiesResponse `xml:"urn:vsan VsanQueryObjectIdentitiesResponse,omitempty"`
-	Fault_ *soap.Fault                              `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
-}
-
-func (b *VsanQueryObjectIdentitiesBody) Fault() *soap.Fault { return b.Fault_ }
-
-func VsanQueryObjectIdentities(ctx context.Context, r soap.RoundTripper, req *types.VsanQueryObjectIdentities) (*types.VsanQueryObjectIdentitiesResponse, error) {
-	var reqBody, resBody VsanQueryObjectIdentitiesBody
-
-	reqBody.Req = req
-
-	if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
-		return nil, err
-	}
-
-	return resBody.Res, nil
-
-}
-
 // Health summary
 type VsanQueryVcClusterHealthSummaryBody struct {
 	Req    *types.VsanQueryVcClusterHealthSummary         `xml:"urn:vsan VsanQueryVcClusterHealthSummary,omitempty"`
@@ -170,23 +147,3 @@ func VsanClusterGetConfig(ctx context.Context, r soap.RoundTripper, req *types.V
 
 	return resBody.Res, nil
 }
-
-type QueryVsanObjectsBody struct {
-	Req    *types.QueryVsanObjects         `xml:"urn:vsan QueryVsanObjects,omitempty"`
-	Res    *types.QueryVsanObjectsResponse `xml:"urn:vsan QueryVsanObjectsResponse,omitempty"`
-	Fault_ *soap.Fault                     `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
-}
-
-func (b *QueryVsanObjectsBody) Fault() *soap.Fault { return b.Fault_ }
-
-func QueryVsanObjects(ctx context.Context, r soap.RoundTripper, req *types.QueryVsanObjects) (*types.QueryVsanObjectsResponse, error) {
-	var reqBody, resBody QueryVsanObjectsBody
-
-	reqBody.Req = req
-
-	if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
-		return nil, err
-	}
-
-	return resBody.Res, nil
-}
diff --git a/vsan/types/types.go b/vsan/types/types.go
index b950edd1..48c151fb 100644
--- a/vsan/types/types.go
+++ b/vsan/types/types.go
@@ -83,52 +83,6 @@ func init() {
 	t["VsanPerfThreshold"] = reflect.TypeOf((*VsanPerfThreshold)(nil)).Elem()
 }
 
-// Vsan Query Object Identies
-type VsanQueryObjectIdentities VsanQueryObjectIdentitiesRequestType
-
-func init() {
-	t["VsanQueryObjectIdentities"] = reflect.TypeOf((*VsanQueryObjectIdentities)(nil)).Elem()
-}
-
-type VsanQueryObjectIdentitiesRequestType struct {
-	This                types.ManagedObjectReference `xml:"_this"`
-	Cluster             types.ManagedObjectReference `xml:"cluster"`
-	ObjTypes            []string                     `xml:"objTypes,omitempty"`
-	ObjUuids            []string                     `xml:"objUuids,omitempty"`
-	IncludeObjIdentity  *bool                        `xml:"includeObjIdentity"`
-	IncludeHealth       *bool                        `xml:"includeHealth,omitempty"`
-	IncludeSpaceSummary *bool                        `xml:"includeSpaceSummary"`
-}
-
-func init() {
-	t["VsanQueryObjectIdentitiesRequestType"] = reflect.TypeOf((*VsanQueryObjectIdentitiesRequestType)(nil)).Elem()
-}
-
-type VsanQueryObjectIdentitiesResponse struct {
-	Returnval VsanObjectIdentityAndHealth `xml:"returnval"`
-}
-
-type VsanObjectIdentityAndHealth struct {
-	DynamicData
-
-	Health       *VsanObjectOverallHealth `xml:"health,omitempty"`
-	Identities   *VsanObjectIdentity      `xml:"identities,omitempty"`
-	RawData      string                   `xml:"rawData,omitempty"`
-	SpaceSummary []VsanObjectSpaceSummary `xml:"spaceSummary,omitempty"`
-}
-
-func init() {
-	t["VsanObjectIdentityAndHealth"] = reflect.TypeOf((*VsanObjectIdentityAndHealth)(nil)).Elem()
-}
-
-type VsanObjectIdentity struct {
-	Uuid string `xml:"uuid,omitempty"`
-}
-
-func init() {
-	t["VsanObjectIdentity"] = reflect.TypeOf((*VsanObjectIdentity)(nil)).Elem()
-}
-
 // Cluster health summary
 type VsanQueryVcClusterHealthSummary VsanQueryVcClusterHealthSummaryRequestType
 
@@ -1455,25 +1409,6 @@ type VsanClusterGetConfigResponse struct {
 	Returnval VsanConfigInfoEx `xml:"returnval"`
 }
 
-type QueryVsanObjectsRequestType struct {
-	This  types.ManagedObjectReference `xml:"_this"`
-	Uuids []string                     `xml:"uuids"`
-}
-
-func init() {
-	types.Add("QueryVsanObjecstRequestType", reflect.TypeOf((*QueryVsanObjectsRequestType)(nil)).Elem())
-}
-
-type QueryVsanObjects QueryVsanObjectsRequestType
-
-func init() {
-	types.Add("QueryVsanObjects", reflect.TypeOf((*QueryVsanObjects)(nil)).Elem())
-}
-
-type QueryVsanObjectsResponse struct {
-	Returnval string `xml:"returnval"`
-}
-
 type VsanConfigInfoEx struct {
 	VsanClusterConfigInfo
 


Test patch:
diff --git a/cns/client_test.go b/cns/client_test.go
index b2e1e2f3..0b37d195 100644
--- a/cns/client_test.go
+++ b/cns/client_test.go
@@ -101,10 +101,11 @@ func TestClient(t *testing.T) {
 
 	var containerClusterArray []cnstypes.CnsContainerCluster
 	containerCluster := cnstypes.CnsContainerCluster{
-		ClusterType:   string(cnstypes.CnsClusterTypeKubernetes),
-		ClusterId:     "demo-cluster-id",
-		VSphereUser:   "Administrator@vsphere.local",
-		ClusterFlavor: string(cnstypes.CnsClusterFlavorVanilla),
+		ClusterType:         string(cnstypes.CnsClusterTypeKubernetes),
+		ClusterId:           "demo-cluster-id",
+		VSphereUser:         "Administrator@vsphere.local",
+		ClusterFlavor:       string(cnstypes.CnsClusterFlavorVanilla),
+		ClusterDistribution: "OpenShift",
 	}
 	containerClusterArray = append(containerClusterArray, containerCluster)
 
diff --git a/vsan/client_test.go b/vsan/client_test.go
index 47091441..6ba8852a 100644
--- a/vsan/client_test.go
+++ b/vsan/client_test.go
@@ -81,51 +81,3 @@ func TestClient(t *testing.T) {
 		t.Logf("Printing one of the clusterConfig where file service is enabled:\n %+v", pretty.Sprint(clusterConfigToPrint))
 	}
 }
-
-func TestVsanQueryObjectIdentities(t *testing.T) {
-	url := os.Getenv("VC_URL")            // example: export VC_URL='https://username:password@vc-ip/sdk'
-	datacenter := os.Getenv("DATACENTER") // example: export DATACENTER='name-of-datacenter'
-	if url == "" || datacenter == "" {
-		t.Skip("VC_URL or DATACENTER is not set")
-	}
-
-	u, err := soap.ParseURL(url)
-	if err != nil {
-		t.Fatal(err)
-	}
-	ctx := context.Background()
-
-	c, err := govmomi.NewClient(ctx, u, true)
-	if err != nil {
-		t.Fatal(err)
-	}
-
-	vsanHealthClient, err := NewClient(ctx, c.Client)
-	if err != nil {
-		t.Fatal(err)
-	}
-
-	finder := find.NewFinder(vsanHealthClient.vim25Client, false)
-	dc, err := finder.Datacenter(ctx, datacenter)
-	if err != nil {
-		t.Fatal(err)
-	}
-	finder.SetDatacenter(dc)
-
-	clusterComputeResource, err := finder.ClusterComputeResourceList(ctx, "*")
-
-	if err != nil {
-		t.Logf("Error occurred while getting clusterComputeResource %+v", err.Error())
-		t.Fatal(err)
-	}
-
-	for _, cluster := range clusterComputeResource {
-		clusterConfig, err := vsanHealthClient.VsanQueryObjectIdentities(ctx, cluster.Reference())
-		if err != nil {
-			t.Logf("Error occurred: %+v", err.Error())
-			t.Fatal(err)
-		}
-		t.Logf("Printing clusterConfig:\n %+s", pretty.Sprint(clusterConfig))
-	}
-
-}