Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CLEARWATER: CA-92553: Thoroughly clear PCI attachments for stopped VMs #1079

Merged
merged 1 commit into from

2 participants

@robhoes
Owner

This should not be necessary if many-to-many relations in the DB
work properly. People have reported issues that may indicate that this is
not the case, but we have not yet found the root cause. Therefore, this
code is added "just to be sure".

Duplicate of #1073 for clearwater.

@robhoes robhoes CA-92553: Thoroughly clear PCI attachments for stopped VMs
This should not be necessary if many-to-many relations in the DB
work properly. People have reported issues that may indicate that this is
not the case, but we have not yet found the root cause. Therefore, this
code is added "just to be sure".

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
3c4e513
@malcolmcrossley
Collaborator

Hi Rob, Sorry about the delay but I was trying to keep the clearwater-ring3 branch clean whilst trying to get the "clearwater-trunk-merge" branch in.

Can you rebase this pull request onto of the current clearwater branch please?

@malcolmcrossley malcolmcrossley merged commit fc7b5e8 into from
@robhoes robhoes deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 15, 2013
  1. @robhoes

    CA-92553: Thoroughly clear PCI attachments for stopped VMs

    robhoes authored
    This should not be necessary if many-to-many relations in the DB
    work properly. People have reported issues that may indicate that this is
    not the case, but we have not yet found the root cause. Therefore, this
    code is added "just to be sure".
    
    Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 0 deletions.
  1. +11 −0 ocaml/xapi/xapi_vm_lifecycle.ml
View
11 ocaml/xapi/xapi_vm_lifecycle.ml
@@ -415,6 +415,17 @@ let force_state_reset ~__context ~self ~value:state =
(fun pci ->
Db.PCI.remove_attached_VMs ~__context ~self:pci ~value:self)
(Db.VM.get_attached_PCIs ~__context ~self);
+ (* The following should not be necessary if many-to-many relations in the DB
+ * work properly. People have reported issues that may indicate that this is
+ * not the case, but we have not yet found the root cause. Therefore, the
+ * following code is there "just to be sure".
+ *)
+ List.iter
+ (fun pci ->
+ if List.mem self (Db.PCI.get_attached_VMs ~__context ~self:pci) then
+ Db.PCI.remove_attached_VMs ~__context ~self:pci ~value:self
+ )
+ (Db.PCI.get_all ~__context);
end;
if state = `Halted || state = `Suspended then begin
Something went wrong with that request. Please try again.