From 0ffbf057c7161884c59d2a0ed36588e91b2ef5f8 Mon Sep 17 00:00:00 2001 From: Stanislav Hadjiiski Date: Wed, 24 Oct 2018 18:20:32 +0300 Subject: [PATCH] Correctly propagate tenant links when using PlacementZoneUtil Until now, tenant links were attached to the underlying resource pool state, but not to the elastic placement zone state. This approach works for systems where the elastic placement zone state contains no tenant links. If this is not the case, the tenant links of the resource pool state are overwritten. This resulted in problems in VCA mode where an organization tenant link is attached to the elastic placement zone. This removes the project link that gets set from the PlacementZoneUtil. To fix this, we manually set the tenant links of the elastic placement zone state as well. Change-Id: If9ed3f36148d71592c2949eaef4153235227214e Reviewed-on: https://bellevue-ci.eng.vmware.com:8080/47427 Closures-Verified: jenkins Upgrade-Verified: jenkins PG-Verified: jenkins CS-Verified: jenkins Bellevue-Verified: jenkins Reviewed-by: Sergio Sanchez --- .../com/vmware/admiral/compute/PlacementZoneUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compute/src/main/java/com/vmware/admiral/compute/PlacementZoneUtil.java b/compute/src/main/java/com/vmware/admiral/compute/PlacementZoneUtil.java index 43ae821d3..50bc69400 100644 --- a/compute/src/main/java/com/vmware/admiral/compute/PlacementZoneUtil.java +++ b/compute/src/main/java/com/vmware/admiral/compute/PlacementZoneUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 VMware, Inc. All Rights Reserved. + * Copyright (c) 2017-2018 VMware, Inc. All Rights Reserved. * * This product is licensed to you under the Apache License, Version 2.0 (the "License"). * You may not use this product except in compliance with the License. @@ -126,13 +126,15 @@ public static DeferredResult generatePlacementZone(ServiceHos resourcePool.customProperties.put(PKS_ENDPOINT_PROP_NAME, s); } + // create the placement zone + ElasticPlacementZoneConfigurationState placementZone = new ElasticPlacementZoneConfigurationState(); + placementZone.resourcePoolState = resourcePool; + if (hostState.tenantLinks != null) { resourcePool.tenantLinks = new ArrayList<>(hostState.tenantLinks); + placementZone.tenantLinks = new ArrayList<>(hostState.tenantLinks); } - // create the placement zone - ElasticPlacementZoneConfigurationState placementZone = new ElasticPlacementZoneConfigurationState(); - placementZone.resourcePoolState = resourcePool; return serviceHost.sendWithDeferredResult( Operation .createPost(serviceHost, ElasticPlacementZoneConfigurationService.SELF_LINK)