mirror of
				https://github.com/containers/podman.git
				synced 2025-10-31 10:00:01 +08:00 
			
		
		
		
	vendor in containers/storage v1.29.0
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
		
							
								
								
									
										16
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -171,7 +171,6 @@ type SystemError struct { | ||||
| 	ID     string | ||||
| 	Op     string | ||||
| 	Err    error | ||||
| 	Extra  string | ||||
| 	Events []ErrorEvent | ||||
| } | ||||
|  | ||||
| @ -182,9 +181,6 @@ func (e *SystemError) Error() string { | ||||
| 	for _, ev := range e.Events { | ||||
| 		s += "\n" + ev.String() | ||||
| 	} | ||||
| 	if e.Extra != "" { | ||||
| 		s += "\n(extra info: " + e.Extra + ")" | ||||
| 	} | ||||
| 	return s | ||||
| } | ||||
|  | ||||
| @ -198,7 +194,7 @@ func (e *SystemError) Timeout() bool { | ||||
| 	return ok && err.Timeout() | ||||
| } | ||||
|  | ||||
| func makeSystemError(system *System, op string, extra string, err error, events []ErrorEvent) error { | ||||
| func makeSystemError(system *System, op string, err error, events []ErrorEvent) error { | ||||
| 	// Don't double wrap errors | ||||
| 	if _, ok := err.(*SystemError); ok { | ||||
| 		return err | ||||
| @ -206,7 +202,6 @@ func makeSystemError(system *System, op string, extra string, err error, events | ||||
| 	return &SystemError{ | ||||
| 		ID:     system.ID(), | ||||
| 		Op:     op, | ||||
| 		Extra:  extra, | ||||
| 		Err:    err, | ||||
| 		Events: events, | ||||
| 	} | ||||
| @ -332,12 +327,3 @@ func getInnerError(err error) error { | ||||
| 	} | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| func getOperationLogResult(err error) (string, error) { | ||||
| 	switch err { | ||||
| 	case nil: | ||||
| 		return "Success", nil | ||||
| 	default: | ||||
| 		return "Error", err | ||||
| 	} | ||||
| } | ||||
|  | ||||
							
								
								
									
										20
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -64,11 +64,7 @@ type processStatus struct { | ||||
| 	LastWaitResult int32 | ||||
| } | ||||
|  | ||||
| const ( | ||||
| 	stdIn  string = "StdIn" | ||||
| 	stdOut string = "StdOut" | ||||
| 	stdErr string = "StdErr" | ||||
| ) | ||||
| const stdIn string = "StdIn" | ||||
|  | ||||
| const ( | ||||
| 	modifyConsoleSize string = "ConsoleSize" | ||||
| @ -176,8 +172,10 @@ func (process *Process) waitBackground() { | ||||
| 		trace.Int64Attribute("pid", int64(process.processID))) | ||||
|  | ||||
| 	var ( | ||||
| 		err      error | ||||
| 		exitCode = -1 | ||||
| 		err            error | ||||
| 		exitCode       = -1 | ||||
| 		propertiesJSON string | ||||
| 		resultJSON     string | ||||
| 	) | ||||
|  | ||||
| 	err = waitForNotification(ctx, process.callbackNumber, hcsNotificationProcessExited, nil) | ||||
| @ -190,15 +188,15 @@ func (process *Process) waitBackground() { | ||||
|  | ||||
| 		// Make sure we didnt race with Close() here | ||||
| 		if process.handle != 0 { | ||||
| 			propertiesJSON, resultJSON, err := vmcompute.HcsGetProcessProperties(ctx, process.handle) | ||||
| 			propertiesJSON, resultJSON, err = vmcompute.HcsGetProcessProperties(ctx, process.handle) | ||||
| 			events := processHcsResult(ctx, resultJSON) | ||||
| 			if err != nil { | ||||
| 				err = makeProcessError(process, operation, err, events) | ||||
| 				err = makeProcessError(process, operation, err, events) //nolint:ineffassign | ||||
| 			} else { | ||||
| 				properties := &processStatus{} | ||||
| 				err = json.Unmarshal([]byte(propertiesJSON), properties) | ||||
| 				if err != nil { | ||||
| 					err = makeProcessError(process, operation, err, nil) | ||||
| 					err = makeProcessError(process, operation, err, nil) //nolint:ineffassign | ||||
| 				} else { | ||||
| 					if properties.LastWaitResult != 0 { | ||||
| 						log.G(ctx).WithField("wait-result", properties.LastWaitResult).Warning("non-zero last wait result") | ||||
| @ -468,7 +466,7 @@ func (process *Process) unregisterCallback(ctx context.Context) error { | ||||
| 	delete(callbackMap, callbackNumber) | ||||
| 	callbackMapLock.Unlock() | ||||
|  | ||||
| 	handle = 0 | ||||
| 	handle = 0 //nolint:ineffassign | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
							
								
								
									
										74
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										74
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -73,8 +73,8 @@ func CreateComputeSystem(ctx context.Context, id string, hcsDocumentInterface in | ||||
| 		if err = computeSystem.registerCallback(ctx); err != nil { | ||||
| 			// Terminate the compute system if it still exists. We're okay to | ||||
| 			// ignore a failure here. | ||||
| 			computeSystem.Terminate(ctx) | ||||
| 			return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 			_ = computeSystem.Terminate(ctx) | ||||
| 			return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @ -83,9 +83,9 @@ func CreateComputeSystem(ctx context.Context, id string, hcsDocumentInterface in | ||||
| 		if err == ErrTimeout { | ||||
| 			// Terminate the compute system if it still exists. We're okay to | ||||
| 			// ignore a failure here. | ||||
| 			computeSystem.Terminate(ctx) | ||||
| 			_ = computeSystem.Terminate(ctx) | ||||
| 		} | ||||
| 		return nil, makeSystemError(computeSystem, operation, hcsDocument, err, events) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
| 	go computeSystem.waitBackground() | ||||
| 	if err = computeSystem.getCachedProperties(ctx); err != nil { | ||||
| @ -102,7 +102,7 @@ func OpenComputeSystem(ctx context.Context, id string) (*System, error) { | ||||
| 	handle, resultJSON, err := vmcompute.HcsOpenComputeSystem(ctx, id) | ||||
| 	events := processHcsResult(ctx, resultJSON) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
| 	computeSystem.handle = handle | ||||
| 	defer func() { | ||||
| @ -111,7 +111,7 @@ func OpenComputeSystem(ctx context.Context, id string) (*System, error) { | ||||
| 		} | ||||
| 	}() | ||||
| 	if err = computeSystem.registerCallback(ctx); err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
| 	go computeSystem.waitBackground() | ||||
| 	if err = computeSystem.getCachedProperties(ctx); err != nil { | ||||
| @ -187,13 +187,13 @@ func (computeSystem *System) Start(ctx context.Context) (err error) { | ||||
| 	defer computeSystem.handleLock.RUnlock() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) | ||||
| 		return makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	resultJSON, err := vmcompute.HcsStartComputeSystem(ctx, computeSystem.handle, "") | ||||
| 	events, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| @ -220,7 +220,7 @@ func (computeSystem *System) Shutdown(ctx context.Context) error { | ||||
| 	switch err { | ||||
| 	case nil, ErrVmcomputeAlreadyStopped, ErrComputeSystemDoesNotExist, ErrVmcomputeOperationPending: | ||||
| 	default: | ||||
| 		return makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
| @ -241,7 +241,7 @@ func (computeSystem *System) Terminate(ctx context.Context) error { | ||||
| 	switch err { | ||||
| 	case nil, ErrVmcomputeAlreadyStopped, ErrComputeSystemDoesNotExist, ErrVmcomputeOperationPending: | ||||
| 	default: | ||||
| 		return makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
| @ -263,10 +263,10 @@ func (computeSystem *System) waitBackground() { | ||||
| 		log.G(ctx).Debug("system exited") | ||||
| 	case ErrVmcomputeUnexpectedExit: | ||||
| 		log.G(ctx).Debug("unexpected system exit") | ||||
| 		computeSystem.exitError = makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		computeSystem.exitError = makeSystemError(computeSystem, operation, err, nil) | ||||
| 		err = nil | ||||
| 	default: | ||||
| 		err = makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		err = makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
| 	computeSystem.closedWaitOnce.Do(func() { | ||||
| 		computeSystem.waitError = err | ||||
| @ -304,13 +304,13 @@ func (computeSystem *System) Properties(ctx context.Context, types ...schema1.Pr | ||||
|  | ||||
| 	queryBytes, err := json.Marshal(schema1.PropertyQuery{PropertyTypes: types}) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
|  | ||||
| 	propertiesJSON, resultJSON, err := vmcompute.HcsGetComputeSystemProperties(ctx, computeSystem.handle, string(queryBytes)) | ||||
| 	events := processHcsResult(ctx, resultJSON) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	if propertiesJSON == "" { | ||||
| @ -318,7 +318,7 @@ func (computeSystem *System) Properties(ctx context.Context, types ...schema1.Pr | ||||
| 	} | ||||
| 	properties := &schema1.ContainerProperties{} | ||||
| 	if err := json.Unmarshal([]byte(propertiesJSON), properties); err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
|  | ||||
| 	return properties, nil | ||||
| @ -333,13 +333,13 @@ func (computeSystem *System) PropertiesV2(ctx context.Context, types ...hcsschem | ||||
|  | ||||
| 	queryBytes, err := json.Marshal(hcsschema.PropertyQuery{PropertyTypes: types}) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
|  | ||||
| 	propertiesJSON, resultJSON, err := vmcompute.HcsGetComputeSystemProperties(ctx, computeSystem.handle, string(queryBytes)) | ||||
| 	events := processHcsResult(ctx, resultJSON) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	if propertiesJSON == "" { | ||||
| @ -347,7 +347,7 @@ func (computeSystem *System) PropertiesV2(ctx context.Context, types ...hcsschem | ||||
| 	} | ||||
| 	properties := &hcsschema.Properties{} | ||||
| 	if err := json.Unmarshal([]byte(propertiesJSON), properties); err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
|  | ||||
| 	return properties, nil | ||||
| @ -368,13 +368,13 @@ func (computeSystem *System) Pause(ctx context.Context) (err error) { | ||||
| 	defer computeSystem.handleLock.RUnlock() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) | ||||
| 		return makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	resultJSON, err := vmcompute.HcsPauseComputeSystem(ctx, computeSystem.handle, "") | ||||
| 	events, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemPauseCompleted, &timeout.SystemPause) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| @ -395,13 +395,13 @@ func (computeSystem *System) Resume(ctx context.Context) (err error) { | ||||
| 	defer computeSystem.handleLock.RUnlock() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) | ||||
| 		return makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	resultJSON, err := vmcompute.HcsResumeComputeSystem(ctx, computeSystem.handle, "") | ||||
| 	events, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemResumeCompleted, &timeout.SystemResume) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| @ -427,13 +427,13 @@ func (computeSystem *System) Save(ctx context.Context, options interface{}) (err | ||||
| 	defer computeSystem.handleLock.RUnlock() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) | ||||
| 		return makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	result, err := vmcompute.HcsSaveComputeSystem(ctx, computeSystem.handle, string(saveOptions)) | ||||
| 	events, err := processAsyncHcsResult(ctx, err, result, computeSystem.callbackNumber, hcsNotificationSystemSaveCompleted, &timeout.SystemSave) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| @ -444,19 +444,19 @@ func (computeSystem *System) createProcess(ctx context.Context, operation string | ||||
| 	defer computeSystem.handleLock.RUnlock() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return nil, nil, makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) | ||||
| 		return nil, nil, makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	configurationb, err := json.Marshal(c) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
|  | ||||
| 	configuration := string(configurationb) | ||||
| 	processInfo, processHandle, resultJSON, err := vmcompute.HcsCreateProcess(ctx, computeSystem.handle, configuration) | ||||
| 	events := processHcsResult(ctx, resultJSON) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, makeSystemError(computeSystem, operation, configuration, err, events) | ||||
| 		return nil, nil, makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	log.G(ctx).WithField("pid", processInfo.ProcessId).Debug("created process pid") | ||||
| @ -478,7 +478,7 @@ func (computeSystem *System) CreateProcess(ctx context.Context, c interface{}) ( | ||||
|  | ||||
| 	pipes, err := makeOpenFiles([]syscall.Handle{processInfo.StdInput, processInfo.StdOutput, processInfo.StdError}) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
| 	process.stdin = pipes[0] | ||||
| 	process.stdout = pipes[1] | ||||
| @ -486,7 +486,7 @@ func (computeSystem *System) CreateProcess(ctx context.Context, c interface{}) ( | ||||
| 	process.hasCachedStdio = true | ||||
|  | ||||
| 	if err = process.registerCallback(ctx); err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
| 	go process.waitBackground() | ||||
|  | ||||
| @ -501,18 +501,18 @@ func (computeSystem *System) OpenProcess(ctx context.Context, pid int) (*Process | ||||
| 	operation := "hcsshim::System::OpenProcess" | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	processHandle, resultJSON, err := vmcompute.HcsOpenProcess(ctx, computeSystem.handle, uint32(pid)) | ||||
| 	events := processHcsResult(ctx, resultJSON) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, events) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	process := newProcess(processHandle, pid, computeSystem) | ||||
| 	if err = process.registerCallback(ctx); err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return nil, makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
| 	go process.waitBackground() | ||||
|  | ||||
| @ -536,12 +536,12 @@ func (computeSystem *System) Close() (err error) { | ||||
| 	} | ||||
|  | ||||
| 	if err = computeSystem.unregisterCallback(ctx); err != nil { | ||||
| 		return makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
|  | ||||
| 	err = vmcompute.HcsCloseComputeSystem(ctx, computeSystem.handle) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, operation, "", err, nil) | ||||
| 		return makeSystemError(computeSystem, operation, err, nil) | ||||
| 	} | ||||
|  | ||||
| 	computeSystem.handle = 0 | ||||
| @ -605,7 +605,7 @@ func (computeSystem *System) unregisterCallback(ctx context.Context) error { | ||||
| 	delete(callbackMap, callbackNumber) | ||||
| 	callbackMapLock.Unlock() | ||||
|  | ||||
| 	handle = 0 | ||||
| 	handle = 0 //nolint:ineffassign | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
| @ -618,7 +618,7 @@ func (computeSystem *System) Modify(ctx context.Context, config interface{}) err | ||||
| 	operation := "hcsshim::System::Modify" | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, operation, "", ErrAlreadyClosed, nil) | ||||
| 		return makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	requestBytes, err := json.Marshal(config) | ||||
| @ -630,7 +630,7 @@ func (computeSystem *System) Modify(ctx context.Context, config interface{}) err | ||||
| 	resultJSON, err := vmcompute.HcsModifyComputeSystem(ctx, computeSystem.handle, requestJSON) | ||||
| 	events := processHcsResult(ctx, resultJSON) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, operation, requestJSON, err, events) | ||||
| 		return makeSystemError(computeSystem, operation, err, events) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
|  | ||||
							
								
								
									
										1
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/waithelper.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/waithelper.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -65,5 +65,4 @@ func waitForNotification(ctx context.Context, callbackNumber uintptr, expectedNo | ||||
| 	case <-c: | ||||
| 		return ErrTimeout | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Daniel J Walsh
					Daniel J Walsh