This is an automated email from the ASF dual-hosted git repository. andrijapanicsb pushed a commit to branch fix/clarify-kvm-import-templateid-requirement in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 3de13b0d6464540578a85051f04714df6d6e319e Author: Andrija Panic <[email protected]> AuthorDate: Thu May 7 18:24:42 2026 +0200 Clarify KVM import template requirement --- .../admin/vm/ImportUnmanagedInstanceCmd.java | 2 +- .../admin/vm/ImportUnmanagedInstanceCmdTest.java | 36 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java index 3284dbafe7c..0937902efcb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java @@ -115,7 +115,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, - description = "The ID of the Template for the Instance") + description = "The ID of the Template for the Instance. Required when importing an unmanaged KVM Instance.") private Long templateId; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmdTest.java new file mode 100644 index 00000000000..893bace07cc --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmdTest.java @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.admin.vm; + +import java.lang.reflect.Field; + +import org.apache.cloudstack.api.Parameter; +import org.junit.Assert; +import org.junit.Test; + +public class ImportUnmanagedInstanceCmdTest { + + @Test + public void testTemplateIdDescriptionMentionsKvmRequirement() throws NoSuchFieldException { + Field templateIdField = ImportUnmanagedInstanceCmd.class.getDeclaredField("templateId"); + Parameter parameter = templateIdField.getAnnotation(Parameter.class); + + Assert.assertNotNull(parameter); + Assert.assertTrue(parameter.description().contains("Required when importing an unmanaged KVM Instance.")); + } +}
