Skip to content

Commit 55bb5ae

Browse files
committed
CA-429144: Do not leak new vbds after snapshot
Disks without snapshot are left unattached after the revert is complete. This is right but the vbds should be removed. Signed-off-by: Changlei Li <changlei.li@citrix.com> (cherry picked from commit 3a1d714)
1 parent a101e3b commit 55bb5ae

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

ocaml/xapi/xapi_vm_snapshot.ml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,17 @@ let revert_vbds ~__context ~rpc ~session_id ~snapshot ~vm =
288288
VDISet.map get_snapshot_of snap_disks_reverted
289289
in
290290

291+
let vm_disks_without_snapshot =
292+
let ( --- ) = VDISet.diff in
293+
vm_disks_all --- snap_disks_snapshot_of
294+
in
295+
291296
let vm_disks_to_be_destroyed =
292297
let ( --- ) = VDISet.diff in
293298
let ( +++ ) = VDISet.union in
294299

295-
(* Disks without snapshot are left unattached after the revert is complete. *)
296-
let vm_disks_without_snapshot = vm_disks_all --- snap_disks_snapshot_of in
297-
298300
vm_disks_all
301+
(* Disks without snapshot are left unattached after the revert is complete. *)
299302
--- vm_disks_without_snapshot
300303
--- vm_disks_already_reverted
301304
+++ vm_suspend_VDI
@@ -310,7 +313,9 @@ let revert_vbds ~__context ~rpc ~session_id ~snapshot ~vm =
310313

311314
let vm_vbds_to_be_destroyed =
312315
let ( +++ ) = VBDSet.union in
313-
filter_vbds_from_vdis vm_VBDs_all vm_disks_to_be_destroyed +++ vm_VBDs_CD
316+
filter_vbds_from_vdis vm_VBDs_all vm_disks_to_be_destroyed
317+
+++ filter_vbds_from_vdis vm_VBDs_all vm_disks_without_snapshot
318+
+++ vm_VBDs_CD
314319
in
315320

316321
let snap_VBDs_reverted =

0 commit comments

Comments
 (0)