@@ -772,9 +772,13 @@ func (c *cloud) CreateDisk(ctx context.Context, volumeName string, diskOptions *
772772 return nil , errors .New ("disk size was not returned by CreateVolume" )
773773 }
774774
775- if err := c .waitForVolume (ctx , volumeID ); err != nil {
775+ volume , err := c .waitForVolume (ctx , volumeID )
776+ if err != nil {
776777 return nil , fmt .Errorf ("timed out waiting for volume to create: %w" , err )
777778 }
779+
780+ klog .V (7 ).InfoS ("CreateDisk: volume created successfully" , "volumeName" , volumeName , "volume" , volume )
781+
778782 return & Disk {CapacityGiB : size , VolumeID : volumeID , AvailabilityZone : zone , SnapshotID : diskOptions .SnapshotID , SourceVolumeID : diskOptions .SourceVolumeID , OutpostArn : outpostArn }, nil
779783}
780784
@@ -2107,25 +2111,29 @@ func (c *cloud) listSnapshots(ctx context.Context, request *ec2.DescribeSnapshot
21072111}
21082112
21092113// waitForVolume waits for volume to be in the "available" state.
2110- func (c * cloud ) waitForVolume (ctx context.Context , volumeID string ) error {
2114+ func (c * cloud ) waitForVolume (ctx context.Context , volumeID string ) ( * types. Volume , error ) {
21112115 time .Sleep (c .vwp .creationInitialDelay )
21122116
21132117 request := & ec2.DescribeVolumesInput {
21142118 VolumeIds : []string {volumeID },
21152119 }
21162120
2121+ var volume * types.Volume
21172122 err := wait .ExponentialBackoffWithContext (ctx , c .vwp .creationBackoff , func (ctx context.Context ) (done bool , err error ) {
21182123 vol , err := c .getVolume (ctx , request )
21192124 if err != nil {
21202125 return true , err
21212126 }
21222127 if vol .State != "" {
2123- return vol .State == types .VolumeStateAvailable , nil
2128+ if vol .State == types .VolumeStateAvailable {
2129+ volume = vol
2130+ return true , nil
2131+ }
21242132 }
21252133 return false , nil
21262134 })
21272135
2128- return err
2136+ return volume , err
21292137}
21302138
21312139// getAccountID returns the account ID of the AWS Account for the IAM credentials in use.
0 commit comments