Skip to content

Conversation

lindig
Copy link
Contributor

@lindig lindig commented Aug 21, 2025

If inserting the CD fails, remove the ISO to protect its contents. Likewise, remove it when eject fails.

@lindig lindig requested review from edwintorok and robhoes August 21, 2025 14:51
Client.VBD.insert ~rpc ~session_id ~vdi ~vbd ;
( try Client.VBD.insert ~rpc ~session_id ~vdi ~vbd
with e ->
debug "%s: failed to insert CD, removing ISO %s: %s" __FUNCTION__ iso
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be warn or error?

with e ->
debug "%s: failed to insert CD, removing ISO %s: %s" __FUNCTION__ iso
(Printexc.to_string e) ;
Sys.remove iso ;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can Sys.remove fail? What happen if it fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can fail if the file does not exist, which should not happen. I could wrap this.

Sys.remove iso
with exn ->
Sys.remove iso ;
(* still remove ISO to protect it *)
Copy link
Contributor

Choose a reason for hiding this comment

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

This behaviour is a little uncommon. Can you describe in detail?
What's the relation between vbd and iso? If vbd eject fail, will it still exist? Then if we remove iso, will it be inconsistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ISO may contain secrets so we would like to not keeping it around. This is an ISO SR where we can add and remove ISOs and the SM layer will update xapi. I am not sure what happens from the VMs perspective, though.

@psafont
Copy link
Member

psafont commented Aug 27, 2025

The PR needs to be rebased on top of the latest master to run all the required checks

If inserting the CD fails, remove the ISO to protect its contents.
Likewise, remove it when eject fails.

Signed-off-by: Christian Lindig <[email protected]>
@lindig lindig force-pushed the private/christianlin/vm-sysprep branch from 1ab0037 to c97250d Compare August 27, 2025 12:03
@lindig lindig added this pull request to the merge queue Aug 27, 2025
Merged via the queue into xapi-project:master with commit 59f2751 Aug 27, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants