Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

virtcontainers: Add missing API trace calls #825

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions virtcontainers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ func CreateContainer(ctx context.Context, sandboxID string, containerConfig Cont
// DeleteContainer deletes a Container from a Sandbox. If the container is running,
// it needs to be stopped first.
func DeleteContainer(ctx context.Context, sandboxID, containerID string) (VCContainer, error) {
span, ctx := trace(ctx, "DeleteContainer")
defer span.Finish()

if sandboxID == "" {
return nil, errNeedSandboxID
}
Expand All @@ -443,6 +446,9 @@ func DeleteContainer(ctx context.Context, sandboxID, containerID string) (VCCont
// StartContainer is the virtcontainers container starting entry point.
// StartContainer starts an already created container.
func StartContainer(ctx context.Context, sandboxID, containerID string) (VCContainer, error) {
span, ctx := trace(ctx, "StartContainer")
defer span.Finish()

if sandboxID == "" {
return nil, errNeedSandboxID
}
Expand Down Expand Up @@ -840,6 +846,9 @@ func ResumeContainer(ctx context.Context, sandboxID, containerID string) error {

// AddDevice will add a device to sandbox
func AddDevice(ctx context.Context, sandboxID string, info deviceConfig.DeviceInfo) (deviceApi.Device, error) {
span, ctx := trace(ctx, "AddDevice")
defer span.Finish()

if sandboxID == "" {
return nil, errNeedSandboxID
}
Expand Down Expand Up @@ -882,16 +891,25 @@ func toggleInterface(ctx context.Context, sandboxID string, inf *grpc.Interface,

// AddInterface is the virtcontainers add interface entry point.
func AddInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) {
span, ctx := trace(ctx, "AddInterface")
defer span.Finish()

return toggleInterface(ctx, sandboxID, inf, true)
}

// RemoveInterface is the virtcontainers remove interface entry point.
func RemoveInterface(ctx context.Context, sandboxID string, inf *grpc.Interface) (*grpc.Interface, error) {
span, ctx := trace(ctx, "RemoveInterface")
defer span.Finish()

return toggleInterface(ctx, sandboxID, inf, false)
}

// ListInterfaces is the virtcontainers list interfaces entry point.
func ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, error) {
span, ctx := trace(ctx, "ListInterfaces")
defer span.Finish()

if sandboxID == "" {
return nil, errNeedSandboxID
}
Expand All @@ -912,6 +930,9 @@ func ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, e

// UpdateRoutes is the virtcontainers update routes entry point.
func UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) ([]*grpc.Route, error) {
span, ctx := trace(ctx, "UpdateRoutes")
defer span.Finish()

if sandboxID == "" {
return nil, errNeedSandboxID
}
Expand All @@ -931,6 +952,9 @@ func UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) (

// ListRoutes is the virtcontainers list routes entry point.
func ListRoutes(ctx context.Context, sandboxID string) ([]*grpc.Route, error) {
span, ctx := trace(ctx, "ListRoutes")
defer span.Finish()

if sandboxID == "" {
return nil, errNeedSandboxID
}
Expand Down