Skip to content

Commit

Permalink
Merge pull request #1100 from himanshuvar/master
Browse files Browse the repository at this point in the history
[AWS Block Support] Update AWS Volume Size to take inputs as bytes
  • Loading branch information
kumarashit authored Sep 21, 2020
2 parents 3d37481 + 8e8430a commit 178f9ac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contrib/datastore/block/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (ad *AwsAdapter) ParseVolume(volumeAWS *awsec2.Volume) (*block.Volume, erro
}

volume := &block.Volume{
Size: *volumeAWS.Size,
Size: *volumeAWS.Size * utils.GB_FACTOR,
Encrypted: *volumeAWS.Encrypted,
Status: *volumeAWS.State,
SnapshotId: *volumeAWS.SnapshotId,
Expand Down Expand Up @@ -102,7 +102,7 @@ func (ad *AwsAdapter) ParseUpdatedVolume(volumeAWS *awsec2.VolumeModification) (
}

volume := &block.Volume{
Size: *volumeAWS.TargetSize,
Size: *volumeAWS.TargetSize * utils.GB_FACTOR,
Status: *volumeAWS.ModificationState,
Iops: *volumeAWS.TargetIops,
Type: *volumeAWS.TargetVolumeType,
Expand Down Expand Up @@ -149,7 +149,7 @@ func (ad *AwsAdapter) CreateVolume(ctx context.Context, volume *block.CreateVolu

input := &awsec2.CreateVolumeInput{
AvailabilityZone: aws.String(volume.Volume.AvailabilityZone),
Size: aws.Int64(volume.Volume.Size),
Size: aws.Int64(volume.Volume.Size / utils.GB_FACTOR),
VolumeType: aws.String(volume.Volume.Type),
TagSpecifications: []*awsec2.TagSpecification{tagList},
Encrypted: aws.Bool(volume.Volume.Encrypted),
Expand Down Expand Up @@ -308,7 +308,7 @@ func (ad *AwsAdapter) UpdateVolume(ctx context.Context, in *block.UpdateVolumeRe
if in.Volume.Type != "" {
input := &awsec2.ModifyVolumeInput{
VolumeId: aws.String(in.Volume.Metadata.Fields[VolumeId].GetStringValue()),
Size: aws.Int64(in.Volume.Size),
Size: aws.Int64(in.Volume.Size / utils.GB_FACTOR),
VolumeType: aws.String(in.Volume.Type),
Iops: aws.Int64(in.Volume.Iops),
}
Expand Down

0 comments on commit 178f9ac

Please sign in to comment.