mirror of
https://github.com/containers/podman.git
synced 2025-11-13 09:38:05 +08:00
Update containers common to the latest HEAD. Some bug fixes in libimage forced us to have a clearer separation between ordinary images and manifest lists. Hence, when looking up manifest lists without recursing into any of their instances, we need to use `LookupManifestList()`. Also account for some other changes in c/common (e.g., the changed order in the security labels). Further vendor the latest HEAD from Buildah which is required to get the bud tests to pass. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package hcs
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
|
|
"github.com/Microsoft/hcsshim/internal/vmcompute"
|
|
)
|
|
|
|
// GetServiceProperties returns properties of the host compute service.
|
|
func GetServiceProperties(ctx context.Context, q hcsschema.PropertyQuery) (*hcsschema.ServiceProperties, error) {
|
|
operation := "hcs::GetServiceProperties"
|
|
|
|
queryb, err := json.Marshal(q)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
propertiesJSON, resultJSON, err := vmcompute.HcsGetServiceProperties(ctx, string(queryb))
|
|
events := processHcsResult(ctx, resultJSON)
|
|
if err != nil {
|
|
return nil, &HcsError{Op: operation, Err: err, Events: events}
|
|
}
|
|
|
|
if propertiesJSON == "" {
|
|
return nil, ErrUnexpectedValue
|
|
}
|
|
properties := &hcsschema.ServiceProperties{}
|
|
if err := json.Unmarshal([]byte(propertiesJSON), properties); err != nil {
|
|
return nil, err
|
|
}
|
|
return properties, nil
|
|
}
|
|
|
|
// ModifyServiceSettings modifies settings of the host compute service.
|
|
func ModifyServiceSettings(ctx context.Context, settings hcsschema.ModificationRequest) error {
|
|
operation := "hcs::ModifyServiceSettings"
|
|
|
|
settingsJSON, err := json.Marshal(settings)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
resultJSON, err := vmcompute.HcsModifyServiceSettings(ctx, string(settingsJSON))
|
|
events := processHcsResult(ctx, resultJSON)
|
|
if err != nil {
|
|
return &HcsError{Op: operation, Err: err, Events: events}
|
|
}
|
|
return nil
|
|
}
|