Skip to content

Commit 6eac66d

Browse files
committed
address review
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 29cd184 commit 6eac66d

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

client/bindir/cloud-setup-management.in

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ def download_template_if_needed(template, url, filename, checksum):
9292
print(f"Downloading {template} System VM template from {url} to {dest_path}...")
9393
try:
9494
download_file(url, dest_path)
95+
#After download, verify checksum if provided
96+
if checksum:
97+
if verify_sha512_checksum(dest_path, checksum):
98+
print(f"{template} System VM template downloaded and verified successfully.")
99+
else:
100+
print(f"ERROR: Checksum verification failed for {template} System VM template after download.")
95101
except Exception as e:
96102
print(f"ERROR: Failed to download {template} System VM template: {e}")
97103

@@ -164,9 +170,21 @@ if __name__ == '__main__':
164170
if templates_arg:
165171
templates_list = [t.strip().lower() for t in templates_arg.split(",")]
166172
if "all" in templates_list:
173+
if len(templates_list) > 1:
174+
print("WARNING: 'all' specified for System VM templates, ignoring other specified templates.")
167175
selected_templates = available_templates
168176
else:
169-
selected_templates = [t for t in templates_list if t in available_templates]
177+
invalid_templates = []
178+
for t in templates_list:
179+
if t in available_templates:
180+
if t not in selected_templates:
181+
selected_templates.append(t)
182+
else:
183+
if t not in invalid_templates:
184+
invalid_templates.append(t)
185+
if invalid_templates:
186+
print(f"ERROR: Invalid System VM template names provided: {', '.join(invalid_templates)}")
187+
sys.exit(1)
170188
print(f"Selected systemvm templates to download: {', '.join(selected_templates) if selected_templates else 'None'}")
171189

172190
template_metadata_list = []

engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public class SystemVmTemplateRegistration {
109109
private static Integer LINUX_12_ID = 363;
110110
private static final Integer SCRIPT_TIMEOUT = 1800000;
111111
private static final Integer LOCK_WAIT_TIMEOUT = 1200;
112-
protected static final String TEMPLATES_DOWNLOAD_REPOSITORY_KEY = "downloadurl";
112+
protected static final String TEMPLATE_DOWNLOAD_URL_KEY = "downloadurl";
113+
protected static final String TEMPLATES_DOWNLOAD_REPOSITORY_KEY = "downloadrepository";
113114
protected static final String TEMPLATES_CUSTOM_DOWNLOAD_REPOSITORY_KEY = "system.vm.templates.download.repository";
114115
protected static final List<CPU.CPUArch> DOWNLOADABLE_TEMPLATE_ARCH_TYPES = Arrays.asList(
115116
CPU.CPUArch.amd64,
@@ -837,7 +838,7 @@ public static String parseMetadataFile() {
837838
key, metadataFilePath);
838839
continue;
839840
}
840-
String url = section.get("downloadurl");
841+
String url = section.get(TEMPLATE_DOWNLOAD_URL_KEY);
841842
if (StringUtils.isNotBlank(url) && updateCustomDownloadRepository) {
842843
url = url.replaceFirst(defaultDownloadRepository.trim(),
843844
customDownloadRepository.trim());

engine/schema/templateConfig.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ declare -A template_specs=(
8888
[kvm-aarch64]="aarch64-kvm.qcow2.bz2"
8989
[vmware]="x86_64-vmware.ova"
9090
[xenserver]="x86_64-xen.vhd.bz2"
91-
[hyperv4]="x86_64-hyperv.vhd.zip"
91+
[hyperv]="x86_64-hyperv.vhd.zip"
9292
[lxc]="x86_64-kvm.qcow2.bz2"
9393
[ovm3]="x86_64-ovm.raw.bz2"
9494
)

0 commit comments

Comments
 (0)