-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Support Multi-arch Zones (#9619)
This introduces the multi-arch zones, allowing users to select the VM arch upon deployment. Multi-arch zone support in CloudStack can allow admins to mix x86_64 & arm64 hosts within the same zone with the following changes proposed: - All hosts in a clusters need to be homogenous, wrt host CPU type (amd64 vs arm64) and hypevisor - Arch-aware templates & ISOs: - Add support for a new arch field (default set of: amd64 and arm64), when unspecified defaults to amd64 and for existing templates & iso - Allow admins to edit the arch type of the registered template & iso - Arch-aware clusters and host: - Add new attribute field for cluster and hosts (kvm host agents can automatically report this, arch of the first host of the cluster is cluster's architecture), defaults to amd64 when not specified - Allow admins to edit the arch of an existing cluster - VM deployment form (UI): - In a multi-arch zone/env, the VM deployment form can allow some kind of template/iso filtration in the UI - Users should be able to select arch: amd64 & arm64; but this is shown only in a multi-arch zone (env) - VM orchestration and lifecycle operations: - Use of VM/template's arch to correctly decide where to provision the VM (on the correct strictly arch-matching host/clusters) & other lifecycle operations (such as migration from/to arch-matching hosts) Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
- Loading branch information
1 parent
52b0696
commit 8c8d115
Showing
72 changed files
with
926 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// 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 com.cloud.cpu; | ||
|
||
import com.cloud.utils.exception.CloudRuntimeException; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class CPU { | ||
|
||
public static final String archX86Identifier = "i686"; | ||
public static final String archX86_64Identifier = "x86_64"; | ||
public static final String archARM64Identifier = "aarch64"; | ||
|
||
public static class CPUArch { | ||
private static final Map<String, CPUArch> cpuArchMap = new LinkedHashMap<>(); | ||
|
||
public static final CPUArch archX86 = new CPUArch(archX86Identifier, 32); | ||
public static final CPUArch amd64 = new CPUArch(archX86_64Identifier, 64); | ||
public static final CPUArch arm64 = new CPUArch(archARM64Identifier, 64); | ||
|
||
private String type; | ||
private int bits; | ||
|
||
public CPUArch(String type, int bits) { | ||
this.type = type; | ||
this.bits = bits; | ||
cpuArchMap.put(type, this); | ||
} | ||
|
||
public String getType() { | ||
return this.type; | ||
} | ||
|
||
public int getBits() { | ||
return this.bits; | ||
} | ||
|
||
public static CPUArch fromType(String type) { | ||
if (StringUtils.isBlank(type)) { | ||
return amd64; | ||
} | ||
switch (type) { | ||
case archX86Identifier: return archX86; | ||
case archX86_64Identifier: return amd64; | ||
case archARM64Identifier: return arm64; | ||
default: throw new CloudRuntimeException(String.format("Unsupported arch type: %s", type)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.