in sharedlibraries/gce/gce.go [332:351]
func (g *GCE) waitForDiskOpCompletion(ctx context.Context, op *compute.Operation, project, dataDiskZone string) error {
zos := compute.NewZoneOperationsService(g.service)
tracker, err := zos.Wait(project, dataDiskZone, op.Name).Do()
if err != nil {
return err
}
log.CtxLogger(ctx).Infow("Operation in progress", "Name", op.Name, "percentage", tracker.Progress, "status", tracker.Status)
if tracker.Status != "DONE" {
return fmt.Errorf("compute operation is not DONE yet")
}
if tracker.Error != nil {
log.CtxLogger(ctx).Errorw("Error in operation", "operation", op.Name, "error", tracker.Error)
return fmt.Errorf("compute operation failed with error: %v", tracker.Error)
}
if tracker.HttpErrorMessage != "" {
log.CtxLogger(ctx).Errorw("Error in operation", "operation", op.Name, "errorStatusCode", tracker.HttpErrorStatusCode, "error", tracker.HttpErrorMessage)
return fmt.Errorf("compute operation failed with error: %v", tracker.HttpErrorMessage)
}
return nil
}