-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GMSA support for V2 HCS schema xenon containers
* Add new UVM function 'UpdateHvSockServiceTable' to be able to hot add Hvsocket service table entries. * Add disabled field to HvSocketServiceConfig (used to be private in the schema) * Remove hardcoded error if supplying a cred spec and the client asked for a hypervisor isolated container. * Misc refactors (comments, style) Signed-off-by: Daniel Canter <[email protected]>
- Loading branch information
Showing
6 changed files
with
90 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package uvm | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/Microsoft/hcsshim/internal/requesttype" | ||
hcsschema "github.com/Microsoft/hcsshim/internal/schema2" | ||
) | ||
|
||
// UpdateHvSocketService calls HCS to update/create the hvsocket service for | ||
// the UVM. Takes in a service ID and the hvsocket service configuration. If there is no | ||
// entry for the service ID already it will be created. The same call on HvSockets side | ||
// handles the Create/Update/Delete cases based on what is passed in. Here is the logic | ||
// for the call. | ||
// | ||
// 1. If the service ID does not currently exist in the service table, it will be created | ||
// with whatever descriptors and state was specified (disabled or not). | ||
// 2. If the service already exists and empty descriptors and Disabled is passed in for the | ||
// service config, the service will be removed. | ||
// 3. Otherwise any combination that is not Disabled && Empty descriptors will just update the | ||
// service. | ||
// | ||
// This function should preferably be called for the Update/Create flow but there isn't anything | ||
// stopping this being used for the delete case. Prefer RemoveHvSocketService as this sets the | ||
// relevant fields for the Delete case on HCS' side. | ||
// This is currently only used for updating the service table to allow the UVM to | ||
// communicate with the Container Credential Guard (ccg.exe) process on the host after being launched. | ||
func (uvm *UtilityVM) UpdateHvSocketService(ctx context.Context, sid string, doc *hcsschema.HvSocketServiceConfig) error { | ||
request := &hcsschema.ModifySettingRequest{ | ||
RequestType: requesttype.Update, | ||
ResourcePath: fmt.Sprintf(hvsocketConfigResourceFormat, sid), | ||
Settings: doc, | ||
} | ||
return uvm.modify(ctx, request) | ||
} | ||
|
||
// RemoveHvSocketService will remove an hvsocket service entry if it exists. | ||
func (uvm *UtilityVM) RemoveHvSocketService(ctx context.Context, sid string) error { | ||
request := &hcsschema.ModifySettingRequest{ | ||
RequestType: requesttype.Remove, | ||
ResourcePath: fmt.Sprintf(hvsocketConfigResourceFormat, sid), | ||
} | ||
return uvm.modify(ctx, request) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters