mirror of
				https://github.com/containers/podman.git
				synced 2025-11-01 02:42:11 +08:00 
			
		
		
		
	vendor in containers/storage v1.29.0
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
		
							
								
								
									
										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 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Daniel J Walsh
					Daniel J Walsh