Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions internal/hcs/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,13 +986,14 @@ func (computeSystem *System) HcsInitializeLiveMigrationOnSource(ctx context.Cont
options.MemoryTransport = hcsschema.MigrationMemoryTransportTCP
}
options.CancelIfBlackoutThresholdExceeds = opt.CancelIfBlackoutThresholdExceeds
//options.PerfTracingEnabled = opt.PerfTracingEnabled
//options.ChecksumVerification = opt.ChecksumVerification
options.PerfTracingEnabled = opt.PerfTracingEnabled
// Checksum verification is intentionally never propagated to HCS: we do not
// want any instance of memory-page checksum validation active during live
// migration. Leaving options.ChecksumVerification at its zero value combined
// with the omitempty JSON tag omits it from the HCS payload entirely.
// options.ChecksumVerification = opt.ChecksumVerification
options.PrepareMemoryTransferMode = opt.PrepareMemoryTransferMode
}
//knagendra Hardcoding these values to enable checksum verification in canary
options.PerfTracingEnabled = true
options.ChecksumVerification = true

optionsRaw, err := json.Marshal(options)
if err != nil {
Expand Down
25 changes: 0 additions & 25 deletions internal/taskserver/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"time"
"unsafe"

"golang.org/x/sys/windows/registry"

runhcsopts "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"
"github.com/Microsoft/hcsshim/internal/cmd"
"github.com/Microsoft/hcsshim/internal/core"
Expand Down Expand Up @@ -59,9 +57,6 @@ type migrationState struct {
var _ lmproto.MigrationService = (*service)(nil)

func (s *service) PrepareSandbox(ctx context.Context, req *lmproto.PrepareSandboxRequest) (*lmproto.PrepareSandboxResponse, error) {
if err := enableChecksumValidationRegKeys(); err != nil {
logrus.WithError(err).Warn("failed to set checksum validation registry keys")
}
sandboxState, resources, err := s.sandbox.Sandbox.(core.Migratable).LMPrepare(ctx, req.InitializeOptions)
if err != nil {
return nil, fmt.Errorf("prepare sandbox for migration: %w", err)
Expand Down Expand Up @@ -547,23 +542,3 @@ func (s *service) CreateDuplicateSocket(ctx context.Context, req *lmproto.Create
SessionId: req.SessionId,
}, nil
}

func enableChecksumValidationRegKeys() error {
k, _, err := registry.CreateKey(
registry.LOCAL_MACHINE,
`SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Migration`,
registry.SET_VALUE,
)
if err != nil {
return fmt.Errorf("open migration registry key: %w", err)
}
defer k.Close()

if err := k.SetDWordValue("Test_UseSkippedForProtectionBitmapsInCrcCheck", 0); err != nil {
return fmt.Errorf("set Test_UseSkippedForProtectionBitmapsInCrcCheck: %w", err)
}
if err := k.SetDWordValue("Test_TransferMemoryAfterVdevPowerOff", 1); err != nil {
return fmt.Errorf("set Test_TransferMemoryAfterVdevPowerOff: %w", err)
}
return nil
}
34 changes: 34 additions & 0 deletions internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package version

import (
"embed"
"runtime/debug"
"strings"
)

Expand Down Expand Up @@ -39,3 +40,36 @@ func readDataFile(f string) string {
b, _ := data.ReadFile("data/" + f)
return strings.TrimSpace(string(b))
}

// When the build did not populate the embedded data files (e.g. a plain
// `go build` that did not run scripts/Set-VersionInfo.ps1 and passed no
// `-ldflags -X` overrides), fall back to the VCS revision that the Go
// toolchain embeds automatically (`go build -buildvcs`, default since Go 1.18).
// This ensures binaries report the git commit they were built from.
func init() {
if Commit != "" {
return
}
bi, ok := debug.ReadBuildInfo()
if !ok {
return
}
var revision string
var modified bool
for _, s := range bi.Settings {
switch s.Key {
case "vcs.revision":
revision = s.Value
case "vcs.modified":
modified = s.Value == "true"
}
}
if revision == "" {
return
}
if modified {
revision += "-dirty"
}
Commit = revision
}

2 changes: 0 additions & 2 deletions internal/vm2/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ func NewVM(ctx context.Context, id string, config *Config, opts ...Opt) (_ *VM,
CompatibilityData: &hcsschema.CompatibilityInfo{
Data: oc.compatData,
},
ChecksumVerification: true,
PerfTracingEnabled: true,
}
}

Expand Down
Loading