Skip to content

Commit 6eba561

Browse files
committed
Use just the VBD id for attached_vdis key instead of the VM, VBD tuple
The VM id is unnecessary in the attached_vdis key as the DB is already indexed by the VM id. This also prevents problems when the VM is renamed. Signed-off-by: Steven Woods <[email protected]>
1 parent d27a118 commit 6eba561

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ocaml/xenopsd/xc/xenops_server_xen.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ module VmExtra = struct
187187
; pv_drivers_detected: bool [@default false]
188188
; xen_platform: (int * int) option (* (device_id, revision) for QEMU *)
189189
; platformdata: (string * string) list [@default []]
190-
; attached_vdis: (Vbd.id * attached_vdi) list [@default []]
190+
; attached_vdis: (string * attached_vdi) list [@default []]
191191
}
192192
[@@deriving rpcty]
193193

@@ -3718,8 +3718,8 @@ module VBD = struct
37183718
{
37193719
vm_t.VmExtra.persistent with
37203720
attached_vdis=
3721-
(vbd.Vbd.id, vdi)
3722-
:: List.remove_assoc vbd.Vbd.id
3721+
(id_of vbd, vdi)
3722+
:: List.remove_assoc (id_of vbd)
37233723
vm_t.persistent.attached_vdis
37243724
}
37253725
}
@@ -3741,7 +3741,7 @@ module VBD = struct
37413741

37423742
let activate task vm vbd =
37433743
let vmextra = DB.read_exn vm in
3744-
match List.assoc_opt vbd.id vmextra.persistent.attached_vdis with
3744+
match List.assoc_opt (id_of vbd) vmextra.persistent.attached_vdis with
37453745
| None ->
37463746
debug "No attached_vdi info, so not activating"
37473747
| Some vdi ->
@@ -3892,7 +3892,7 @@ module VBD = struct
38923892
)
38933893
vm
38943894
)
3895-
(fun () -> cleanup_attached_vdis vm vbd.id)
3895+
(fun () -> cleanup_attached_vdis vm (id_of vbd))
38963896

38973897
let deactivate task vm vbd force =
38983898
with_xc_and_xs (fun xc xs ->
@@ -4056,7 +4056,7 @@ module VBD = struct
40564056
| _ ->
40574057
()
40584058
) ;
4059-
cleanup_attached_vdis vm vbd.id
4059+
cleanup_attached_vdis vm (id_of vbd)
40604060

40614061
let insert task vm vbd d =
40624062
on_frontend

0 commit comments

Comments
 (0)