Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Jan 20, 2025
1 parent c38d7f0 commit 811d7f0
Showing 1 changed file with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,25 +196,10 @@ func (s AttachmentService) UnplugDisk(ctx context.Context, kvvm *virtv1.VirtualM
// T1: -->VMBDA A Should be Non-Conflicted lexicographically
// T1: VMBDA B Phase: ""
func (s AttachmentService) IsConflictedAttachment(ctx context.Context, vmbda *virtv2.VirtualMachineBlockDeviceAttachment) (bool, string, error) {
// CVI always has no conflicts. Skip
if vmbda.Spec.BlockDeviceRef.Kind == virtv2.ClusterVirtualImageKind {
// CVI and VI always has no conflicts. Skip
if vmbda.Spec.BlockDeviceRef.Kind == virtv2.ClusterVirtualImageKind || vmbda.Spec.BlockDeviceRef.Kind == virtv2.VirtualImageKind {
return false, "", nil
}
// VI has conflicts only storage on PVC. Skip for ContainerRegistry
if vmbda.Spec.BlockDeviceRef.Kind == virtv2.VirtualImageKind {
vi, err := object.FetchObject(ctx, types.NamespacedName{
Name: vmbda.Spec.BlockDeviceRef.Name,
Namespace: vmbda.Namespace,
},
s.client, &virtv2.VirtualImage{},
)
if err != nil {
return false, "", err
}
if vi == nil || vi.Spec.Storage == virtv2.StorageContainerRegistry {
return false, "", nil
}
}

var vmbdas virtv2.VirtualMachineBlockDeviceAttachmentList
err := s.client.List(ctx, &vmbdas, &client.ListOptions{Namespace: vmbda.Namespace})
Expand Down

0 comments on commit 811d7f0

Please sign in to comment.