Skip to content
Open
Changes from all 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
47 changes: 27 additions & 20 deletions bin/propolis-server/src/lib/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,8 @@ impl MachineInitializer<'_> {
}
};

let block_size;
let volume_id;
if let Some(crucible) = crucible {
let crucible =
match self.crucible_backends.entry(backend_id.clone()) {
Expand All @@ -910,27 +912,24 @@ impl MachineInitializer<'_> {
}
};

let Some(block_size) = crucible.block_size().await else {
slog::error!(
self.log,
"Could not get Crucible backend block size, \
virtual disk metrics can't be reported for it";
"disk_id" => %backend_id,
);
continue;
block_size = crucible.block_size().await;
volume_id = crucible.get_uuid().await.ok();
} else {
// Not a Crucible backend, e.g. local disk
block_size = match &disk.backend_spec {
StorageBackend::File(fsb) => Some(fsb.block_size),
StorageBackend::Blob(_) => Some(512),
_ => None,
};

let Ok(volume_id) = crucible.get_uuid().await else {
slog::error!(
self.log,
"Could not get Crucible volume ID, \
virtual disk metrics can't be reported for it";
"disk_id" => %backend_id,
);
continue;
volume_id = match backend_id {
SpecKey::Uuid(uuid) => Some(*uuid),
_ => None,
};

if let Some(registry) = &self.producer_registry {
}
if let Some(registry) = &self.producer_registry {
if let (Some(block_size), Some(volume_id)) =
(block_size, volume_id)
{
let block_metrics = BlockMetrics::new(
VirtualDisk {
attached_instance_id: self.properties.id,
Expand All @@ -957,7 +956,15 @@ impl MachineInitializer<'_> {
};

block_dev.attachment().set_metric_consumer(block_metrics);
};
} else {
slog::error!(
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.

We still won't try to log cloud-init type backends, right? As they have no UUID:

16:18:52.344Z INFO propolis-server (vm_state_driver): Creating storage device
    device_id = cloud-init-dev
    spec = Virtio(VirtioDisk { backend_id: Name("cloud-init-backend"), pci_path: PciPath { bus: 0, device: 24, function: 0 } })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The type system allows virtio devices to have a Uuid (the backend_id could be a Uuid instead of a Name). But if in practice they do not have uuid's (as shown in your log output), then we won't register metrics for them.

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.

The type system allows virtio devices to have a Uuid (the backend_id could be a Uuid instead of a Name). But if in practice they do not have uuid's (as shown in your log output), then we won't register metrics for them.

Perfect. It's what we discussed during the huddle, but I wanted to be sure we were not going to all of a sudden start logging all the cloud-init disks.

self.log,
"Could not get backend volume UUID or block size, \
virtual disk metrics can't be reported for it";
"disk_id" => %backend_id,
);
continue;
}
}
}
Ok(wanted_heap)
Expand Down
Loading