-
Notifications
You must be signed in to change notification settings - Fork 292
CP-308455 VM.sysprep if CD insert fails, remove ISO #6632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ type error = | |
| Other of string | ||
| VM_CDR_not_found | ||
| VM_CDR_eject | ||
| VM_CDR_insert | ||
| VM_misses_feature | ||
| VM_not_running | ||
| VM_sysprep_timeout | ||
|
@@ -212,6 +213,8 @@ let eject ~rpc ~session_id ~vbd ~iso = | |
Client.VBD.eject ~rpc ~session_id ~vbd ; | ||
Sys.remove iso | ||
with exn -> | ||
Sys.remove iso ; | ||
(* still remove ISO to protect it *) | ||
warn "%s: ejecting CD failed: %s" __FUNCTION__ (Printexc.to_string exn) ; | ||
fail VM_CDR_eject | ||
|
||
|
@@ -281,7 +284,13 @@ let sysprep ~__context ~vm ~unattend ~timeout = | |
let uuid = Db.VDI.get_uuid ~__context ~self:vdi in | ||
debug "%s: inserting Sysprep VDI for VM %s" __FUNCTION__ vm_uuid ; | ||
call ~__context @@ fun rpc session_id -> | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be |
||
(Printexc.to_string e) ; | ||
Sys.remove iso ; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
fail VM_CDR_insert | ||
) ; | ||
Thread.delay !Xapi_globs.vm_sysprep_wait ; | ||
match trigger ~rpc ~session_id ~domid ~uuid ~timeout ~vbd ~iso with | ||
| true -> | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.