Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix osc sdk go v2 migration and pointers #115

Merged
merged 2 commits into from
Mar 22, 2023
Merged

fix osc sdk go v2 migration and pointers #115

merged 2 commits into from
Mar 22, 2023

Conversation

outscale-hmi
Copy link
Contributor

No description provided.

@@ -114,12 +114,15 @@ func buildOscBlockDevicesVmCreation(b []BlockDevice) []oscgo.BlockDeviceMappingV
}

if blockDevice.SnapshotId != "" {
log.Printf("snapshotId is nt nul ")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo "not"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@outscale-mdr outscale-mdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to clarify how we deal with pointers

.golangci.yml Show resolved Hide resolved
Comment on lines 133 to 134
*device.Bsu.Iops = 0
device.Bsu.SetIops(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not an iops, do not set IOPS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would set nil pointer to the Iops variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -146,16 +147,21 @@ func (s *StepRegisterOMI) combineDevices(snapshotIDs map[string]string) []oscgo.
}

func copyToDeviceMappingImage(device osc.BlockDeviceMappingVmCreation) oscgo.BlockDeviceMappingImage {
log.Printf("Copydevice mapping image ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "Copy device"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 154 to 155
Iops: device.Bsu.Iops,
SnapshotId: device.Bsu.SnapshotId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the previous code was the right thing to do. Just copy what you have. The big problem here is that device contains invalid data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 160 to 165
if device.Bsu.GetSnapshotId() != "" {
deviceImage.Bsu.SetSnapshotId(*oscgo.PtrString(*device.Bsu.SnapshotId))
}
if device.Bsu.GetIops() != 0 {
deviceImage.Bsu.SetIops(*device.Bsu.Iops)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not do that, just copy the pointer

@@ -114,12 +114,15 @@ func buildOscBlockDevicesVmCreation(b []BlockDevice) []oscgo.BlockDeviceMappingV
}

if blockDevice.SnapshotId != "" {
log.Printf("snapshotId is nt nul ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo "not"

@@ -154,6 +154,7 @@ func (s *StepNetworkInfo) Run(_ context.Context, state multistep.StateBag) multi
}
}

ui.Message(fmt.Sprintf("NetId is null '%s'", s.NetId))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure about that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 126 to 128
log.Printf("subregion is %s", subregion)
if subregion != "" {
log.Printf("placement subregion is %s", subregion)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate log, you can remove one of them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Signed-off-by: outscale_hmi <hanen.mizouni@outscale.com>
Signed-off-by: outscale_hmi <hanen.mizouni@outscale.com>
@outscale-hmi outscale-hmi merged commit 8b53eab into main Mar 22, 2023
@outscale-hmi outscale-hmi deleted the fixNetId branch March 22, 2023 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants