From 0e5342d57ee616f9a5bc3b4262d5d022f30fabb1 Mon Sep 17 00:00:00 2001 From: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com> Date: Thu, 7 May 2026 18:24:42 +0200 Subject: [PATCH 1/4] Clarify KVM import template requirement --- .../admin/vm/ImportUnmanagedInstanceCmd.java | 2 +- .../vm/ImportUnmanagedInstanceCmdTest.java | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 api/src/test/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmdTest.java 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 d60c627163b8..b2635b2433ef 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 000000000000..893bace07ccb --- /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.")); + } +} From e26017bd84ebafe779a1129fbc315716baf3d8f8 Mon Sep 17 00:00:00 2001 From: Andrija Panic <45762285+andrijapanicsb@users.noreply.github.com> Date: Fri, 29 May 2026 02:26:53 +0200 Subject: [PATCH 2/4] Delete api/src/test/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmdTest.java unneeded --- .../vm/ImportUnmanagedInstanceCmdTest.java | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 api/src/test/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmdTest.java 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 deleted file mode 100644 index 893bace07ccb..000000000000 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmdTest.java +++ /dev/null @@ -1,36 +0,0 @@ -// 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.")); - } -} From 885c90061db8fa7b078dc9b0bf6b794710361cf1 Mon Sep 17 00:00:00 2001 From: Nicolas Vazquez Date: Wed, 9 Sep 2026 16:20:24 -0300 Subject: [PATCH 3/4] Update api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java Co-authored-by: dahn --- .../api/command/admin/vm/ImportUnmanagedInstanceCmd.java | 2 +- 1 file changed, 1 insertion(+), 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 b2635b2433ef..5c07d3bae647 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. Required when importing an unmanaged KVM Instance.") + description = "The ID of the Template for the Instance. Required when the instance to import is a KVM Instance.") private Long templateId; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, From 850ab460ff448dba6966c8c0bf50106f486bb83c Mon Sep 17 00:00:00 2001 From: nvazquez Date: Wed, 9 Sep 2026 16:25:41 -0300 Subject: [PATCH 4/4] Include unmanaged instance in the description for extra clarity --- .../api/command/admin/vm/ImportUnmanagedInstanceCmd.java | 2 +- 1 file changed, 1 insertion(+), 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 5c07d3bae647..fd18e44754a4 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. Required when the instance to import is a KVM Instance.") + description = "The ID of the Template for the Instance. Required when the instance to import is an unmanaged KVM Instance.") private Long templateId; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID,