Skip to content

Commit

Permalink
Grant dest VM access to VHDs
Browse files Browse the repository at this point in the history
  • Loading branch information
kevpar committed Nov 8, 2024
1 parent f13faf6 commit e868adb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion internal/core/linuxvm/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,17 @@ func NewLMSandbox(ctx context.Context, id string, config *statepkg.SandboxState,
logrus.WithField("config", config).Info("creating lm sandbox with config")
vmConfig := statepkg.VMConfigToInternal(config.Vm.Config)
vmConfig.Serial = annos["io.microsoft.virtualmachine.console.pipe"]
vm, err := vm.NewVM(ctx, fmt.Sprintf("%s@vm", id), vmConfig, vm.WithLM(config.Vm.CompatInfo))
vmID := fmt.Sprintf("%s@vm", id)
for _, controller := range vmConfig.SCSI {
for _, att := range controller {
if att.Type == vmpkg.SCSIAttachmentTypeVHD || att.Type == vmpkg.SCSIAttachmentTypePassThru {
if err := wclayer.GrantVmAccess(ctx, vmID, att.Path); err != nil {
return nil, fmt.Errorf("grant vm access to %s: %w", att.Path, err)
}
}
}
}
vm, err := vm.NewVM(ctx, vmID, vmConfig, vm.WithLM(config.Vm.CompatInfo))
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/octtrpc/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ func ServerInterceptor(opts ...Option) ttrpc.UnaryServerInterceptor {
ctx, span = oc.StartSpan(ctx, name, opts...)
}
defer span.End()
defer setSpanStatus(span, err)
defer func() {
setSpanStatus(span, err)
}()

return method(ctx, unmarshal)
}
Expand Down

0 comments on commit e868adb

Please sign in to comment.