-
Notifications
You must be signed in to change notification settings - Fork 53
add CPU platforms to instances #8728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 23 commits
4130d30
d316a2e
1367289
b5eaf68
114f383
4c40d47
5ec45d3
e9cbbdd
bf7ccae
0a79d5e
ea59a26
10cd335
99a37f0
6846a4a
5f94661
543bdc9
34516b4
3831038
33956f9
9b6b6ec
5cf7b9c
a877f39
1d34ab2
4275594
c686acf
9348caf
af4e2ee
b05bae4
5f8aedd
9e92b01
d4cbf2f
bfee777
fb12fc9
d59a842
d9acd90
63a5326
e5ba594
b2fd208
401d58b
5364358
d17b8aa
10e67c1
75ed627
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
use crate::SledCpuFamily; | ||
|
||
use super::impl_enum_type; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
impl_enum_type!( | ||
InstanceCpuPlatformEnum: | ||
|
||
#[derive( | ||
Copy, | ||
Clone, | ||
Debug, | ||
PartialEq, | ||
AsExpression, | ||
FromSqlRow, | ||
Serialize, | ||
Deserialize | ||
)] | ||
pub enum InstanceCpuPlatform; | ||
|
||
AmdMilan => b"amd_milan" | ||
AmdTurin => b"amd_turin" | ||
); | ||
|
||
impl InstanceCpuPlatform { | ||
/// Returns a slice containing the set of sled CPU families that can | ||
/// accommodate an instance with this CPU platform. | ||
pub fn compatible_sled_cpu_families(&self) -> &'static [SledCpuFamily] { | ||
match self { | ||
// Turin-based sleds have a superset of the features made available | ||
// in a guest's Milan CPU platform | ||
Self::AmdMilan => { | ||
&[SledCpuFamily::AmdMilan, SledCpuFamily::AmdTurin] | ||
} | ||
Self::AmdTurin => &[SledCpuFamily::AmdTurin], | ||
} | ||
} | ||
} | ||
|
||
impl From<omicron_common::api::external::InstanceCpuPlatform> | ||
for InstanceCpuPlatform | ||
{ | ||
fn from(value: omicron_common::api::external::InstanceCpuPlatform) -> Self { | ||
use omicron_common::api::external::InstanceCpuPlatform as ApiPlatform; | ||
match value { | ||
ApiPlatform::AmdMilan => Self::AmdMilan, | ||
ApiPlatform::AmdTurin => Self::AmdTurin, | ||
} | ||
} | ||
} | ||
|
||
impl From<InstanceCpuPlatform> | ||
for omicron_common::api::external::InstanceCpuPlatform | ||
{ | ||
fn from(value: InstanceCpuPlatform) -> Self { | ||
match value { | ||
InstanceCpuPlatform::AmdMilan => Self::AmdMilan, | ||
InstanceCpuPlatform::AmdTurin => Self::AmdTurin, | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ use std::{collections::BTreeMap, sync::LazyLock}; | |
/// | ||
/// This must be updated when you change the database schema. Refer to | ||
/// schema/crdb/README.adoc in the root of this repository for details. | ||
pub const SCHEMA_VERSION: Version = Version::new(173, 0, 0); | ||
pub const SCHEMA_VERSION: Version = Version::new(175, 0, 0); | ||
|
||
/// List of all past database schema versions, in *reverse* order | ||
/// | ||
|
@@ -28,6 +28,8 @@ static KNOWN_VERSIONS: LazyLock<Vec<KnownVersion>> = LazyLock::new(|| { | |
// | leaving the first copy as an example for the next person. | ||
// v | ||
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"), | ||
KnownVersion::new(175, "add-instance-cpu-platform"), | ||
KnownVersion::new(174, "sled-cpu-family"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. take it or leave it, but i think it would've been fine to do this in a single migration --- though maybe separating them is nicer since they change different tables... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is actually a weird github thing.. as a draft this was on top of another PR that added sled CPU family reporting, which is merged, and i think was migration 174! i thought this would evaporate out of the diff. i'll have to take a closer look at what's going on with that.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah ok, so when landing the sled CPU family PR i had to bump the schema number a bit so as to actually make it the latest, and i did not rebase this PR on the commit that finally went in. i've merged |
||
KnownVersion::new(173, "inv-internal-dns"), | ||
KnownVersion::new(172, "add-zones-with-mupdate-override"), | ||
KnownVersion::new(171, "inv-clear-mupdate-override"), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is RFD 314 public, and do we intend to make it public? If we're referencing it in a comment that will eventually make it into the public API docs, perhaps we should?