Skip to content

Commit 4eb1ff5

Browse files
committed
s/boot_device/boot_disk/g
1 parent efb34a5 commit 4eb1ff5

File tree

29 files changed

+134
-135
lines changed

29 files changed

+134
-135
lines changed

common/src/api/external/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,8 @@ pub struct Instance {
11871187
/// RFC1035-compliant hostname for the Instance.
11881188
pub hostname: String,
11891189

1190-
/// the ID of the device used to boot this Instance, if a specific one is assigned.
1191-
pub boot_device_id: Option<Uuid>,
1190+
/// the ID of the disk used to boot this Instance, if a specific one is assigned.
1191+
pub boot_disk_id: Option<Uuid>,
11921192

11931193
#[serde(flatten)]
11941194
pub runtime: InstanceRuntimeState,

nexus/db-model/src/instance.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ pub struct Instance {
6363
#[diesel(column_name = auto_restart_policy)]
6464
pub auto_restart_policy: Option<InstanceAutoRestart>,
6565

66-
/// The primary boot device for this instance.
67-
#[diesel(column_name = boot_device)]
68-
pub boot_device: Option<Uuid>,
66+
/// The primary boot disk for this instance.
67+
#[diesel(column_name = boot_disk)]
68+
pub boot_disk: Option<Uuid>,
6969

7070
#[diesel(embed)]
7171
pub runtime_state: InstanceRuntimeState,
@@ -117,9 +117,9 @@ impl Instance {
117117
// TODO(eliza): allow this to be configured via the instance-create
118118
// params...
119119
auto_restart_policy: None,
120-
// Intentionally ignore `params.boot_device` here: we can't set
121-
// `boot_device` until the referenced device is attached.
122-
boot_device: None,
120+
// Intentionally ignore `params.boot_disk` here: we can't set
121+
// `boot_disk` until the referenced disk is attached.
122+
boot_disk: None,
123123
runtime_state,
124124

125125
updater_gen: Generation::new(),
@@ -235,6 +235,6 @@ impl InstanceRuntimeState {
235235
#[derive(Clone, Debug, AsChangeset, Serialize, Deserialize)]
236236
#[diesel(table_name = instance, treat_none_as_null = true)]
237237
pub struct InstanceUpdate {
238-
#[diesel(column_name = boot_device)]
239-
pub boot_device: Option<Uuid>,
238+
#[diesel(column_name = boot_disk)]
239+
pub boot_disk: Option<Uuid>,
240240
}

nexus/db-model/src/schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ table! {
408408
memory -> Int8,
409409
hostname -> Text,
410410
auto_restart_policy -> Nullable<crate::InstanceAutoRestartEnum>,
411-
boot_device -> Nullable<Uuid>,
411+
boot_disk -> Nullable<Uuid>,
412412
time_state_updated -> Timestamptz,
413413
state_generation -> Int8,
414414
active_propolis_id -> Nullable<Uuid>,

nexus/db-model/src/schema_versions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static KNOWN_VERSIONS: Lazy<Vec<KnownVersion>> = Lazy::new(|| {
2929
// | leaving the first copy as an example for the next person.
3030
// v
3131
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"),
32-
KnownVersion::new(98, "add-instance-boot-device"),
32+
KnownVersion::new(98, "add-instance-boot-disk"),
3333
KnownVersion::new(97, "lookup-region-snapshot-by-region-id"),
3434
KnownVersion::new(96, "inv-dataset"),
3535
KnownVersion::new(95, "turn-boot-on-fault-into-auto-restart"),

nexus/db-queries/src/db/datastore/disk.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ impl DataStore {
337337
.eq_any(ok_to_detach_instance_states)
338338
.and(instance::dsl::active_propolis_id.is_null())
339339
.and(
340-
instance::dsl::boot_device.ne(authz_disk.id())
341-
.or(instance::dsl::boot_device.is_null())
340+
instance::dsl::boot_disk.ne(authz_disk.id())
341+
.or(instance::dsl::boot_disk.is_null())
342342
)),
343343
disk::table
344344
.into_boxed()
@@ -392,7 +392,7 @@ impl DataStore {
392392
// Ok-to-be-detached instance states:
393393
api::external::InstanceState::Creating |
394394
api::external::InstanceState::Stopped => {
395-
if collection.boot_device == Some(authz_disk.id()) {
395+
if collection.boot_disk == Some(authz_disk.id()) {
396396
return Err(Error::conflict(
397397
"boot disk cannot be detached"
398398
));

nexus/db-queries/src/db/datastore/instance.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl From<InstanceAndActiveVmm> for external::Instance {
206206
.hostname
207207
.parse()
208208
.expect("found invalid hostname in the database"),
209-
boot_device_id: value.instance.boot_device.into(),
209+
boot_disk_id: value.instance.boot_disk.into(),
210210
runtime: external::InstanceRuntimeState {
211211
run_state: value.effective_state(),
212212
time_run_state_updated,
@@ -906,12 +906,12 @@ impl DataStore {
906906
// * Allow reconfiguration in NoVmm because there is no VMM
907907
// to contend with.
908908
// * Allow reconfiguration in Failed to allow changing the
909-
// boot device of a failed instance and free its boot disk
909+
// boot disk of a failed instance and free its boot disk
910910
// for detach.
911911
// * Allow reconfiguration in Creating because one of the
912912
// last steps of instance creation, while the instance is
913913
// still in Creating, is to reconfigure the instance to
914-
// the desired boot device.
914+
// the desired boot disk.
915915
let ok_to_reconfigure_instance_states = vec![
916916
InstanceState::NoVmm,
917917
InstanceState::Failed,
@@ -940,7 +940,7 @@ impl DataStore {
940940
}
941941
}
942942

943-
if let Some(disk_id) = update.boot_device.clone() {
943+
if let Some(disk_id) = update.boot_disk.clone() {
944944
// Ensure the disk is currently attached before updating
945945
// the database.
946946
let expected_state = api::external::DiskState::Attached(
@@ -972,7 +972,7 @@ impl DataStore {
972972
// here.
973973
//
974974
// NOTE: from this point forward it is OK if we update the
975-
// instance's `boot_device` column with the updated value
975+
// instance's `boot_disk` column with the updated value
976976
// again. It will have already been assigned with constraint
977977
// checking performed above, so updates will just be
978978
// repetitive, not harmful.
@@ -1774,7 +1774,7 @@ mod tests {
17741774
params::InstanceNetworkInterfaceAttachment::None,
17751775
external_ips: Vec::new(),
17761776
disks: Vec::new(),
1777-
boot_device: None,
1777+
boot_disk: None,
17781778
ssh_public_keys: None,
17791779
start: false,
17801780
},

nexus/db-queries/src/db/datastore/migration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ mod tests {
234234
params::InstanceNetworkInterfaceAttachment::None,
235235
external_ips: Vec::new(),
236236
disks: Vec::new(),
237-
boot_device: None,
237+
boot_disk: None,
238238
ssh_public_keys: None,
239239
start: false,
240240
},

nexus/db-queries/src/db/datastore/virtual_provisioning_collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ mod test {
454454
params::InstanceNetworkInterfaceAttachment::None,
455455
external_ips: Vec::new(),
456456
disks: Vec::new(),
457-
boot_device: None,
457+
boot_disk: None,
458458
ssh_public_keys: None,
459459
start: false,
460460
},

nexus/db-queries/src/db/datastore/vpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2836,7 +2836,7 @@ mod tests {
28362836
params::InstanceNetworkInterfaceAttachment::None,
28372837
external_ips: vec![],
28382838
disks: vec![],
2839-
boot_device: None,
2839+
boot_disk: None,
28402840
ssh_public_keys: None,
28412841
start: false,
28422842
},

nexus/src/app/instance.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl super::Nexus {
304304
let (.., authz_project, authz_instance) =
305305
instance_lookup.lookup_for(authz::Action::Modify).await?;
306306

307-
let boot_device = match params.boot_device.clone() {
307+
let boot_disk = match params.boot_disk.clone() {
308308
Some(disk) => {
309309
let selector = params::DiskSelector {
310310
project: match &disk {
@@ -323,7 +323,7 @@ impl super::Nexus {
323323
None => None,
324324
};
325325

326-
let update = InstanceUpdate { boot_device };
326+
let update = InstanceUpdate { boot_disk };
327327
self.datastore()
328328
.reconfigure_instance(opctx, &authz_instance, update)
329329
.await
@@ -467,12 +467,12 @@ impl super::Nexus {
467467
}
468468

469469
// It is deceptively inconvenient to do an early check that the boot
470-
// device is valid here! We accept boot device by name or ID, but disk
470+
// disk is valid here! We accept boot disk by name or ID, but disk
471471
// creation and attachment requests as part of instance creation all
472-
// require the disk name. So if the boot device is an ID, we would need
473-
// to look up all attachment requests to compare the named device and
474-
// to-be-attached devices. Instead, leave this for the other end of the
475-
// saga when we'd go to set the boot device.
472+
// require the disk name. So if the boot disk is an ID, we would need
473+
// to look up all attachment requests to compare the named disk and
474+
// to-be-attached disks. Instead, leave this for the other end of the
475+
// saga when we'd go to set the boot disk.
476476

477477
let saga_params = sagas::instance_create::Params {
478478
serialized_authn: authn::saga::Serialized::for_opctx(opctx),
@@ -1016,7 +1016,7 @@ impl super::Nexus {
10161016
)
10171017
.await?;
10181018

1019-
let mut boot_device_name = None;
1019+
let mut boot_disk_name = None;
10201020

10211021
let mut disk_reqs = vec![];
10221022
for disk in &disks {
@@ -1054,8 +1054,8 @@ impl super::Nexus {
10541054

10551055
// Propolis wants the name of the boot disk rather than ID, because we send names
10561056
// rather than IDs in the disk requsts as assembled below.
1057-
if db_instance.boot_device == Some(disk.id()) {
1058-
boot_device_name = Some(disk.name().to_string());
1057+
if db_instance.boot_disk == Some(disk.id()) {
1058+
boot_disk_name = Some(disk.name().to_string());
10591059
}
10601060

10611061
disk_reqs.push(sled_agent_client::types::DiskRequest {
@@ -1072,23 +1072,23 @@ impl super::Nexus {
10721072

10731073
// This should never occur: when setting the boot disk we ensure it is
10741074
// attached, and when detaching a disk we ensure it is not the boot
1075-
// disk. If this error is seen, the instance somehow had a boot device
1076-
// that was not an attached disk anyway.
1075+
// disk. If this error is seen, the instance somehow had a boot disk
1076+
// that was not attached anyway.
10771077
//
10781078
// When Propolis accepts an ID rather than name, and we don't need to
10791079
// look up a name when assembling the Propolis request, we might as well
10801080
// remove this check; we can just pass the ID and rely on Propolis' own
1081-
// check that the boot device is attached.
1082-
if let Some(instance_boot_device) = db_instance.boot_device.as_ref() {
1083-
if boot_device_name.is_none() {
1084-
error!(self.log, "instance boot device is not attached";
1085-
"boot_device" => ?instance_boot_device,
1081+
// check that the boot disk is attached.
1082+
if let Some(instance_boot_disk) = db_instance.boot_disk.as_ref() {
1083+
if boot_disk_name.is_none() {
1084+
error!(self.log, "instance boot disk is not attached";
1085+
"boot_disk" => ?instance_boot_disk,
10861086
"instance id" => %db_instance.id());
10871087

10881088
return Err(InstanceStateChangeError::Other(Error::internal_error(&format!(
1089-
"instance {} has boot device {:?} but it is not an attached disk",
1089+
"instance {} has boot disk {:?} but it is not attached",
10901090
db_instance.id(),
1091-
db_instance.boot_device.as_ref(),
1091+
db_instance.boot_disk.as_ref(),
10921092
))));
10931093
}
10941094
}
@@ -1240,7 +1240,7 @@ impl super::Nexus {
12401240
search_domains: Vec::new(),
12411241
},
12421242
disks: disk_reqs,
1243-
boot_order: boot_device_name.map(|v| vec![v]),
1243+
boot_order: boot_disk_name.map(|v| vec![v]),
12441244
cloud_init_bytes: Some(base64::Engine::encode(
12451245
&base64::engine::general_purpose::STANDARD,
12461246
db_instance.generate_cidata(&ssh_keys)?,
@@ -2321,7 +2321,7 @@ mod tests {
23212321
network_interfaces: InstanceNetworkInterfaceAttachment::None,
23222322
external_ips: vec![],
23232323
disks: vec![],
2324-
boot_device: None,
2324+
boot_disk: None,
23252325
ssh_public_keys: None,
23262326
start: false,
23272327
};

0 commit comments

Comments
 (0)