Skip to content

Commit

Permalink
fix inuse.go
Browse files Browse the repository at this point in the history
Signed-off-by: dmitry.lopatin <[email protected]>
  • Loading branch information
LopatinDmitr committed Oct 20, 2024
1 parent fb9070d commit fd3ee61
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,17 @@ func (h InUseHandler) Handle(ctx context.Context, vd *virtv2.VirtualDisk) (recon
}
}

if inUseInRunningVirtualMachine && inUseCondition.Status != metav1.ConditionTrue {
if inUseCondition.Status != metav1.ConditionTrue && inUseInRunningVirtualMachine && !inUseForCreateImage {
inUseCondition.Status = metav1.ConditionTrue
inUseCondition.Reason = vdcondition.InUseInRunningVirtualMachine
} else if inUseCondition.Reason == vdcondition.InUseInRunningVirtualMachine {
inUseCondition.Status = metav1.ConditionFalse
inUseCondition.Reason = vdcondition.NotInUse
}

if inUseForCreateImage && inUseCondition.Status != metav1.ConditionTrue {
if inUseCondition.Status != metav1.ConditionTrue && inUseForCreateImage && !inUseInRunningVirtualMachine {
inUseCondition.Status = metav1.ConditionTrue
inUseCondition.Reason = vdcondition.InUseForCreateImage
} else if inUseCondition.Reason == vdcondition.InUseForCreateImage {
}

if !inUseInRunningVirtualMachine && !inUseForCreateImage {
inUseCondition.Status = metav1.ConditionFalse
inUseCondition.Reason = vdcondition.NotInUse
}
Expand Down

0 comments on commit fd3ee61

Please sign in to comment.