GabrielBrascher commented on a change in pull request #3600: Allow deploy
Admin/System VMs in disabled zones/pods/clusters
URL: https://github.com/apache/cloudstack/pull/3600#discussion_r345780512
##########
File path:
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java
##########
@@ -548,6 +547,78 @@ public DeployDestination
planDeployment(VirtualMachineProfile vmProfile, Deploym
return dest;
}
+ /**
+ * Adds disabled resources (Data centers, Pods, Clusters, and hosts) to
exclude list (avoid) in case of disabled state.
+ */
+ public void avoidDisabledResources(VirtualMachineProfile vmProfile,
DataCenter dc, ExcludeList avoids) {
+ if (vmProfile.getType().isUsedBySystem() &&
isSystemVmDeployableInDisabledResources()) {
+ return;
+ }
+
+ VMInstanceVO vm = _vmInstanceDao.findById(vmProfile.getId());
+ AccountVO owner = accountDao.findById(vm.getAccountId());
+ if (owner.getRoleId() == ADMIN_ACCOUNT_ROLE_ID &&
isAdminVmDeployableInDisabledResources()) {
+ return;
+ }
+
+ avoidDisabledDataCenters(dc, avoids);
+ avoidDisabledPods(dc, avoids);
+ avoidDisabledClusters(dc, avoids);
+ avoidDisabledHosts(dc, avoids);
+ }
+
+ /**
+ * Returns the value of the ConfigKey 'allow.system.vm.disabled.resource'.
This method allows mocking and testing with the respective ConfigKey parameter.
+ */
+ protected boolean isSystemVmDeployableInDisabledResources() {
+ return allowSytemVmOnDisabledResource.value();
+ }
+
+ /**
+ * Returns the value of the ConfigKey 'allow.admin.vm.disabled.resources'.
This method allows mocking and testing with the respective ConfigKey parameter.
Review comment:
@andrijapanicsb updated both Javadoc blocks :+1:
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services