Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: Set memory config shared=false when shared_fs=None in CLH #265

Merged
merged 1 commit into from
Dec 12, 2024
Merged
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
10 changes: 8 additions & 2 deletions src/runtime/virtcontainers/clh.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,14 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net

// Create the VM memory config via the constructor to ensure default values are properly assigned
clh.vmconfig.Memory = chclient.NewMemoryConfig(int64((utils.MemUnit(clh.config.MemorySize) * utils.MiB).ToBytes()))
// shared memory should be enabled if using vhost-user(kata uses virtiofsd)
clh.vmconfig.Memory.Shared = func(b bool) *bool { return &b }(true)
// Memory config shared is to be enabled when using vhost_user backends,
// ex. virtio-fs or when using HugePages.
// If such features are disabled, turn off shared memory config.
if clh.config.SharedFS == config.NoSharedFS && !clh.config.HugePages {
clh.vmconfig.Memory.Shared = func(b bool) *bool { return &b }(false)
} else {
clh.vmconfig.Memory.Shared = func(b bool) *bool { return &b }(true)
}
// Enable hugepages if needed
clh.vmconfig.Memory.Hugepages = func(b bool) *bool { return &b }(clh.config.HugePages)
if !clh.config.ConfidentialGuest && igvmPath == "" {
Expand Down
Loading