Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,11 @@ public void setUpdated(Date updated) {
public static final List<Pair<Hypervisor.HypervisorType, CPU.CPUArch>> hypervisorList = Arrays.asList(
new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64),
new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.arm64),
new Pair<>(Hypervisor.HypervisorType.VMware, null),
new Pair<>(Hypervisor.HypervisorType.XenServer, null),
new Pair<>(Hypervisor.HypervisorType.Hyperv, null),
new Pair<>(Hypervisor.HypervisorType.LXC, null),
new Pair<>(Hypervisor.HypervisorType.Ovm3, null)
new Pair<>(Hypervisor.HypervisorType.VMware, CPU.CPUArch.getDefault()),
new Pair<>(Hypervisor.HypervisorType.XenServer, CPU.CPUArch.getDefault()),
new Pair<>(Hypervisor.HypervisorType.Hyperv, CPU.CPUArch.getDefault()),
new Pair<>(Hypervisor.HypervisorType.LXC, CPU.CPUArch.getDefault()),
new Pair<>(Hypervisor.HypervisorType.Ovm3, CPU.CPUArch.getDefault())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weizhouapache when arch type is null, it's defaulted to amd64, is null arch issue here?

protected static String getHypervisorArchKey(Hypervisor.HypervisorType hypervisorType, CPU.CPUArch arch) {
if (Hypervisor.HypervisorType.KVM.equals(hypervisorType)) {
return String.format("%s-%s", hypervisorType.name().toLowerCase(),
arch == null ? CPU.CPUArch.amd64.getType() : arch.getType());
}
return hypervisorType.name().toLowerCase();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, make note of the changes in the below PR in main (no need of forward merging the changes here to main)

https://github.com/apache/cloudstack/pull/11656/changes#diff-a9c9a38684718059c060de404bf9529de96e502f1e81b30793e6a32f725042a9

Copy link
Copy Markdown
Member Author

@weizhouapache weizhouapache Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sureshanaparti
in another place

the arch of MetadataTemplateDetails is from hypervisorType, which is null for non-KVM

            NewTemplateMap.put(key, new MetadataTemplateDetails(
                    hypervisorType.first(),
                    section.get("templatename"),
                    section.get("filename"),
                    section.get("downloadurl"),
                    section.get("checksum"),
                    hypervisorType.second(),
                    section.get("guestos")));

but in hypervisorsInUse, the arch is amd64/x86_64 (default arch of clusters)

hypervisorsInUse = clusterDao.listDistinctHypervisorsArchAcrossClusters(null);

cluster arch

mysql> SELECT DISTINCT hypervisor_type,arch from cluster;
+-----------------+--------+
| hypervisor_type | arch   |
+-----------------+--------+
| VMware          | x86_64 |
+-----------------+--------+
1 row in set (0.00 sec)

so the check always return false (line 1034)

boolean isHypervisorArchMatchMetadata = hypervisorsInUse.stream()
.anyMatch(p -> p.first().equals(templateDetails.getHypervisorType())
&& Objects.equals(p.second(), templateDetails.getArch()));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, make note of the changes in the below PR in main (no need of forward merging the changes here to main)

https://github.com/apache/cloudstack/pull/11656/changes#diff-a9c9a38684718059c060de404bf9529de96e502f1e81b30793e6a32f725042a9

good point @sureshanaparti
so the issue should not appear in 4.22, great

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok @weizhouapache, how about replacing hypervisorType.second() == null ? CPU.CPUArch.amd64.getType() : hypervisorType.second().getType() at

maybe, move it to method and use the call same method here and in getHypervisorArchKey()

private String getCPUArchType(CPU.CPUArch arch) {
    if (arch == null) {
        return CPU.CPUArch.amd64.getType();
    }
    return arch.getType();
}

);

public static final Map<String, MetadataTemplateDetails> NewTemplateMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void test_parseMetadataFile_success() {
templateDetails =
SystemVmTemplateRegistration.NewTemplateMap.get("vmware");
assertNotNull(templateDetails);
assertNull(templateDetails.getArch());
assertEquals(CPU.CPUArch.amd64, templateDetails.getArch());
assertEquals(Hypervisor.HypervisorType.VMware, templateDetails.getHypervisorType());
}

Expand Down
Loading