mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-3358: create template from a volume/snapshot should also take input from User/Admin whether xstools / vmware tools installed in the VM
Signed off by : Nitin Mehta<nitin.mehta@citrix.com>
This commit is contained in:
parent
5af61a85ae
commit
03fac83180
@ -102,6 +102,9 @@ import java.util.Map;
|
||||
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.")
|
||||
protected Map details;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
|
||||
protected Boolean isDynamicallyScalable;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
@ -169,6 +172,10 @@ import java.util.Map;
|
||||
return params;
|
||||
}
|
||||
|
||||
public boolean isDynamicallyScalable() {
|
||||
return isDynamicallyScalable == null ? false : isDynamicallyScalable;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -120,7 +120,7 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
|
||||
details.putAll(detailsInVm);
|
||||
}
|
||||
if (details.get(VirtualMachine.IsDynamicScalingEnabled) == null || details.get(VirtualMachine.IsDynamicScalingEnabled).isEmpty()) {
|
||||
to. setEnableDynamicallyScaleVm(false);
|
||||
to.setEnableDynamicallyScaleVm(false);
|
||||
} else {
|
||||
// check if XStools/VMWare tools are present in the VM and dynamic scaling feature is enabled (per zone/global)
|
||||
to.setEnableDynamicallyScaleVm(details.get(VirtualMachine.IsDynamicScalingEnabled).equals("true") && Boolean.parseBoolean(_configServer.getConfigValue(Config.EnableDynamicallyScaleVm.key(), Config.ConfigurationParameterScope.zone.toString(), vm.getDataCenterId())));
|
||||
|
||||
@ -1457,6 +1457,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
||||
if (isPublic == null) {
|
||||
isPublic = Boolean.FALSE;
|
||||
}
|
||||
boolean isDynamicScalingEnabled = cmd.isDynamicallyScalable();
|
||||
// check whether template owner can create public templates
|
||||
boolean allowPublicUserTemplates = Boolean.parseBoolean(_configServer.getConfigValue(Config.AllowPublicUserTemplates.key(),
|
||||
Config.ConfigurationParameterScope.account.toString(), templateOwner.getId()));
|
||||
@ -1497,6 +1498,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
||||
}
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
|
||||
hyperType = this._volumeDao.getHypervisorType(volumeId);
|
||||
} else { // create template from snapshot
|
||||
snapshot = _snapshotDao.findById(snapshotId);
|
||||
@ -1568,6 +1570,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
||||
privateTemplate = new VMTemplateVO(nextTemplateId, uniqueName, name, ImageFormat.RAW, isPublic, featured, isExtractable, TemplateType.USER,
|
||||
null, null, requiresHvmValue, bitsValue, templateOwner.getId(), null, description, passwordEnabledValue, guestOS.getId(), true,
|
||||
hyperType, templateTag, cmd.getDetails());
|
||||
privateTemplate.setDynamicallyScalable(isDynamicScalingEnabled);
|
||||
|
||||
if (sourceTemplateId != null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("This template is getting created from other template, setting source template Id to: " + sourceTemplateId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user