File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ type error =
29
29
| Other of string
30
30
| VM_CDR_not_found
31
31
| VM_CDR_eject
32
+ | VM_CDR_insert
32
33
| VM_misses_feature
33
34
| VM_not_running
34
35
| VM_sysprep_timeout
@@ -212,6 +213,8 @@ let eject ~rpc ~session_id ~vbd ~iso =
212
213
Client.VBD. eject ~rpc ~session_id ~vbd ;
213
214
Sys. remove iso
214
215
with exn ->
216
+ Sys. remove iso ;
217
+ (* still remove ISO to protect it *)
215
218
warn " %s: ejecting CD failed: %s" __FUNCTION__ (Printexc. to_string exn ) ;
216
219
fail VM_CDR_eject
217
220
@@ -281,7 +284,13 @@ let sysprep ~__context ~vm ~unattend ~timeout =
281
284
let uuid = Db.VDI. get_uuid ~__context ~self: vdi in
282
285
debug " %s: inserting Sysprep VDI for VM %s" __FUNCTION__ vm_uuid ;
283
286
call ~__context @@ fun rpc session_id ->
284
- Client.VBD. insert ~rpc ~session_id ~vdi ~vbd ;
287
+ ( try Client.VBD. insert ~rpc ~session_id ~vdi ~vbd
288
+ with e ->
289
+ debug " %s: failed to insert CD, removing ISO %s: %s" __FUNCTION__ iso
290
+ (Printexc. to_string e) ;
291
+ Sys. remove iso ;
292
+ fail VM_CDR_insert
293
+ ) ;
285
294
Thread. delay ! Xapi_globs. vm_sysprep_wait ;
286
295
match trigger ~rpc ~session_id ~domid ~uuid ~timeout ~vbd ~iso with
287
296
| true ->
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ type error =
18
18
| Other of string
19
19
| VM_CDR_not_found
20
20
| VM_CDR_eject
21
+ | VM_CDR_insert
21
22
| VM_misses_feature
22
23
| VM_not_running
23
24
| VM_sysprep_timeout
Original file line number Diff line number Diff line change @@ -1727,10 +1727,13 @@ let sysprep ~__context ~self ~unattend ~timeout =
1727
1727
raise Api_errors. (Server_error (sysprep, [uuid; " VM is not running" ]))
1728
1728
| exception Vm_sysprep. Sysprep VM_CDR_eject ->
1729
1729
raise Api_errors. (Server_error (sysprep, [uuid; " VM failed to eject CD" ]))
1730
+ | exception Vm_sysprep. Sysprep VM_CDR_insert ->
1731
+ raise Api_errors. (Server_error (sysprep, [uuid; " VM failed to insert CD" ]))
1730
1732
| exception Vm_sysprep. Sysprep VM_sysprep_timeout ->
1731
1733
raise
1732
1734
Api_errors. (
1733
- Server_error (sysprep, [uuid; " sysprep not found running - timeout" ])
1735
+ Server_error
1736
+ (sysprep, [uuid; " No response from sysprep within allocated time" ])
1734
1737
)
1735
1738
| exception Vm_sysprep. Sysprep XML_too_large ->
1736
1739
raise
You can’t perform that action at this time.
0 commit comments