mirror of https://github.com/apache/cloudstack.git
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
c03296808b
commit
12c711cef7
|
|
@ -100,6 +100,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 ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
|
@ -167,6 +170,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())));
|
||||
|
|
|
|||
|
|
@ -1460,6 +1460,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()));
|
||||
|
|
@ -1500,6 +1501,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);
|
||||
|
|
@ -1571,6 +1573,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…
Reference in New Issue