Skip to content

Commit

Permalink
Find devices by spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie committed May 17, 2024
1 parent 6ae0851 commit 2dfa884
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/mounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ interface CephDevice {
async function getCephDeviceName(cephVolume: RegisterMachineResponse_Mount_CephVolume): Promise<string | null> {
const {stdout} = await execa('rbd', ['device', 'list', '--format', 'json'])
const devices: CephDevice[] = JSON.parse(stdout)
const device = devices.find((d) => d.name === cephVolume.volumeName)
const device = devices.find((d) => {
const deviceSpec = `${d.pool}/${d.namespace}/${d.name}`
return deviceSpec === cephVolume.volumeName || d.name === cephVolume.volumeName
})
return device?.device ?? null
}

Expand Down

0 comments on commit 2dfa884

Please sign in to comment.