Skip to content

want way to read data from a Disk through the API #5824

Open
@faithanalog

Description

@faithanalog

I believe that right now, if I wanted to download a Disk, I would need to launch a VM with the Disk attached, and a guest image that will let me read the Disk data. That'll function, but it'd be nice to be able to download bytes from the Disk directly.

Crucible Pantry has the /crucible/pantry/0/volume/{id}/bulk-read endpoint, but it's not wired up to anything in the API right now.

I believe that we would need

  • a way to put the Disk into an "export" state, a state I just invented, to tell pantry to attach to the Disk in read-mode
  • an endpoint that maps to pantry's bulk-read to read a range of blocks from the Disk
  • a way to take the Disk out of "export" state, to tell pantry to detach

It may also be possible to implementing reading data from an Image, but this would need some extra logic to decide when pantry attaches/detaches from the Image. Though without a convenience in the API, you could get the job done by creating a Disk from an Image, exporting the Disk, and then deleting it afterwards.

It would be pretty convenient if this exposed the Disk as an endpoint you can GET to download the whole file, while also responding to standard HTTP range-requests. That, instead of having to make multiple requests with a bespoke interface and put it back together client side (which would be similar to what uploading does). But I don't yet know enough about the API workings to know if that's feasible; I suppose if there's limits on API response sizes then it maybe isn't.

I'm intentionally vague saying "a way" for the disk states. I've noticed we already have 3 endpoints that all serve the role of transitioning a disk between pantry-related states

  • /v1/disks/{disk}/bulk-write-start
  • /v1/disks/{disk}/bulk-write-stop
  • /v1/disks/{disk}/finalize

I'm not sure if we'd want to keep tacking on extra state-transition endpoints (bulk-read-start, bulk-read-stop) or do something else

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request.storageRelated to storage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions