Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Valeriy Khorunzhin <[email protected]>
  • Loading branch information
Valeriy Khorunzhin committed Jan 14, 2025
1 parent f77268a commit 55e632e
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (ds HTTPDataSource) StoreToPVC(ctx context.Context, vi *virtv2.VirtualImage

var quotaNotExceededCondition *cdiv1.DataVolumeCondition
if dv != nil {
quotaNotExceededCondition = getDVNotExceededCondition(dv.Status.Conditions)
quotaNotExceededCondition = service.GetDataVolumeCondition(DVQoutaNotExceededConditionType, dv.Status.Conditions)
}

switch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (ds ObjectRefDataSource) StoreToPVC(ctx context.Context, vi *virtv2.Virtual

var quotaNotExceededCondition *cdiv1.DataVolumeCondition
if dv != nil {
quotaNotExceededCondition = getDVNotExceededCondition(dv.Status.Conditions)
quotaNotExceededCondition = service.GetDataVolumeCondition(DVQoutaNotExceededConditionType, dv.Status.Conditions)
}

switch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (ds ObjectRefVirtualDisk) StoreToPVC(ctx context.Context, vi *virtv2.Virtua

var quotaNotExceededCondition *cdiv1.DataVolumeCondition
if dv != nil {
quotaNotExceededCondition = getDVNotExceededCondition(dv.Status.Conditions)
quotaNotExceededCondition = service.GetDataVolumeCondition(DVQoutaNotExceededConditionType, dv.Status.Conditions)
}

switch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (ds ObjectRefDataVirtualImageOnPVC) StoreToPVC(ctx context.Context, vi, viR

var quotaNotExceededCondition *cdiv1.DataVolumeCondition
if dv != nil {
quotaNotExceededCondition = getDVNotExceededCondition(dv.Status.Conditions)
quotaNotExceededCondition = service.GetDataVolumeCondition(DVQoutaNotExceededConditionType, dv.Status.Conditions)
}

switch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (ds RegistryDataSource) StoreToPVC(ctx context.Context, vi *virtv2.VirtualI

var quotaNotExceededCondition *cdiv1.DataVolumeCondition
if dv != nil {
quotaNotExceededCondition = getDVNotExceededCondition(dv.Status.Conditions)
quotaNotExceededCondition = service.GetDataVolumeCondition(DVQoutaNotExceededConditionType, dv.Status.Conditions)
}

switch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,5 @@ func setQuotaExceededPhaseCondition(cb *conditions.ConditionBuilder, phase *virt
}

const (
DVQoutaNotExceededConditionType string = "QuotaNotExceeded"
DVQoutaNotExceededConditionType cdiv1.DataVolumeConditionType = "QuotaNotExceeded"
)

func getDVNotExceededCondition(conditions []cdiv1.DataVolumeCondition) *cdiv1.DataVolumeCondition {
for _, condition := range conditions {
if string(condition.Type) == DVQoutaNotExceededConditionType {
return &condition
}
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (ds UploadDataSource) StoreToPVC(ctx context.Context, vi *virtv2.VirtualIma

var quotaNotExceededCondition *cdiv1.DataVolumeCondition
if dv != nil {
quotaNotExceededCondition = getDVNotExceededCondition(dv.Status.Conditions)
quotaNotExceededCondition = service.GetDataVolumeCondition(DVQoutaNotExceededConditionType, dv.Status.Conditions)
}

switch {
Expand Down

0 comments on commit 55e632e

Please sign in to comment.