[VOL-3187]Pass Context down the execution call hierarchy across voltha-go codebase
Change-Id: I6bc2a0f7226c1beed4ae01a15d7b5c4dc04358d8
diff --git a/rw_core/core/device/agent_image.go b/rw_core/core/device/agent_image.go
index 208d817..8d60531 100644
--- a/rw_core/core/device/agent_image.go
+++ b/rw_core/core/device/agent_image.go
@@ -33,7 +33,7 @@
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw("downloadImage", log.Fields{"device-id": agent.deviceID})
+ logger.Debugw(ctx, "downloadImage", log.Fields{"device-id": agent.deviceID})
device := agent.getDeviceWithoutLock()
@@ -48,7 +48,7 @@
cloned.ImageDownloads = []*voltha.ImageDownload{clonedImg}
} else {
if device.AdminState != voltha.AdminState_ENABLED {
- logger.Debugw("device-not-enabled", log.Fields{"id": agent.deviceID})
+ logger.Debugw(ctx, "device-not-enabled", log.Fields{"id": agent.deviceID})
return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceID, voltha.AdminState_ENABLED)
}
// Save the image
@@ -91,7 +91,7 @@
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw("cancelImageDownload", log.Fields{"device-id": agent.deviceID})
+ logger.Debugw(ctx, "cancelImageDownload", log.Fields{"device-id": agent.deviceID})
device := agent.getDeviceWithoutLock()
@@ -128,7 +128,7 @@
return nil, err
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw("activateImage", log.Fields{"device-id": agent.deviceID})
+ logger.Debugw(ctx, "activateImage", log.Fields{"device-id": agent.deviceID})
cloned := agent.getDeviceWithoutLock()
// Verify whether the Image is in the list of image being downloaded
@@ -168,7 +168,7 @@
return nil, err
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw("revertImage", log.Fields{"device-id": agent.deviceID})
+ logger.Debugw(ctx, "revertImage", log.Fields{"device-id": agent.deviceID})
cloned := agent.getDeviceWithoutLock()
@@ -203,7 +203,7 @@
}
func (agent *Agent) getImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
- logger.Debugw("getImageDownloadStatus", log.Fields{"device-id": agent.deviceID})
+ logger.Debugw(ctx, "getImageDownloadStatus", log.Fields{"device-id": agent.deviceID})
if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
return nil, err
@@ -235,7 +235,7 @@
return err
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw("updating-image-download", log.Fields{"device-id": agent.deviceID, "img": img})
+ logger.Debugw(ctx, "updating-image-download", log.Fields{"device-id": agent.deviceID, "img": img})
cloned := agent.getDeviceWithoutLock()
@@ -263,7 +263,7 @@
return nil, err
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw("getImageDownload", log.Fields{"device-id": agent.deviceID})
+ logger.Debugw(ctx, "getImageDownload", log.Fields{"device-id": agent.deviceID})
cloned := agent.getDeviceWithoutLock()
for _, image := range cloned.ImageDownloads {
@@ -279,7 +279,7 @@
return nil, err
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw("listImageDownloads", log.Fields{"device-id": agent.deviceID})
+ logger.Debugw(ctx, "listImageDownloads", log.Fields{"device-id": agent.deviceID})
return &voltha.ImageDownloads{Items: agent.getDeviceWithoutLock().ImageDownloads}, nil
}