Conversation
Skipping CI for Draft Pull Request. |
/test all |
d2922ef
to
f1e2301
Compare
1bae132
to
7c8e173
Compare
/test all |
5095cc1
to
661f1c3
Compare
pkg/providers/ovirt/mapper/mapper.go
Outdated
@@ -261,6 +301,7 @@ func (o *OvirtMapper) MapDataVolumes(targetVMName *string) (map[string]cdiv1.Dat | |||
} | |||
quantity, _ := resource.ParseQuantity(diskSizeConverted) | |||
accessMode := o.getAccessMode(diskAttachment) | |||
volumeMode := o.getVolumeMode(disk, o.mappings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To detect the volume mode we're iterating over the same mappings slice for the second time (first - for the storage class in getStorageClassForDisk
). In both cases we should get exactly the same mapping instance as a base for retrieving both storage class and volume mode. What do you think about finding the mapping first and than passing it to getVolumeMode
and getStorageClassForDisk
to extract the needed parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thanks.
@@ -38,16 +38,62 @@ func extractMappings(externalMappingSpec *v2vv1alpha1.ResourceMappingSpec, crMap | |||
return &primaryMappings, &secondaryMappings | |||
} | |||
|
|||
func mergeMappings(primaryMappings *[]v2vv1alpha1.ResourceMappingItem, secondaryMappings *[]v2vv1alpha1.ResourceMappingItem) *[]v2vv1alpha1.ResourceMappingItem { | |||
var mapping []v2vv1alpha1.ResourceMappingItem | |||
func mergeNetworkMappings(primaryMappings *[]v2vv1alpha1.NetworkResourceMappingItem, secondaryMappings *[]v2vv1alpha1.NetworkResourceMappingItem) *[]v2vv1alpha1.NetworkResourceMappingItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer both mergeNetworkMappings
and mergeStorageMappings
to use the same common code, but without common interface or generics it's unlikely that it can be done cleanly. Definitely a good candidate for trying them when they're finally supported.;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was trying to solve it with reflection, but it was even worse IMHO, so I left the code duplication.
661f1c3
to
d09ea3a
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jakub-dzon, machacekondra, pkliczewski The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@machacekondra I see 2 conflicting files. Would you mind to rebase? |
Signed-off-by: Ondra Machacek <omachace@redhat.com>
d09ea3a
to
6e7bf11
Compare
Done. |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1857926
Signed-off-by: Ondra Machacek omachace@redhat.com