Skip to content

Implement ISO export#2526

Merged
stgraber merged 8 commits intolxc:mainfrom
bensmrs:main
Oct 3, 2025
Merged

Implement ISO export#2526
stgraber merged 8 commits intolxc:mainfrom
bensmrs:main

Conversation

@bensmrs
Copy link
Copy Markdown
Contributor

@bensmrs bensmrs commented Oct 2, 2025

Closes: #2506

@bensmrs bensmrs requested a review from stgraber as a code owner October 2, 2025 17:50
@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 2, 2025

Not gonna lie, this one was quite painful

@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 2, 2025

Oh, LVM seems to be behaving differently, but the behavior didn’t appear on my machine.
Edit: turns out on my machine, the ISO was 4M-aligned…

@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 2, 2025

So two questions come up:

  • Should I drop the import > export idempotence or should I rather query the DB for the ISO size? (edit: I found a way to keep idempotence)
  • Why in the current code don’t we use the actual volume size in the export rather than the on-disk size?

@stgraber
Copy link
Copy Markdown
Member

stgraber commented Oct 2, 2025

  • Should I drop the import > export idempotence or should I rather query the DB for the ISO size?

  • Why in the current code don’t we use the actual volume size in the export rather than the on-disk size?

In the case of an ISO which is write-once, it'd be safe to truncate it to the size we have in the database. For any other volume type, not so much as actual data (GPT table mostly) may have been written all the way at the end of the volume (post-rounding/alignment).

@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 2, 2025

In the case of an ISO which is write-once, it'd be safe to truncate it to the size we have in the database. For any other volume type, not so much as actual data (GPT table mostly) may have been written all the way at the end of the volume (post-rounding/alignment).

Oh I see. But doesn’t it mean that we’re exposing in the API a size that may be wrong? (thinking about vol.config["size"])

@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 2, 2025

Nah, it really looks like vol.config["size"] is only exposed for ISO volumes, correct me if I’m wrong.

@bensmrs bensmrs force-pushed the main branch 2 times, most recently from 255cfd8 to 50c5860 Compare October 2, 2025 21:39
@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 2, 2025

I’ll add a commit to patch the command description tomorrow

@stgraber
Copy link
Copy Markdown
Member

stgraber commented Oct 3, 2025

@bensmrs can you add an API extension for this one?

@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 3, 2025

I’m always confused whether we need an extension or not… Here, clients won’t behave differently (as in: it’s the server that tells whether things worked; the clients don’t have to adapt) with or without this extension, so what’s exactly the point?

@github-actions github-actions bot added Documentation Documentation needs updating API Changes to the REST API labels Oct 3, 2025
@stgraber
Copy link
Copy Markdown
Member

stgraber commented Oct 3, 2025

@bensmrs sorry, needs a rebase because of the API extension.

@stgraber
Copy link
Copy Markdown
Member

stgraber commented Oct 3, 2025

I’m always confused whether we need an extension or not… Here, clients won’t behave differently (as in: it’s the server that tells whether things worked; the clients don’t have to adapt) with or without this extension, so what’s exactly the point?

The reason for this one is so for example a web UI can tell whether to show a download button next to that ISO image or not.

Doesn't really matter for the CLI as we had a clear error, but it does allow for providing a better user experience in some situations.

@bensmrs
Copy link
Copy Markdown
Contributor Author

bensmrs commented Oct 3, 2025

Ok thanks for the clarification

@stgraber stgraber merged commit 0716697 into lxc:main Oct 3, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Changes to the REST API Documentation Documentation needs updating

Development

Successfully merging this pull request may close these issues.

Add ability to export ISO volumes

2 participants