Omer Frenkel has uploaded a new change for review. Change subject: core: add custom properties to templates ......................................................................
core: add custom properties to templates currently custom properties are vm only feature, so adding also to templates. Change-Id: I85f8fb998b5e081c10d93e5790963fb7b8bdf5fd Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1011735 Signed-off-by: Omer Frenkel <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/customprop/VmPropertiesUtils.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmBaseDaoDbFacade.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java M packaging/dbscripts/create_views.sql M packaging/dbscripts/vm_templates_sp.sql 12 files changed, 152 insertions(+), 81 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/35117/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java index 6b57859..72265f7 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java @@ -61,6 +61,7 @@ import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils; import org.ovirt.engine.core.common.validation.group.CreateEntity; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.backendcompat.CommandExecutionStatus; @@ -117,6 +118,13 @@ parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); + + if (getVdsGroup() != null) { + // Parses the custom properties field that was filled by frontend to + // predefined and user defined fields + VmPropertiesUtils.getInstance().separateCustomPropertiesToUserAndPredefined( + getVdsGroup().getcompatibility_version(), parameterMasterVm); + } } if (getVm() != null) { updateVmDevices(); @@ -361,6 +369,13 @@ // Disallow cross-DC template creation if (!getStoragePoolId().equals(getVdsGroup().getStoragePoolId())) { addCanDoActionMessage(VdcBllMessages.VDS_CLUSTER_ON_DIFFERENT_STORAGE_POOL); + return false; + } + + if (!VmPropertiesUtils.getInstance().validateVmProperties( + getVdsGroup().getcompatibility_version(), + getParameters().getMasterVm().getCustomProperties(), + getReturnValue().getCanDoActionMessages())) { return false; } @@ -609,7 +624,10 @@ getParameters().getMasterVm().isSpiceFileTransferEnabled(), getParameters().getMasterVm().isSpiceCopyPasteEnabled(), getParameters().getMasterVm().getCpuProfileId(), - getParameters().getMasterVm().getNumaTuneMode())); + getParameters().getMasterVm().getNumaTuneMode(), + getParameters().getMasterVm().getUserDefinedProperties(), + getParameters().getMasterVm().getPredefinedProperties(), + getParameters().getMasterVm().getCustomProperties())); DbFacade.getInstance().getVmTemplateDao().save(getVmTemplate()); getCompensationContext().snapshotNewEntity(getVmTemplate()); setActionReturnValue(getVmTemplate().getId()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java index b20dc30..13be50e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java @@ -29,6 +29,7 @@ import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils; import org.ovirt.engine.core.common.validation.group.UpdateEntity; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; @@ -45,8 +46,15 @@ setVmTemplateId(getVmTemplate().getId()); setVdsGroupId(getVmTemplate().getVdsGroupId()); if (getVdsGroup() != null) { + mOldTemplate = DbFacade.getInstance().getVmTemplateDao().get(getVmTemplate().getId()); setStoragePoolId(getVdsGroup().getStoragePoolId() != null ? getVdsGroup().getStoragePoolId() : Guid.Empty); + getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(getVdsGroup().getcompatibility_version(), + parameters.getVmTemplateData()); + if (mOldTemplate != null) { + getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(getVdsGroup().getcompatibility_version(), + mOldTemplate); + } } VmHandler.updateDefaultTimeZone(parameters.getVmTemplateData()); } @@ -63,7 +71,7 @@ return failCanDoAction(VdcBllMessages.VMT_CANNOT_EDIT_BLANK_TEMPLATE); } boolean returnValue = false; - mOldTemplate = DbFacade.getInstance().getVmTemplateDao().get(getVmTemplate().getId()); + if (mOldTemplate == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } @@ -167,6 +175,13 @@ if (getParameters().getVmTemplateData().getMinAllocatedMem() > getParameters().getVmTemplateData().getMemSizeMb()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MIN_MEMORY_CANNOT_EXCEED_MEMORY_SIZE); + } + + if (!VmPropertiesUtils.getInstance().validateVmProperties( + getVdsGroup().getcompatibility_version(), + getParameters().getVmTemplateData().getCustomProperties(), + getReturnValue().getCanDoActionMessages())) { + return false; } return returnValue; @@ -351,4 +366,8 @@ getVdsGroup().getcompatibility_version())); } + private VmPropertiesUtils getVmPropertiesUtils() { + return VmPropertiesUtils.getInstance(); + } + } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateCommand.java index f964b29..aaa512b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateCommand.java @@ -278,5 +278,4 @@ } } } - } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java index d5be8a3..4a75a0d 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java @@ -227,6 +227,22 @@ @EditableField private List<VmNumaNode> vNumaNodeList; + @EditableOnVmStatusField + @EditableOnTemplate + @OvfExportOnlyField(exportOption = ExportOption.EXPORT_NON_IGNORED_VALUES) + @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) + private String userDefinedProperties; + + @EditableOnVmStatusField + @EditableOnTemplate + @OvfExportOnlyField(exportOption = ExportOption.EXPORT_NON_IGNORED_VALUES) + @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) + private String predefinedProperties; + + @EditableOnVmStatusField + @EditableOnTemplate + private String customProperties; + public VmBase() { name = ""; interfaces = new ArrayList<VmNetworkInterface>(); @@ -249,6 +265,7 @@ spiceCopyPasteEnabled = true; setNumaTuneMode(NumaTuneMode.INTERLEAVE); vNumaNodeList = new ArrayList<VmNumaNode>(); + customProperties = ""; } @EditableField @@ -389,7 +406,10 @@ vmBase.isSpiceFileTransferEnabled(), vmBase.isSpiceCopyPasteEnabled(), vmBase.getCpuProfileId(), - vmBase.getNumaTuneMode()); + vmBase.getNumaTuneMode(), + vmBase.getUserDefinedProperties(), + vmBase.getPredefinedProperties(), + vmBase.getCustomProperties()); } public VmBase( @@ -441,7 +461,10 @@ boolean spiceFileTransferEnabled, boolean spiceCopyPasteEnabled, Guid cpuProfileId, - NumaTuneMode numaTuneMode) { + NumaTuneMode numaTuneMode, + String userDefinedProperties, + String predefinedProperties, + String customProperties) { this(); this.name = name; this.id = id; @@ -492,6 +515,9 @@ this.numaTuneMode = numaTuneMode; this.spiceCopyPasteEnabled = spiceCopyPasteEnabled; this.cpuProfileId = cpuProfileId; + this.userDefinedProperties = userDefinedProperties; + this.predefinedProperties = predefinedProperties; + this.customProperties = customProperties; } public long getDbGeneration() { @@ -835,6 +861,8 @@ result = prime * result + ((cpuProfileId == null) ? 0 : cpuProfileId.hashCode()); result = prime * result + ((numaTuneMode == null) ? 0 : numaTuneMode.getValue().hashCode()); result = prime * result + ((vNumaNodeList == null) ? 0 : vNumaNodeList.hashCode()); + result = prime * result + ((predefinedProperties == null) ? 0 : predefinedProperties.hashCode()); + result = prime * result + ((userDefinedProperties == null) ? 0 : userDefinedProperties.hashCode()); return result; } @@ -892,7 +920,9 @@ && spiceCopyPasteEnabled == other.spiceCopyPasteEnabled && ObjectUtils.objectsEqual(cpuProfileId, other.cpuProfileId) && ObjectUtils.objectsEqual(numaTuneMode.getValue(), other.numaTuneMode.getValue()) - && ObjectUtils.objectsEqual(vNumaNodeList, other.vNumaNodeList)); + && ObjectUtils.objectsEqual(vNumaNodeList, other.vNumaNodeList)) + && ObjectUtils.objectsEqual(predefinedProperties, other.predefinedProperties) + && ObjectUtils.objectsEqual(userDefinedProperties, other.userDefinedProperties); } public Guid getQuotaId() { @@ -1088,4 +1118,28 @@ this.vNumaNodeList = vNumaNodeList; } + public String getCustomProperties() { + return customProperties; + } + + public void setCustomProperties(String customProperties) { + this.customProperties = customProperties; + } + + public String getPredefinedProperties() { + return predefinedProperties; + } + + public void setPredefinedProperties(String predefinedProperties) { + this.predefinedProperties = predefinedProperties; + } + + public String getUserDefinedProperties() { + return userDefinedProperties; + } + + public void setUserDefinedProperties(String userDefinedProperties) { + this.userDefinedProperties = userDefinedProperties; + } + } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java index cbb9262..09ae5cc 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java @@ -22,19 +22,6 @@ private Guid originalTemplateGuid; - @EditableOnVmStatusField - @OvfExportOnlyField(exportOption = ExportOption.EXPORT_NON_IGNORED_VALUES) - @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) - private String userDefinedProperties; - - @EditableOnVmStatusField - @OvfExportOnlyField(exportOption = ExportOption.EXPORT_NON_IGNORED_VALUES) - @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) - private String predefinedProperties; - - @EditableOnVmStatusField - private String customProperties; - @EditableField @OvfExportOnlyField(exportOption = ExportOption.EXPORT_NON_IGNORED_VALUES) @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) @@ -59,13 +46,11 @@ setDefaultDisplayType(DisplayType.qxl); setVmType(VmType.Desktop); vmtGuid = Guid.Empty; - customProperties = ""; } public VmStatic(VmStatic vmStatic) { this((VmBase)vmStatic); vmtGuid = vmStatic.getVmtGuid(); - setCustomProperties(vmStatic.getCustomProperties()); setInitialized(vmStatic.isInitialized()); setUseLatestVersion(vmStatic.isUseLatestVersion()); setInstanceTypeId(vmStatic.getInstanceTypeId()); @@ -73,30 +58,6 @@ public VmStatic(VmBase vmBase) { super(vmBase); - } - - public String getCustomProperties() { - return customProperties; - } - - public void setCustomProperties(String customProperties) { - this.customProperties = customProperties; - } - - public String getPredefinedProperties() { - return predefinedProperties; - } - - public void setPredefinedProperties(String predefinedProperties) { - this.predefinedProperties = predefinedProperties; - } - - public String getUserDefinedProperties() { - return userDefinedProperties; - } - - public void setUserDefinedProperties(String userDefinedProperties) { - this.userDefinedProperties = userDefinedProperties; } public boolean isFirstRun() { @@ -146,8 +107,6 @@ int result = super.hashCode(); result = prime * result + (initialized ? 1231 : 1237); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); - result = prime * result + ((predefinedProperties == null) ? 0 : predefinedProperties.hashCode()); - result = prime * result + ((userDefinedProperties == null) ? 0 : userDefinedProperties.hashCode()); result = prime * result + ((vmtGuid == null) ? 0 : vmtGuid.hashCode()); result = prime * result + (useHostCpuFlags ? 1231 : 1237); result = prime * result + ((instanceTypeId == null) ? 0 : instanceTypeId.hashCode()); @@ -173,8 +132,6 @@ VmStatic other = (VmStatic) obj; return (initialized == other.initialized && ObjectUtils.objectsEqual(getName(), other.getName()) - && ObjectUtils.objectsEqual(predefinedProperties, other.predefinedProperties) - && ObjectUtils.objectsEqual(userDefinedProperties, other.userDefinedProperties) && ObjectUtils.objectsEqual(vmtGuid, other.vmtGuid) && useHostCpuFlags == other.useHostCpuFlags && ObjectUtils.objectsEqual(instanceTypeId, other.instanceTypeId) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java index c1ff012..4c13222 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java @@ -78,7 +78,10 @@ Guid baseTemplateId, String templateVersionName, SerialNumberPolicy serialNumberPolicy, String customSerialNumber, boolean bootMenuEnabled, boolean spiceFIleTransferEnabled, boolean spiceCopyPasteEnabled, - Guid cpuProfileId, NumaTuneMode numaTuneMode) { + Guid cpuProfileId, NumaTuneMode numaTuneMode, + String userDefinedProperties, + String predefinedProperties, + String customProperties) { super(name, vmtGuid, vdsGroupId, @@ -127,7 +130,10 @@ spiceFIleTransferEnabled, spiceCopyPasteEnabled, cpuProfileId, - numaTuneMode); + numaTuneMode, + userDefinedProperties, + predefinedProperties, + customProperties); diskTemplateMap = new HashMap<Guid, DiskImage>(); diskImageMap = new HashMap<Guid, DiskImage>(); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/customprop/VmPropertiesUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/customprop/VmPropertiesUtils.java index 4c1ad82..743668b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/customprop/VmPropertiesUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/customprop/VmPropertiesUtils.java @@ -6,7 +6,7 @@ import java.util.Map.Entry; import java.util.Set; -import org.ovirt.engine.core.common.businessentities.VmStatic; +import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.utils.exceptions.InitializationException; @@ -115,11 +115,11 @@ * * @return map containing the VM custom properties */ - public Map<String, String> getVMProperties(Version version, VmStatic vmStatic) { - separateCustomPropertiesToUserAndPredefined(version, vmStatic); + public Map<String, String> getVMProperties(Version version, VmBase vmBase) { + separateCustomPropertiesToUserAndPredefined(version, vmBase); Map<String, String> map = new HashMap<String, String>(); - getPredefinedProperties(version, vmStatic, map); - getUserDefinedProperties(version, vmStatic, map); + getPredefinedProperties(version, vmBase, map); + getUserDefinedProperties(version, vmBase, map); return map; } @@ -128,13 +128,13 @@ return allVmProperties; } - private void getPredefinedProperties(Version version, VmStatic vmStatic, Map<String, String> propertiesMap) { - String predefinedProperties = vmStatic.getPredefinedProperties(); + private void getPredefinedProperties(Version version, VmBase vmBase, Map<String, String> propertiesMap) { + String predefinedProperties = vmBase.getPredefinedProperties(); getVMProperties(version, propertiesMap, predefinedProperties); } - private void getUserDefinedProperties(Version version, VmStatic vmStatic, Map<String, String> propertiesMap) { - String UserDefinedProperties = vmStatic.getUserDefinedProperties(); + private void getUserDefinedProperties(Version version, VmBase vmBase, Map<String, String> propertiesMap) { + String UserDefinedProperties = vmBase.getUserDefinedProperties(); getVMProperties(version, propertiesMap, UserDefinedProperties); } @@ -200,11 +200,11 @@ return result.toString(); } - public void separateCustomPropertiesToUserAndPredefined(Version version, VmStatic vmStatic) { - String customProperties = vmStatic.getCustomProperties(); + public void separateCustomPropertiesToUserAndPredefined(Version version, VmBase vmBase) { + String customProperties = vmBase.getCustomProperties(); VMCustomProperties properties = parseProperties(version, customProperties); - vmStatic.setPredefinedProperties(properties.getPredefinedProperties()); - vmStatic.setUserDefinedProperties(properties.getUseDefinedProperties()); + vmBase.setPredefinedProperties(properties.getPredefinedProperties()); + vmBase.setUserDefinedProperties(properties.getUseDefinedProperties()); } /** diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmBaseDaoDbFacade.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmBaseDaoDbFacade.java index 5538ccd..51930e6 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmBaseDaoDbFacade.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmBaseDaoDbFacade.java @@ -13,6 +13,7 @@ import org.ovirt.engine.core.common.businessentities.UsbPolicy; import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.VmType; +import org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils; import org.springframework.jdbc.core.RowMapper; @@ -70,7 +71,9 @@ .addValue("is_spice_file_transfer_enabled", entity.isSpiceFileTransferEnabled()) .addValue("is_spice_copy_paste_enabled", entity.isSpiceCopyPasteEnabled()) .addValue("cpu_profile_id", entity.getCpuProfileId()) - .addValue("numatune_mode", entity.getNumaTuneMode().getValue()); + .addValue("numatune_mode", entity.getNumaTuneMode().getValue()) + .addValue("predefined_properties", entity.getPredefinedProperties()) + .addValue("userdefined_properties", entity.getUserDefinedProperties()); } /** @@ -126,6 +129,12 @@ entity.setQuotaId(getGuid(rs, "quota_id")); entity.setCpuProfileId(getGuid(rs, "cpu_profile_id")); entity.setNumaTuneMode(NumaTuneMode.forValue(rs.getString("numatune_mode"))); + String predefinedProperties = rs.getString("predefined_properties"); + String userDefinedProperties = rs.getString("userdefined_properties"); + entity.setPredefinedProperties(predefinedProperties); + entity.setUserDefinedProperties(userDefinedProperties); + entity.setCustomProperties(VmPropertiesUtils.getInstance().customProperties(predefinedProperties, + userDefinedProperties)); } } } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java index 375217b..8939249 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java @@ -7,7 +7,6 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.common.businessentities.VmStatic; -import org.ovirt.engine.core.common.utils.customprop.VmPropertiesUtils; import org.ovirt.engine.core.compat.Guid; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; @@ -32,9 +31,6 @@ .addValue("vm_name", vm.getName()) .addValue("vmt_guid", vm.getVmtGuid()) .addValue("is_initialized", vm.isInitialized()) - .addValue("predefined_properties", vm.getPredefinedProperties()) - .addValue("userdefined_properties", - vm.getUserDefinedProperties()) .addValue("cpu_pinning", vm.getCpuPinning()) .addValue("host_cpu_flags", vm.isUseHostCpuFlags()) .addValue("instance_type_id", vm.getInstanceTypeId()) @@ -172,12 +168,6 @@ entity.setName(rs.getString("vm_name")); entity.setVmtGuid(getGuidDefaultEmpty(rs, "vmt_guid")); entity.setInitialized(rs.getBoolean("is_initialized")); - String predefinedProperties = rs.getString("predefined_properties"); - String userDefinedProperties = rs.getString("userdefined_properties"); - entity.setPredefinedProperties(predefinedProperties); - entity.setUserDefinedProperties(userDefinedProperties); - entity.setCustomProperties(VmPropertiesUtils.getInstance().customProperties(predefinedProperties, - userDefinedProperties)); entity.setCpuPinning(rs.getString("cpu_pinning")); entity.setUseHostCpuFlags(rs.getBoolean("host_cpu_flags")); entity.setInstanceTypeId(Guid.createGuidFromString(rs.getString("instance_type_id"))); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java index ee90581..314a567 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java @@ -222,6 +222,9 @@ vm.setSpiceFileTransferEnabled(instance.isSpiceFileTransferEnabled()); vm.setSpiceCopyPasteEnabled(instance.isSpiceCopyPasteEnabled()); vm.setCpuProfileId(instance.getCpuProfileId()); + vm.setPredefinedProperties(instance.getPredefinedProperties()); + vm.setUserDefinedProperties(instance.getUserDefinedProperties()); + vm.setCustomProperties(instance.getCustomProperties()); return vm; } @@ -447,6 +450,9 @@ obj.setSpiceFileTransferEnabled(instance.isSpiceFileTransferEnabled()); obj.setSpiceCopyPasteEnabled(instance.isSpiceCopyPasteEnabled()); obj.setCpuProfileId(instance.getCpuProfileId()); + obj.setPredefinedProperties(instance.getPredefinedProperties()); + obj.setUserDefinedProperties(instance.getUserDefinedProperties()); + obj.setCustomProperties(instance.getCustomProperties()); return obj; } @@ -489,6 +495,9 @@ obj.setSpiceFileTransferEnabled(instance.isSpiceFileTransferEnabled()); obj.setSpiceCopyPasteEnabled(instance.isSpiceCopyPasteEnabled()); obj.setCpuProfileId(instance.getCpuProfileId()); + obj.setPredefinedProperties(instance.getPredefinedProperties()); + obj.setUserDefinedProperties(instance.getUserDefinedProperties()); + obj.setCustomProperties(instance.getCustomProperties()); return obj; } diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index 6f65f55..a48bc22 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -460,7 +460,9 @@ vm_templates.is_spice_file_transfer_enabled as is_spice_file_transfer_enabled, vm_templates.is_spice_copy_paste_enabled as is_spice_copy_paste_enabled, vm_templates.cpu_profile_id as cpu_profile_id, - vm_templates.numatune_mode as numatune_mode + vm_templates.numatune_mode as numatune_mode, + vm_templates.predefined_properties as predefined_properties, + vm_templates.userdefined_properties as userdefined_properties FROM vm_static AS vm_templates LEFT OUTER JOIN vds_groups ON vm_templates.vds_group_id = vds_groups.vds_group_id left outer JOIN diff --git a/packaging/dbscripts/vm_templates_sp.sql b/packaging/dbscripts/vm_templates_sp.sql index ff34b18..9e45ed1 100644 --- a/packaging/dbscripts/vm_templates_sp.sql +++ b/packaging/dbscripts/vm_templates_sp.sql @@ -60,7 +60,9 @@ v_is_spice_file_transfer_enabled BOOLEAN, v_is_spice_copy_paste_enabled BOOLEAN, v_cpu_profile_id UUID, - v_numatune_mode VARCHAR(20)) + v_numatune_mode VARCHAR(20), + v_predefined_properties VARCHAR(4000), + v_userdefined_properties VARCHAR(4000)) RETURNS VOID AS $procedure$ @@ -134,7 +136,9 @@ is_spice_file_transfer_enabled, is_spice_copy_paste_enabled, cpu_profile_id, - numatune_mode) + numatune_mode, + predefined_properties, + userdefined_properties) VALUES( v_child_count, v_creation_date, @@ -190,7 +194,9 @@ v_is_spice_file_transfer_enabled, v_is_spice_copy_paste_enabled, v_cpu_profile_id, - v_numatune_mode); + v_numatune_mode, + v_predefined_properties, + v_userdefined_properties); -- perform deletion from vm_ovf_generations to ensure that no record exists when performing insert to avoid PK violation. DELETE FROM vm_ovf_generations gen WHERE gen.vm_guid = v_vmt_guid; INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) @@ -256,7 +262,9 @@ v_is_spice_file_transfer_enabled BOOLEAN, v_is_spice_copy_paste_enabled BOOLEAN, v_cpu_profile_id UUID, - v_numatune_mode VARCHAR(20)) + v_numatune_mode VARCHAR(20), + v_predefined_properties VARCHAR(4000), +v_userdefined_properties VARCHAR(4000)) RETURNS VOID --The [vm_templates] table doesn't have a timestamp column. Optimistic concurrency logic cannot be generated @@ -285,7 +293,7 @@ serial_number_policy = v_serial_number_policy, custom_serial_number = v_custom_serial_number, is_boot_menu_enabled = v_is_boot_menu_enabled, is_spice_file_transfer_enabled = v_is_spice_file_transfer_enabled, is_spice_copy_paste_enabled = v_is_spice_copy_paste_enabled, cpu_profile_id = v_cpu_profile_id, - numatune_mode = v_numatune_mode + numatune_mode = v_numatune_mode, predefined_properties = v_predefined_properties,userdefined_properties = v_userdefined_properties WHERE vm_guid = v_vmt_guid AND entity_type = v_template_type; -- To view, visit http://gerrit.ovirt.org/35117 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I85f8fb998b5e081c10d93e5790963fb7b8bdf5fd Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Omer Frenkel <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
