Skip to content

Commit cff9ad0

Browse files
committed
Add global setting to control different host tags offering checks
1 parent deeac92 commit cff9ad0

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.cloud.storage.dao.StoragePoolAndAccessGroupMapDao;
4646
import com.cloud.cluster.ManagementServerHostPeerJoinVO;
4747

48+
import com.cloud.vm.UserVmManager;
4849
import org.apache.cloudstack.acl.ControlledEntity;
4950
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
5051
import org.apache.cloudstack.acl.SecurityChecker;
@@ -4330,7 +4331,9 @@ private Pair<List<Long>, Integer> searchForServiceOfferingIdsAndCount(ListServic
43304331
List<String> hostTags = new ArrayList<>();
43314332
if (currentVmOffering != null) {
43324333
hostTags.addAll(com.cloud.utils.StringUtils.csvTagsToList(currentVmOffering.getHostTag()));
4333-
addVmCurrentClusterHostTags(vmInstance, hostTags);
4334+
if (UserVmManager.AllowDifferentHostTagsOfferingsForVmScale.value()) {
4335+
addVmCurrentClusterHostTags(vmInstance, hostTags);
4336+
}
43344337
}
43354338

43364339
if (!hostTags.isEmpty()) {

server/src/main/java/com/cloud/vm/UserVmManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ public interface UserVmManager extends UserVmService {
108108
"Comma separated list of allowed additional VM settings if VM instance settings are read from OVA.",
109109
true, ConfigKey.Scope.Zone, null, null, null, null, null, ConfigKey.Kind.CSV, null);
110110

111+
ConfigKey<Boolean> AllowDifferentHostTagsOfferingsForVmScale = new ConfigKey<>("Advanced", Boolean.class, "allow.different.host.tags.offerings.for.vm.scale", "false",
112+
"Enables/Disable allowing to change a VM offering to offerings with different host tags", true);
113+
111114
static final int MAX_USER_DATA_LENGTH_BYTES = 2048;
112115

113116
public static final String CKS_NODE = "cksnode";

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9394,7 +9394,7 @@ public ConfigKey<?>[] getConfigKeys() {
93949394
VmIpFetchThreadPoolMax, VmIpFetchTaskWorkers, AllowDeployVmIfGivenHostFails, EnableAdditionalVmConfig, DisplayVMOVFProperties,
93959395
KvmAdditionalConfigAllowList, XenServerAdditionalConfigAllowList, VmwareAdditionalConfigAllowList, DestroyRootVolumeOnVmDestruction,
93969396
EnforceStrictResourceLimitHostTagCheck, StrictHostTags, AllowUserForceStopVm, VmDistinctHostNameScope,
9397-
VmwareAdditionalDetailsFromOvaEnabled, VmwareAllowedAdditionalDetailsFromOva};
9397+
VmwareAdditionalDetailsFromOvaEnabled, VmwareAllowedAdditionalDetailsFromOva, AllowDifferentHostTagsOfferingsForVmScale};
93989398
}
93999399

94009400
@Override

0 commit comments

Comments
 (0)