Skip to content

Commit

Permalink
ensure no collisions when applying mock PCI-address for emulated devices
Browse files Browse the repository at this point in the history
Features: control
Required-githooks: true

Signed-off-by: Tom Nabarro <[email protected]>
  • Loading branch information
tanabarr committed Dec 18, 2024
1 parent 70abfc0 commit 62c56ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/control/server/instance_storage_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ func scanEngineBdevsOverDrpc(ctx context.Context, engine Engine, pbReq *ctlpb.Sc
addr := sd.Ctrlr.PciAddr
if addr == "" {
// Mock identifier for emulated NVMe mode where devices have no PCI-address.
addr = fmt.Sprintf("0000:00:0.%d", i)
// Allows for 256 unique identifiers per-host and formatted string template
// ensures no collisions with real device addresses. Note that this mock
// identifier address is not used outside of this loop and is only used for
// the purpose of mapping SMD records to NVMe (emulated) device details.
addr = fmt.Sprintf("FFFF:00:%X.F", i)
}

if _, exists := seenCtrlrs[addr]; !exists {
Expand Down

0 comments on commit 62c56ed

Please sign in to comment.