Skip to content

Commit

Permalink
rename DataVolume to DataVolumeWrapper
Browse files Browse the repository at this point in the history
Make it slightly less confusing

Signed-off-by: Benny Zlotnik <[email protected]>
  • Loading branch information
bennyz committed Aug 13, 2023
1 parent b24805f commit c2178e5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (r *KubeVirt) ListVMs() ([]VirtualMachine, error) {
}
vm.DataVolumes = append(
vm.DataVolumes,
DataVolume{
DataVolumeWrapper{
DataVolume: dv,
PVC: pvc,
})
Expand Down Expand Up @@ -537,7 +537,7 @@ func (r *KubeVirt) isDataVolumeExistsInList(dv *cdi.DataVolume, dataVolumeList *
}

// Return DataVolumes associated with a VM.
func (r *KubeVirt) getDVs(vm *plan.VMStatus) (dvs []DataVolume, err error) {
func (r *KubeVirt) getDVs(vm *plan.VMStatus) (dvs []DataVolumeWrapper, err error) {
dvsList := &cdi.DataVolumeList{}
err = r.Destination.Client.List(
context.TODO(),
Expand All @@ -552,10 +552,10 @@ func (r *KubeVirt) getDVs(vm *plan.VMStatus) (dvs []DataVolume, err error) {
return
}

dvs = []DataVolume{}
dvs = []DataVolumeWrapper{}
for i := range dvsList.Items {
dv := &dvsList.Items[i]
dvs = append(dvs, DataVolume{
dvs = append(dvs, DataVolumeWrapper{
DataVolume: dv,
})
}
Expand Down Expand Up @@ -1687,13 +1687,13 @@ func (r *KubeVirt) vmAllButMigrationLabels(vmRef ref.Ref) (labels map[string]str
}

// Represents a CDI DataVolume and add behavior.
type DataVolume struct {
type DataVolumeWrapper struct {
*cdi.DataVolume
PVC *core.PersistentVolumeClaim
}

// Get conditions.
func (r *DataVolume) Conditions() (cnd *libcnd.Conditions) {
func (r *DataVolumeWrapper) Conditions() (cnd *libcnd.Conditions) {
cnd = &libcnd.Conditions{}
for _, c := range r.Status.Conditions {
cnd.SetCondition(libcnd.Condition{
Expand All @@ -1710,7 +1710,7 @@ func (r *DataVolume) Conditions() (cnd *libcnd.Conditions) {

// Convert the Status.Progress into a
// percentage (float).
func (r *DataVolume) PercentComplete() (pct float64) {
func (r *DataVolumeWrapper) PercentComplete() (pct float64) {
s := string(r.Status.Progress)
if strings.HasSuffix(s, "%") {
s = s[:len(s)-1]
Expand All @@ -1726,7 +1726,7 @@ func (r *DataVolume) PercentComplete() (pct float64) {
// Represents Kubevirt VirtualMachine with associated DataVolumes.
type VirtualMachine struct {
*cnv.VirtualMachine
DataVolumes []DataVolume
DataVolumes []DataVolumeWrapper
}

// Determine if `this` VirtualMachine is the
Expand Down

0 comments on commit c2178e5

Please sign in to comment.