Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/hcs: hcsshim -> hcs in operation name strings #1024

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions internal/hcs/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (process *Process) Signal(ctx context.Context, options interface{}) (bool,
process.handleLock.RLock()
defer process.handleLock.RUnlock()

operation := "hcsshim::Process::Signal"
operation := "hcs::Process::Signal"

if process.handle == 0 {
return false, makeProcessError(process, operation, ErrAlreadyClosed, nil)
Expand All @@ -143,7 +143,7 @@ func (process *Process) Kill(ctx context.Context) (bool, error) {
process.handleLock.RLock()
defer process.handleLock.RUnlock()

operation := "hcsshim::Process::Kill"
operation := "hcs::Process::Kill"

if process.handle == 0 {
return false, makeProcessError(process, operation, ErrAlreadyClosed, nil)
Expand All @@ -164,7 +164,7 @@ func (process *Process) Kill(ctx context.Context) (bool, error) {
// This MUST be called exactly once per `process.handle` but `Wait` is safe to
// call multiple times.
func (process *Process) waitBackground() {
operation := "hcsshim::Process::waitBackground"
operation := "hcs::Process::waitBackground"
ctx, span := trace.StartSpan(context.Background(), operation)
defer span.End()
span.AddAttributes(
Expand Down Expand Up @@ -229,7 +229,7 @@ func (process *Process) ResizeConsole(ctx context.Context, width, height uint16)
process.handleLock.RLock()
defer process.handleLock.RUnlock()

operation := "hcsshim::Process::ResizeConsole"
operation := "hcs::Process::ResizeConsole"

if process.handle == 0 {
return makeProcessError(process, operation, ErrAlreadyClosed, nil)
Expand Down Expand Up @@ -267,15 +267,15 @@ func (process *Process) ExitCode() (int, error) {
}
return process.exitCode, nil
default:
return -1, makeProcessError(process, "hcsshim::Process::ExitCode", ErrInvalidProcessState, nil)
return -1, makeProcessError(process, "hcs::Process::ExitCode", ErrInvalidProcessState, nil)
}
}

// StdioLegacy returns the stdin, stdout, and stderr pipes, respectively. Closing
// these pipes does not close the underlying pipes. Once returned, these pipes
// are the responsibility of the caller to close.
func (process *Process) StdioLegacy() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadCloser, err error) {
operation := "hcsshim::Process::StdioLegacy"
operation := "hcs::Process::StdioLegacy"
ctx, span := trace.StartSpan(context.Background(), operation)
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
Expand Down Expand Up @@ -327,7 +327,7 @@ func (process *Process) CloseStdin(ctx context.Context) error {
process.handleLock.RLock()
defer process.handleLock.RUnlock()

operation := "hcsshim::Process::CloseStdin"
operation := "hcs::Process::CloseStdin"

if process.handle == 0 {
return makeProcessError(process, operation, ErrAlreadyClosed, nil)
Expand Down Expand Up @@ -364,7 +364,7 @@ func (process *Process) CloseStdin(ctx context.Context) error {
// Close cleans up any state associated with the process but does not kill
// or wait on it.
func (process *Process) Close() (err error) {
operation := "hcsshim::Process::Close"
operation := "hcs::Process::Close"
ctx, span := trace.StartSpan(context.Background(), operation)
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
Expand Down
4 changes: 2 additions & 2 deletions internal/hcs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// GetServiceProperties returns properties of the host compute service.
func GetServiceProperties(ctx context.Context, q hcsschema.PropertyQuery) (*hcsschema.ServiceProperties, error) {
operation := "hcsshim::GetServiceProperties"
operation := "hcs::GetServiceProperties"

queryb, err := json.Marshal(q)
if err != nil {
Expand All @@ -34,7 +34,7 @@ func GetServiceProperties(ctx context.Context, q hcsschema.PropertyQuery) (*hcss

// ModifyServiceSettings modifies settings of the host compute service.
func ModifyServiceSettings(ctx context.Context, settings hcsschema.ModificationRequest) error {
operation := "hcsshim::ModifyServiceSettings"
operation := "hcs::ModifyServiceSettings"

settingsJSON, err := json.Marshal(settings)
if err != nil {
Expand Down
32 changes: 16 additions & 16 deletions internal/hcs/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func newSystem(id string) *System {

// CreateComputeSystem creates a new compute system with the given configuration but does not start it.
func CreateComputeSystem(ctx context.Context, id string, hcsDocumentInterface interface{}) (_ *System, err error) {
operation := "hcsshim::CreateComputeSystem"
operation := "hcs::CreateComputeSystem"

// hcsCreateComputeSystemContext is an async operation. Start the outer span
// here to measure the full create time.
Expand Down Expand Up @@ -96,7 +96,7 @@ func CreateComputeSystem(ctx context.Context, id string, hcsDocumentInterface in

// OpenComputeSystem opens an existing compute system by ID.
func OpenComputeSystem(ctx context.Context, id string) (*System, error) {
operation := "hcsshim::OpenComputeSystem"
operation := "hcs::OpenComputeSystem"

computeSystem := newSystem(id)
handle, resultJSON, err := vmcompute.HcsOpenComputeSystem(ctx, id)
Expand Down Expand Up @@ -148,7 +148,7 @@ func (computeSystem *System) IsOCI() bool {

// GetComputeSystems gets a list of the compute systems on the system that match the query
func GetComputeSystems(ctx context.Context, q schema1.ComputeSystemQuery) ([]schema1.ContainerProperties, error) {
operation := "hcsshim::GetComputeSystems"
operation := "hcs::GetComputeSystems"

queryb, err := json.Marshal(q)
if err != nil {
Expand All @@ -174,7 +174,7 @@ func GetComputeSystems(ctx context.Context, q schema1.ComputeSystemQuery) ([]sch

// Start synchronously starts the computeSystem.
func (computeSystem *System) Start(ctx context.Context) (err error) {
operation := "hcsshim::System::Start"
operation := "hcs::System::Start"

// hcsStartComputeSystemContext is an async operation. Start the outer span
// here to measure the full start time.
Expand Down Expand Up @@ -209,7 +209,7 @@ func (computeSystem *System) Shutdown(ctx context.Context) error {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()

operation := "hcsshim::System::Shutdown"
operation := "hcs::System::Shutdown"

if computeSystem.handle == 0 {
return nil
Expand All @@ -230,7 +230,7 @@ func (computeSystem *System) Terminate(ctx context.Context) error {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()

operation := "hcsshim::System::Terminate"
operation := "hcs::System::Terminate"

if computeSystem.handle == 0 {
return nil
Expand All @@ -252,7 +252,7 @@ func (computeSystem *System) Terminate(ctx context.Context) error {
// This MUST be called exactly once per `computeSystem.handle` but `Wait` is
// safe to call multiple times.
func (computeSystem *System) waitBackground() {
operation := "hcsshim::System::waitBackground"
operation := "hcs::System::waitBackground"
ctx, span := trace.StartSpan(context.Background(), operation)
defer span.End()
span.AddAttributes(trace.StringAttribute("cid", computeSystem.id))
Expand Down Expand Up @@ -300,7 +300,7 @@ func (computeSystem *System) Properties(ctx context.Context, types ...schema1.Pr
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()

operation := "hcsshim::System::Properties"
operation := "hcs::System::Properties"

queryBytes, err := json.Marshal(schema1.PropertyQuery{PropertyTypes: types})
if err != nil {
Expand Down Expand Up @@ -329,7 +329,7 @@ func (computeSystem *System) PropertiesV2(ctx context.Context, types ...hcsschem
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()

operation := "hcsshim::System::PropertiesV2"
operation := "hcs::System::PropertiesV2"

queryBytes, err := json.Marshal(hcsschema.PropertyQuery{PropertyTypes: types})
if err != nil {
Expand All @@ -355,7 +355,7 @@ func (computeSystem *System) PropertiesV2(ctx context.Context, types ...hcsschem

// Pause pauses the execution of the computeSystem. This feature is not enabled in TP5.
func (computeSystem *System) Pause(ctx context.Context) (err error) {
operation := "hcsshim::System::Pause"
operation := "hcs::System::Pause"

// hcsPauseComputeSystemContext is an async peration. Start the outer span
// here to measure the full pause time.
Expand All @@ -382,7 +382,7 @@ func (computeSystem *System) Pause(ctx context.Context) (err error) {

// Resume resumes the execution of the computeSystem. This feature is not enabled in TP5.
func (computeSystem *System) Resume(ctx context.Context) (err error) {
operation := "hcsshim::System::Resume"
operation := "hcs::System::Resume"

// hcsResumeComputeSystemContext is an async operation. Start the outer span
// here to measure the full restore time.
Expand All @@ -409,7 +409,7 @@ func (computeSystem *System) Resume(ctx context.Context) (err error) {

// Save the compute system
func (computeSystem *System) Save(ctx context.Context, options interface{}) (err error) {
operation := "hcsshim::System::Save"
operation := "hcs::System::Save"

// hcsSaveComputeSystemContext is an async peration. Start the outer span
// here to measure the full save time.
Expand Down Expand Up @@ -465,7 +465,7 @@ func (computeSystem *System) createProcess(ctx context.Context, operation string

// CreateProcess launches a new process within the computeSystem.
func (computeSystem *System) CreateProcess(ctx context.Context, c interface{}) (cow.Process, error) {
operation := "hcsshim::System::CreateProcess"
operation := "hcs::System::CreateProcess"
process, processInfo, err := computeSystem.createProcess(ctx, operation, c)
if err != nil {
return nil, err
Expand Down Expand Up @@ -498,7 +498,7 @@ func (computeSystem *System) OpenProcess(ctx context.Context, pid int) (*Process
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()

operation := "hcsshim::System::OpenProcess"
operation := "hcs::System::OpenProcess"

if computeSystem.handle == 0 {
return nil, makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil)
Expand All @@ -521,7 +521,7 @@ func (computeSystem *System) OpenProcess(ctx context.Context, pid int) (*Process

// Close cleans up any state associated with the compute system but does not terminate or wait for it.
func (computeSystem *System) Close() (err error) {
operation := "hcsshim::System::Close"
operation := "hcs::System::Close"
ctx, span := trace.StartSpan(context.Background(), operation)
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
Expand Down Expand Up @@ -615,7 +615,7 @@ func (computeSystem *System) Modify(ctx context.Context, config interface{}) err
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()

operation := "hcsshim::System::Modify"
operation := "hcs::System::Modify"

if computeSystem.handle == 0 {
return makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil)
Expand Down