Skip to content

Commit a4c0a29

Browse files
committed
wait for volumes when action is backup
1 parent 9a943f1 commit a4c0a29

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

internal/services/instance/action_server_action.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,19 @@ func (a *ServerAction) Invoke(ctx context.Context, req action.InvokeRequest, res
151151
"error waiting for server"+serverID,
152152
err.Error())
153153
}
154+
155+
if data.Action.ValueString() == instance.ServerActionBackup.String() && server != nil {
156+
for _, volume := range server.Volumes {
157+
_, err := a.instanceAPI.WaitForVolume(&instance.WaitForVolumeRequest{
158+
VolumeID: volume.ID,
159+
Zone: scw.Zone(zone),
160+
}, scw.WithContext(ctx))
161+
if err != nil {
162+
resp.Diagnostics.AddError(
163+
"error waiting for volume "+volume.ID,
164+
err.Error())
165+
}
166+
}
167+
}
154168
}
155169
}

0 commit comments

Comments
 (0)