Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion ocaml/xapi/xapi_vdi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,21 @@ let pool_introduce = internal_db_introduce
let db_introduce = internal_db_introduce

let db_forget ~__context ~vdi =
debug "db_forget uuid=%s" (Db.VDI.get_uuid ~__context ~self:vdi) ;
debug "db_forget uuid=%s ref=%s"
(Db.VDI.get_uuid ~__context ~self:vdi)
(Ref.string_of vdi) ;
(* CA-419840 mark VBD as empty when it is a CDR *)
( Db.VDI.get_VBDs ~__context ~self:vdi |> function
| [] ->
() (* should not happen *)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn’t this be logged as a warning so we can catch it if it happens and inspect the situation? Or we can safely ignore it if it happens so a comment is fine ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In other places we are using fst; I don't expect a VDI not ever having anything but one VBD. But yeah, I could add a warning..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's do that on the original PR, though. This one has problems with the CI, too.

| self :: _ when self = Ref.null ->
() (* should not happen *)
| self :: _ when Db.VBD.get_type ~__context ~self = `CD ->
Db.VBD.set_VDI ~__context ~self ~value:Ref.null ;
Db.VBD.set_empty ~__context ~self ~value:true
| _ ->
() (* not a CDR *)
) ;
Db.VDI.destroy ~__context ~self:vdi

let introduce ~__context ~uuid ~name_label ~name_description ~sR ~_type
Expand Down
Loading