Skip to content

Commit b2f572d

Browse files
authored
XSI-1969 more thorough resource cleanup (#6682)
In XSI-1969 we deal with an inconsistent Xapi DB and fail to recognise a PCI as SRIOV. Be more lenient and recognise stale PCI refs as SRIOV. Also remove a VM from a VGPU explictly on resouce cleanup.
2 parents 209d950 + fabb45e commit b2f572d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ocaml/xapi/xapi_vm_lifecycle.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ let nvidia_sriov_pcis ~__context vgpus =
420420
Db.VGPU_type.get_implementation ~__context ~self:typ |> function
421421
| `nvidia_sriov ->
422422
let pci = Db.VGPU.get_PCI ~__context ~self:vgpu in
423-
if Db.is_valid_ref __context pci then Some pci else None
423+
Some pci
424424
| _ ->
425425
None
426426
)
@@ -925,7 +925,8 @@ let force_state_reset_keep_current_operations ~__context ~self ~value:state =
925925
Db.VGPU.set_resident_on ~__context ~self:vgpu ~value:Ref.null ;
926926
Db.VGPU.set_scheduled_to_be_resident_on ~__context ~self:vgpu
927927
~value:Ref.null ;
928-
Db.VGPU.set_PCI ~__context ~self:vgpu ~value:Ref.null
928+
Db.VGPU.set_PCI ~__context ~self:vgpu ~value:Ref.null ;
929+
Db.VGPU.set_VM ~__context ~self:vgpu ~value:Ref.null
929930
) ;
930931
Db.VM.get_attached_PCIs ~__context ~self
931932
|> List.iter (fun pci ->

0 commit comments

Comments
 (0)