Omer Frenkel has uploaded a new change for review. Change subject: core: support adding template version ......................................................................
core: support adding template version This patch add the ability to specify on add template, that this will be version of a template. http://www.ovirt.org/index.php?title=Features/Template_Versions Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1037478 Change-Id: Id256ade6e3973d5ad00daa267f80e5ce42b87872 Signed-off-by: Omer Frenkel <ofren...@redhat.com> --- 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/RemoveVmTemplateCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAO.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDAOTest.java M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M packaging/dbscripts/vm_templates_sp.sql 12 files changed, 122 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/23608/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 dbc4c45..6501804 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 @@ -52,6 +52,8 @@ import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.errors.VdcBllErrors; 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.validation.group.CreateEntity; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; @@ -64,6 +66,7 @@ @DisableInPrepareMode @NonTransactiveCommandAttribute(forceCompensation = true) +@LockIdNameAttribute public class AddVmTemplateCommand<T extends AddVmTemplateParameters> extends VmTemplateCommand<T> implements QuotaStorageDependent, QuotaVdsDependent { @@ -72,6 +75,8 @@ protected Map<Guid, DiskImage> diskInfoDestinationMap; protected Map<Guid, List<DiskImage>> sourceImageDomainsImageMap; private boolean isVmInDb; + + private static final String BASE_TEMPLATE_VERSION_NAME = "base version"; /** * Constructor for command creation when compensation is applied on startup @@ -192,6 +197,14 @@ setVmTemplateId(Guid.newGuid()); getParameters().setVmTemplateId(getVmTemplateId()); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); + + // set template id as base for new templates + if (getParameters().getBaseTemplateId() == null) { + getParameters().setBaseTemplateId(getVmTemplateId()); + if (StringUtils.isEmpty(getParameters().getTemplateVersionName())) { + getParameters().setTemplateVersionName(BASE_TEMPLATE_VERSION_NAME); + } + } final Map<Guid, Guid> srcDeviceIdToTargetDeviceIdMapping = new HashMap<>(); @@ -318,6 +331,17 @@ getParameters().getWatchdog(), getVdsGroup().getcompatibility_version())).isModelCompatibleWithOs())) { return false; + } + } + + if (getParameters().getBaseTemplateId() != null) { + VmTemplate userSelectedBaseTemplate = getVmTemplateDAO().get(getParameters().getBaseTemplateId()); + if (userSelectedBaseTemplate == null) { + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); + } else if (!userSelectedBaseTemplate.isBaseTemplate()) { + // currently template version cannot be base template + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_VERSION_CANNOT_BE_BASE_TEMPLATE); + } } @@ -464,7 +488,7 @@ getParameters().getMasterVm().isAllowConsoleReconnect(), getParameters().getMasterVm().getIsoPath(), getParameters().getMasterVm().getMigrationDowntime(), - getVmTemplateId(), + getParameters().getBaseTemplateId(), getParameters().getTemplateVersionName())); DbFacade.getInstance().getVmTemplateDao().save(getVmTemplate()); getCompensationContext().snapshotNewEntity(getVmTemplate()); @@ -696,4 +720,13 @@ list.add(new QuotaSanityParameter(getQuotaId(), null)); return list; } + + @Override + protected Map<String, Pair<String, String>> getSharedLocks() { + if (getParameters().getBaseTemplateId() != null) { + return Collections.singletonMap(getParameters().getBaseTemplateId().toString(), + LockMessagesMatchUtil.makeLockingPair(LockingGroup.TEMPLATE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); + } + return super.getSharedLocks(); + } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java index 64e18d3..4c71bfe 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java @@ -153,6 +153,20 @@ return false; } + // for base templates, make sure it has no versions that need to be removed first + if (vmTemplateId.equals(template.getBaseTemplateId())) { + List<VmTemplate> templateVersions = getVmTemplateDAO().getTemplateVersionsForBaseTemplate(vmTemplateId); + if (!templateVersions.isEmpty()) { + List<String> templateVersionsNames = new ArrayList<>(); + for (VmTemplate version : templateVersions) { + templateVersionsNames.add(version.getName()); + } + + addCanDoActionMessage(VdcBllMessages.VMT_CANNOT_REMOVE_BASE_WITH_VERSIONS); + addCanDoActionMessage(String.format("$versionsList %1$s", StringUtils.join(templateVersionsNames, ","))); + return false; + } + } return true; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java index b0cef67..fec9f1c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java @@ -53,6 +53,8 @@ private String templateVersionName; + private Guid baseTemplateId; + public AddVmTemplateParameters(VmStatic masterVm, String name, String description) { this(); _masterVm = masterVm; @@ -170,4 +172,12 @@ public void setTemplateVersionName(String templateVersionName) { this.templateVersionName = templateVersionName; } + + public Guid getBaseTemplateId() { + return baseTemplateId; + } + + public void setBaseTemplateId(Guid baseTemplateId) { + this.baseTemplateId = baseTemplateId; + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index e41b219..29a19bd 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -208,6 +208,7 @@ ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE(ErrorType.CONFLICT), ACTION_TYPE_FAILED_CPU_NOT_FOUND(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST(ErrorType.BAD_PARAMETERS), + ACTION_TYPE_FAILED_TEMPLATE_VERSION_CANNOT_BE_BASE_TEMPLATE(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED(ErrorType.CONFLICT), @@ -367,6 +368,7 @@ // internal const string VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM = // "Cannot delete the template, there are desktop(s) created from template"; VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM(ErrorType.CONFLICT), + VMT_CANNOT_REMOVE_BASE_WITH_VERSIONS(ErrorType.CONFLICT), VMT_CANNOT_CREATE_TEMPLATE_FROM_DOWN_VM(ErrorType.CONFLICT), VMT_CANNOT_REMOVE_BLANK_TEMPLATE(ErrorType.CONFLICT), VMT_CANNOT_EDIT_BLANK_TEMPLATE(ErrorType.CONFLICT), diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAO.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAO.java index cb1c5f1..9df4e3a 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAO.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAO.java @@ -154,4 +154,14 @@ ImageType getImageType(Guid id); int getCount(); + + /** + * Retrieve the list of template versions for a base template + * + * @param id + * the base template id to get versions for + * @return + * list of template versions for this base template + */ + List<VmTemplate> getTemplateVersionsForBaseTemplate(Guid id); } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java index c2b037d..f4dcf66 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java @@ -247,6 +247,14 @@ .addValue("vnic_profile_id", vnicProfileId)); } + @Override + public List<VmTemplate> getTemplateVersionsForBaseTemplate(Guid id) { + return getCallsHandler().executeReadList("GetTemplateVersionsForBaseTemplate", + VMTemplateRowMapper.instance, + getCustomMapSqlParameterSource() + .addValue("base_template_id", id)); + } + private final static class VMTemplateRowMapper extends AbstractVmRowMapper<VmTemplate> { public static final VMTemplateRowMapper instance = new VMTemplateRowMapper(); diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index 66f2a59..8f61a9b 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -10,6 +10,7 @@ IRS_RESPONSE_ERROR=Storage Manager response error. MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES=Not enough MAC addresses left in MAC Address Pool. VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM=Cannot delete Template. Template is being used by the following VMs: ${vmsList}. +VMT_CANNOT_REMOVE_BASE_WITH_VERSIONS=Cannot delete Base Template that has Template Versions, please first remove all Template Versions for this Template: ${versionsList}. VMT_CANNOT_REMOVE_DOMAINS_LIST_MISMATCH=Cannot delete Template. The Template does not exist on the following Storage Domains: ${domainsList}.\nEither verify that Template exists on all Storage Domains listed on the domains list,\nor do not send domains list in order to delete all instances of the Template from the system. ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST=Cannot ${action} ${type}. VM's Image does not exist. ACTION_TYPE_FAILED_VM_SNAPSHOT_DOES_NOT_EXIST=Cannot ${action} ${type}. VM's Snapshot does not exist. @@ -217,6 +218,7 @@ ACTION_TYPE_FAILED_PROBLEM_WITH_CANDIDATE_INFO=Cannot ${action} ${type}. Failed to get data for Import operation.\n\ - Check your Import Domain. ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Template doesn't exist. +ACTION_TYPE_FAILED_TEMPLATE_VERSION_CANNOT_BE_BASE_TEMPLATE=Cannot ${action} ${type}. Only the first template version can be selected as the base template. ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Instance Type doesn't exist. ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Image Type doesn't exist. ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED=Cannot ${action} ${type}. The Template is disabled, please try to enable the template first and try again. diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDAOTest.java index f80ef2a..48bb1a6 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDAOTest.java @@ -356,4 +356,14 @@ public void testCountTemplates() { assertEquals(NUMBER_OF_TEMPLATES_IN_DB, dao.getCount()); } + + /** + * Assert that all versions (VM_TEMPLATE_RHEL5_V2) returns for base template (VM_TEMPLATE_RHEL5) + */ + @Test + public void testGetTemplateVersionsForBaseTemplate() { + List<VmTemplate> tVersions = dao.getTemplateVersionsForBaseTemplate(FixturesTool.VM_TEMPLATE_RHEL5); + assertEquals(1, tVersions.size()); + assertEquals(FixturesTool.VM_TEMPLATE_RHEL5_V2, tVersions.get(0).getId()); + } } diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index 18b876b..1d1dd17 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -40,6 +40,9 @@ @DefaultStringValue("Cannot delete Template. Template is being used by the following VMs: ${vmsList}.") String VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM(); + @DefaultStringValue("Cannot delete Base Template that has Template Versions, please first remove all Template Versions for this Template: ${versionsList}.") + String VMT_CANNOT_REMOVE_BASE_WITH_VERSIONS(); + @DefaultStringValue("Cannot delete Template. The Template does not exist on the following Storage Domains: ${domainsList}.\nEither verify that Template exists on all Storage Domains listed on the domains list,\nor do not send domains list in order to delete all instances of the Template from the system.") String VMT_CANNOT_REMOVE_DOMAINS_LIST_MISMATCH(); @@ -580,6 +583,9 @@ @DefaultStringValue("Cannot ${action} ${type}. The relevant Template doesn't exist.") String ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST(); + @DefaultStringValue("Cannot ${action} ${type}. Only the first template version can be selected as the base template.") + String ACTION_TYPE_FAILED_TEMPLATE_VERSION_CANNOT_BE_BASE_TEMPLATE(); + @DefaultStringValue("Cannot ${action} ${type}. The relevant Instance Type doesn't exist.") String ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 60cf008..569b5fb 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -10,6 +10,7 @@ IRS_RESPONSE_ERROR=Storage Manager response error. MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES=Not enough MAC addresses left in MAC Address Pool. VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM=Cannot delete Template. Template is being used by the following VMs: ${vmsList}. +VMT_CANNOT_REMOVE_BASE_WITH_VERSIONS=Cannot delete Base Template that has Template Versions, please first remove all Template Versions for this Template: ${versionsList}. VMT_CANNOT_REMOVE_DOMAINS_LIST_MISMATCH=Cannot delete Template. The Template does not exist on the following Storage Domains: ${domainsList}.\nEither verify that Template exists on all Storage Domains listed on the domains list,\nor do not send domains list in order to delete all instances of the Template from the system. ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST=Cannot ${action} ${type}. VM's Image does not exist. ACTION_TYPE_FAILED_VM_SNAPSHOT_DOES_NOT_EXIST=Cannot ${action} ${type}. VM's Snapshot does not exist. @@ -213,6 +214,7 @@ ACTION_TYPE_FAILED_PROBLEM_WITH_CANDIDATE_INFO=Cannot ${action} ${type}. Failed to get data for Import operation.\n\ - Check your Import Domain. ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Template doesn't exist. +ACTION_TYPE_FAILED_TEMPLATE_VERSION_CANNOT_BE_BASE_TEMPLATE=Cannot ${action} ${type}. Only the first template version can be selected as the base template. ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Instance Type doesn't exist. ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Image Type doesn't exist. ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED=Cannot ${action} ${type}. The Template is disabled, please try to enable the template first and try again. diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 44a9aa7..64605b2 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -10,6 +10,7 @@ IRS_RESPONSE_ERROR=Storage Manager response error. MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES=Not enough MAC addresses left in MAC Address Pool. VMT_CANNOT_REMOVE_DETECTED_DERIVED_VM=Cannot delete Template. Template is being used by the following VMs: ${vmsList}. +VMT_CANNOT_REMOVE_BASE_WITH_VERSIONS=Cannot delete Base Template that has Template Versions, please first remove all Template Versions for this Template: ${versionsList}. VMT_CANNOT_REMOVE_DOMAINS_LIST_MISMATCH=Cannot delete Template. The Template does not exist on the following Storage Domains: ${domainsList}.\nEither verify that Template exists on all Storage Domains listed on the domains list,\nor do not send domains list in order to delete all instances of the Template from the system. ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST=Cannot ${action} ${type}. VM's Image does not exist. ACTION_TYPE_FAILED_VM_SNAPSHOT_DOES_NOT_EXIST=Cannot ${action} ${type}. VM's Snapshot does not exist. @@ -215,6 +216,7 @@ ACTION_TYPE_FAILED_PROBLEM_WITH_CANDIDATE_INFO=Cannot ${action} ${type}. Failed to get data for Import operation.\n\ - Check your Import Domain. ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Template doesn't exist. +ACTION_TYPE_FAILED_TEMPLATE_VERSION_CANNOT_BE_BASE_TEMPLATE=Cannot ${action} ${type}. Only the first template version can be selected as the base template. ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Instance Type doesn't exist. ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The relevant Image Type doesn't exist. ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED=Cannot ${action} ${type}. The Template is disabled, please try to enable the template first and try again. diff --git a/packaging/dbscripts/vm_templates_sp.sql b/packaging/dbscripts/vm_templates_sp.sql index 9f391e8..1277333 100644 --- a/packaging/dbscripts/vm_templates_sp.sql +++ b/packaging/dbscripts/vm_templates_sp.sql @@ -470,3 +470,25 @@ END; $procedure$ LANGUAGE plpgsql; + +Create or replace FUNCTION GetTemplateVersionsForBaseTemplate(v_base_template_id UUID) RETURNS SETOF vm_templates_view STABLE +AS $procedure$ +BEGIN + RETURN QUERY SELECT * + from vm_templates_view + where base_template_id = v_base_template_id and vmt_guid != v_base_template_id; +END; $procedure$ +LANGUAGE plpgsql; + + +Create or replace FUNCTION GetTemplateWithLatestVersionInChain(v_template_id UUID) RETURNS SETOF vm_templates_view STABLE +AS $procedure$ +BEGIN + RETURN QUERY SELECT * + from vm_templates_view + where base_template_id = + (select vmt_guid from vm_static where vm_guid = v_template_id) + order by template_version_number desc + limit 1; +END; $procedure$ +LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/23608 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id256ade6e3973d5ad00daa267f80e5ce42b87872 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Omer Frenkel <ofren...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches