mirror of
				https://github.com/containers/podman.git
				synced 2025-11-01 02:42:11 +08:00 
			
		
		
		
	update dependencies
Ran a `go get -u` and bumped K8s deps to 1.15.0. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
		
							
								
								
									
										172
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										172
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -49,20 +49,18 @@ func newSystem(id string) *System { | ||||
| 	return &System{ | ||||
| 		id: id, | ||||
| 		logctx: logrus.Fields{ | ||||
| 			logfields.HCSOperation: "", | ||||
| 			logfields.ContainerID:  id, | ||||
| 			logfields.ContainerID: id, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (computeSystem *System) logOperationBegin(operation string) { | ||||
| 	computeSystem.logctx[logfields.HCSOperation] = operation | ||||
| 	logOperationBegin( | ||||
| 		computeSystem.logctx, | ||||
| 		"hcsshim::ComputeSystem - Begin Operation") | ||||
| 		operation+" - Begin Operation") | ||||
| } | ||||
|  | ||||
| func (computeSystem *System) logOperationEnd(err error) { | ||||
| func (computeSystem *System) logOperationEnd(operation string, err error) { | ||||
| 	var result string | ||||
| 	if err == nil { | ||||
| 		result = "Success" | ||||
| @ -72,9 +70,8 @@ func (computeSystem *System) logOperationEnd(err error) { | ||||
|  | ||||
| 	logOperationEnd( | ||||
| 		computeSystem.logctx, | ||||
| 		"hcsshim::ComputeSystem - End Operation - "+result, | ||||
| 		operation+" - End Operation - "+result, | ||||
| 		err) | ||||
| 	computeSystem.logctx[logfields.HCSOperation] = "" | ||||
| } | ||||
|  | ||||
| // CreateComputeSystem creates a new compute system with the given configuration but does not start it. | ||||
| @ -83,7 +80,7 @@ func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System | ||||
|  | ||||
| 	computeSystem := newSystem(id) | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	hcsDocumentB, err := json.Marshal(hcsDocumentInterface) | ||||
| 	if err != nil { | ||||
| @ -97,13 +94,13 @@ func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System | ||||
| 		Debug("HCS ComputeSystem Document") | ||||
|  | ||||
| 	var ( | ||||
| 		resultp  *uint16 | ||||
| 		identity syscall.Handle | ||||
| 		resultp     *uint16 | ||||
| 		identity    syscall.Handle | ||||
| 		createError error | ||||
| 	) | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	createError := hcsCreateComputeSystem(id, hcsDocument, identity, &computeSystem.handle, &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		createError = hcsCreateComputeSystem(id, hcsDocument, identity, &computeSystem.handle, &resultp) | ||||
| 	}) | ||||
|  | ||||
| 	if createError == nil || IsPending(createError) { | ||||
| 		if err = computeSystem.registerCallback(); err != nil { | ||||
| @ -133,7 +130,13 @@ func OpenComputeSystem(id string) (_ *System, err error) { | ||||
|  | ||||
| 	computeSystem := newSystem(id) | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { | ||||
| 		if IsNotExist(err) { | ||||
| 			computeSystem.logOperationEnd(operation, nil) | ||||
| 		} else { | ||||
| 			computeSystem.logOperationEnd(operation, err) | ||||
| 		} | ||||
| 	}() | ||||
|  | ||||
| 	var ( | ||||
| 		handle  hcsSystem | ||||
| @ -157,12 +160,10 @@ func OpenComputeSystem(id string) (_ *System, err error) { | ||||
| // GetComputeSystems gets a list of the compute systems on the system that match the query | ||||
| func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerProperties, err error) { | ||||
| 	operation := "hcsshim::GetComputeSystems" | ||||
| 	fields := logrus.Fields{ | ||||
| 		logfields.HCSOperation: operation, | ||||
| 	} | ||||
| 	fields := logrus.Fields{} | ||||
| 	logOperationBegin( | ||||
| 		fields, | ||||
| 		"hcsshim::ComputeSystem - Begin Operation") | ||||
| 		operation+" - Begin Operation") | ||||
|  | ||||
| 	defer func() { | ||||
| 		var result string | ||||
| @ -174,7 +175,7 @@ func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerPrope | ||||
|  | ||||
| 		logOperationEnd( | ||||
| 			fields, | ||||
| 			"hcsshim::ComputeSystem - End Operation - "+result, | ||||
| 			operation+" - End Operation - "+result, | ||||
| 			err) | ||||
| 	}() | ||||
|  | ||||
| @ -193,10 +194,10 @@ func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerPrope | ||||
| 		resultp         *uint16 | ||||
| 		computeSystemsp *uint16 | ||||
| 	) | ||||
| 	completed := false | ||||
| 	go syscallWatcher(fields, &completed) | ||||
| 	err = hcsEnumerateComputeSystems(query, &computeSystemsp, &resultp) | ||||
| 	completed = true | ||||
|  | ||||
| 	syscallWatcher(fields, func() { | ||||
| 		err = hcsEnumerateComputeSystems(query, &computeSystemsp, &resultp) | ||||
| 	}) | ||||
| 	events := processHcsResult(resultp) | ||||
| 	if err != nil { | ||||
| 		return nil, &HcsError{Op: operation, Err: err, Events: events} | ||||
| @ -221,7 +222,7 @@ func (computeSystem *System) Start() (err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Start" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, "Start", "", ErrAlreadyClosed, nil) | ||||
| @ -254,10 +255,9 @@ func (computeSystem *System) Start() (err error) { | ||||
| 	} | ||||
|  | ||||
| 	var resultp *uint16 | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsStartComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsStartComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	}) | ||||
| 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, "Start", "", err, events) | ||||
| @ -279,17 +279,22 @@ func (computeSystem *System) Shutdown() (err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Shutdown" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { | ||||
| 		if IsAlreadyStopped(err) { | ||||
| 			computeSystem.logOperationEnd(operation, nil) | ||||
| 		} else { | ||||
| 			computeSystem.logOperationEnd(operation, err) | ||||
| 		} | ||||
| 	}() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, "Shutdown", "", ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	var resultp *uint16 | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsShutdownComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsShutdownComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	}) | ||||
| 	events := processHcsResult(resultp) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, "Shutdown", "", err, events) | ||||
| @ -306,19 +311,24 @@ func (computeSystem *System) Terminate() (err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Terminate" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { | ||||
| 		if IsPending(err) { | ||||
| 			computeSystem.logOperationEnd(operation, nil) | ||||
| 		} else { | ||||
| 			computeSystem.logOperationEnd(operation, err) | ||||
| 		} | ||||
| 	}() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, "Terminate", "", ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	var resultp *uint16 | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsTerminateComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsTerminateComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	}) | ||||
| 	events := processHcsResult(resultp) | ||||
| 	if err != nil { | ||||
| 	if err != nil && err != ErrVmcomputeAlreadyStopped { | ||||
| 		return makeSystemError(computeSystem, "Terminate", "", err, events) | ||||
| 	} | ||||
|  | ||||
| @ -329,7 +339,7 @@ func (computeSystem *System) Terminate() (err error) { | ||||
| func (computeSystem *System) Wait() (err error) { | ||||
| 	operation := "hcsshim::ComputeSystem::Wait" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	err = waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, nil) | ||||
| 	if err != nil { | ||||
| @ -339,12 +349,27 @@ func (computeSystem *System) Wait() (err error) { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // WaitExpectedError synchronously waits for the compute system to shutdown or | ||||
| // terminate, and ignores the passed error if it occurs. | ||||
| func (computeSystem *System) WaitExpectedError(expected error) (err error) { | ||||
| 	operation := "hcsshim::ComputeSystem::WaitExpectedError" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	err = waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, nil) | ||||
| 	if err != nil && getInnerError(err) != expected { | ||||
| 		return makeSystemError(computeSystem, "WaitExpectedError", "", err, nil) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // WaitTimeout synchronously waits for the compute system to terminate or the duration to elapse. | ||||
| // If the timeout expires, IsTimeout(err) == true | ||||
| func (computeSystem *System) WaitTimeout(timeout time.Duration) (err error) { | ||||
| 	operation := "hcsshim::ComputeSystem::WaitTimeout" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	err = waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, &timeout) | ||||
| 	if err != nil { | ||||
| @ -360,7 +385,7 @@ func (computeSystem *System) Properties(types ...schema1.PropertyType) (_ *schem | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Properties" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	queryj, err := json.Marshal(schema1.PropertyQuery{types}) | ||||
| 	if err != nil { | ||||
| @ -372,10 +397,9 @@ func (computeSystem *System) Properties(types ...schema1.PropertyType) (_ *schem | ||||
| 		Debug("HCS ComputeSystem Properties Query") | ||||
|  | ||||
| 	var resultp, propertiesp *uint16 | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsGetComputeSystemProperties(computeSystem.handle, string(queryj), &propertiesp, &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsGetComputeSystemProperties(computeSystem.handle, string(queryj), &propertiesp, &resultp) | ||||
| 	}) | ||||
| 	events := processHcsResult(resultp) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, "Properties", "", err, events) | ||||
| @ -400,17 +424,16 @@ func (computeSystem *System) Pause() (err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Pause" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, "Pause", "", ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	var resultp *uint16 | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsPauseComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsPauseComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	}) | ||||
| 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemPauseCompleted, &timeout.SystemPause) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, "Pause", "", err, events) | ||||
| @ -426,17 +449,16 @@ func (computeSystem *System) Resume() (err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Resume" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, "Resume", "", ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	var resultp *uint16 | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsResumeComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsResumeComputeSystem(computeSystem.handle, "", &resultp) | ||||
| 	}) | ||||
| 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemResumeCompleted, &timeout.SystemResume) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, "Resume", "", err, events) | ||||
| @ -452,7 +474,7 @@ func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::CreateProcess" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	var ( | ||||
| 		processInfo   hcsProcessInformation | ||||
| @ -475,10 +497,9 @@ func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error | ||||
| 		WithField(logfields.JSON, configuration). | ||||
| 		Debug("HCS ComputeSystem Process Document") | ||||
|  | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsCreateProcess(computeSystem.handle, configuration, &processInfo, &processHandle, &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsCreateProcess(computeSystem.handle, configuration, &processInfo, &processHandle, &resultp) | ||||
| 	}) | ||||
| 	events := processHcsResult(resultp) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, "CreateProcess", configuration, err, events) | ||||
| @ -513,7 +534,7 @@ func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::OpenProcess" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	var ( | ||||
| 		processHandle hcsProcess | ||||
| @ -524,10 +545,9 @@ func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) { | ||||
| 		return nil, makeSystemError(computeSystem, "OpenProcess", "", ErrAlreadyClosed, nil) | ||||
| 	} | ||||
|  | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsOpenProcess(computeSystem.handle, uint32(pid), &processHandle, &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsOpenProcess(computeSystem.handle, uint32(pid), &processHandle, &resultp) | ||||
| 	}) | ||||
| 	events := processHcsResult(resultp) | ||||
| 	if err != nil { | ||||
| 		return nil, makeSystemError(computeSystem, "OpenProcess", "", err, events) | ||||
| @ -548,7 +568,7 @@ func (computeSystem *System) Close() (err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Close" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	// Don't double free this | ||||
| 	if computeSystem.handle == 0 { | ||||
| @ -559,10 +579,9 @@ func (computeSystem *System) Close() (err error) { | ||||
| 		return makeSystemError(computeSystem, "Close", "", err, nil) | ||||
| 	} | ||||
|  | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsCloseComputeSystem(computeSystem.handle) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsCloseComputeSystem(computeSystem.handle) | ||||
| 	}) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, "Close", "", err, nil) | ||||
| 	} | ||||
| @ -636,7 +655,7 @@ func (computeSystem *System) Modify(config interface{}) (err error) { | ||||
|  | ||||
| 	operation := "hcsshim::ComputeSystem::Modify" | ||||
| 	computeSystem.logOperationBegin(operation) | ||||
| 	defer computeSystem.logOperationEnd(err) | ||||
| 	defer func() { computeSystem.logOperationEnd(operation, err) }() | ||||
|  | ||||
| 	if computeSystem.handle == 0 { | ||||
| 		return makeSystemError(computeSystem, "Modify", "", ErrAlreadyClosed, nil) | ||||
| @ -654,10 +673,9 @@ func (computeSystem *System) Modify(config interface{}) (err error) { | ||||
| 		Debug("HCS ComputeSystem Modify Document") | ||||
|  | ||||
| 	var resultp *uint16 | ||||
| 	completed := false | ||||
| 	go syscallWatcher(computeSystem.logctx, &completed) | ||||
| 	err = hcsModifyComputeSystem(computeSystem.handle, requestString, &resultp) | ||||
| 	completed = true | ||||
| 	syscallWatcher(computeSystem.logctx, func() { | ||||
| 		err = hcsModifyComputeSystem(computeSystem.handle, requestString, &resultp) | ||||
| 	}) | ||||
| 	events := processHcsResult(resultp) | ||||
| 	if err != nil { | ||||
| 		return makeSystemError(computeSystem, "Modify", requestString, err, events) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Valentin Rothberg
					Valentin Rothberg