Skip to content

Commit

Permalink
more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
kevpar committed Oct 3, 2024
1 parent 5981cd9 commit 986c5cb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/guest/runtime/hcsv2/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (c *Container) Kill(ctx context.Context, signal syscall.Signal) error {
return nil
}

func (c *Container) Delete(ctx context.Context, sbCtx *mountContext) error {
func (c *Container) Delete(ctx context.Context, sbCtx *sandboxContext) error {
entity := log.G(ctx).WithField(logfields.ContainerID, c.id)
entity.Info("opengcs::Container::Delete")
if c.isSandbox {
Expand Down
2 changes: 1 addition & 1 deletion internal/guest/runtime/hcsv2/sandbox_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/Microsoft/hcsshim/pkg/annotations"
)

func setupSandboxContainerSpec(ctx context.Context, sbCtx *mountContext, id string, spec *oci.Spec) (err error) {
func setupSandboxContainerSpec(ctx context.Context, sbCtx *sandboxContext, id string, spec *oci.Spec) (err error) {
ctx, span := oc.StartSpan(ctx, "hcsv2::setupSandboxContainerSpec")
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
Expand Down
2 changes: 1 addition & 1 deletion internal/guest/runtime/hcsv2/standalone_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/Microsoft/hcsshim/internal/oc"
)

func setupStandaloneContainerSpec(ctx context.Context, sbCtx *mountContext, id string, spec *oci.Spec) (err error) {
func setupStandaloneContainerSpec(ctx context.Context, sbCtx *sandboxContext, id string, spec *oci.Spec) (err error) {
ctx, span := oc.StartSpan(ctx, "hcsv2::setupStandaloneContainerSpec")
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
Expand Down
16 changes: 8 additions & 8 deletions internal/guest/runtime/hcsv2/uvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Host struct {
hostMounts *hostMounts

sbLock sync.Mutex
sbCtxts map[string]*mountContext
sbCtxts map[string]*sandboxContext
}

func NewHost(rtime runtime.Runtime, vsock transport.Transport, initialEnforcer securitypolicy.SecurityPolicyEnforcer, logWriter io.Writer) *Host {
Expand All @@ -94,7 +94,7 @@ func NewHost(rtime runtime.Runtime, vsock transport.Transport, initialEnforcer s
securityPolicyEnforcer: initialEnforcer,
logWriter: logWriter,
hostMounts: newHostMounts(),
sbCtxts: make(map[string]*mountContext),
sbCtxts: make(map[string]*sandboxContext),
}
}

Expand Down Expand Up @@ -290,7 +290,7 @@ func (h *Host) AddContainer(id string, c *Container) error {
return nil
}

func setupSandboxMountsPath(sbCtx *mountContext) (err error) {
func setupSandboxMountsPath(sbCtx *sandboxContext) (err error) {
mountPath := sbCtx.sandboxMountsRoot
if err := os.MkdirAll(mountPath, 0755); err != nil {
return errors.Wrapf(err, "failed to create sandboxMounts dir in sandbox %v", sbCtx.id)
Expand All @@ -304,7 +304,7 @@ func setupSandboxMountsPath(sbCtx *mountContext) (err error) {
return storage.MountRShared(mountPath)
}

func setupSandboxHugePageMountsPath(sbCtx *mountContext) error {
func setupSandboxHugePageMountsPath(sbCtx *sandboxContext) error {
mountPath := sbCtx.hugePagesRoot
if err := os.MkdirAll(mountPath, 0755); err != nil {
return errors.Wrapf(err, "failed to create hugepage Mounts dir in sandbox %v", sbCtx.id)
Expand All @@ -313,15 +313,15 @@ func setupSandboxHugePageMountsPath(sbCtx *mountContext) error {
return storage.MountRShared(mountPath)
}

type mountContext struct {
type sandboxContext struct {
id string
bundleRoot string
sandboxMountsRoot string
hugePagesRoot string
networkMountsRoot string
}

func (h *Host) getSbctx(sandboxID string) (*mountContext, error) {
func (h *Host) getSbctx(sandboxID string) (*sandboxContext, error) {
h.sbLock.Lock()
defer h.sbLock.Unlock()
sbCtx, ok := h.sbCtxts[sandboxID]
Expand Down Expand Up @@ -372,7 +372,7 @@ func (h *Host) CreateContainer(ctx context.Context, id string, settings *prot.VM
switch criType {
case "sandbox":
c.sbid = sandboxID
sbCtx := &mountContext{
sbCtx := &sandboxContext{
id: sandboxID,
bundleRoot: settings.OCIBundlePath,
sandboxMountsRoot: filepath.Join(settings.OCIBundlePath, "sandboxMounts"),
Expand Down Expand Up @@ -452,7 +452,7 @@ func (h *Host) CreateContainer(ctx context.Context, id string, settings *prot.VM
} else {
// Capture namespaceID if any because setupStandaloneContainerSpec clears the Windows section.
namespaceID = getNetworkNamespaceID(settings.OCISpecification)
sbCtx := &mountContext{
sbCtx := &sandboxContext{
id: id,
bundleRoot: settings.OCIBundlePath,
sandboxMountsRoot: filepath.Join(settings.OCIBundlePath, "sandboxMounts"),
Expand Down
2 changes: 1 addition & 1 deletion internal/guest/runtime/hcsv2/workload_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func specHasGPUDevice(spec *oci.Spec) bool {
return false
}

func setupWorkloadContainerSpec(ctx context.Context, sbCtx *mountContext, id string, spec *oci.Spec, ociBundlePath string) (err error) {
func setupWorkloadContainerSpec(ctx context.Context, sbCtx *sandboxContext, id string, spec *oci.Spec, ociBundlePath string) (err error) {
ctx, span := oc.StartSpan(ctx, "hcsv2::setupWorkloadContainerSpec")
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
Expand Down

0 comments on commit 986c5cb

Please sign in to comment.