Skip to content

Commit

Permalink
runtime: virtio-blk root device for AKS-Kata
Browse files Browse the repository at this point in the history
Use virtio-blk for the AKS-Kata Pod VM root storage device. When using
"--pmem discard_writes=on" the entire Pod VM image gets copied into the
Pod VM memory, thus resulting in higher memory consumption.

AKS-CC was already using virtio-blk (not pmem).

Signed-off-by: Dan Mihai <[email protected]>
  • Loading branch information
danmihai1 committed Dec 31, 2024
1 parent dae5080 commit f0b8fc8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/runtime/config/configuration-clh.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ block_device_driver = "virtio-blk"
# set to a non zero value.
#disk_rate_limiter_ops_one_time_burst = 0

# If false and nvdimm is supported, use nvdimm device to plug guest image.
# Otherwise virtio-block device is used.
#
# Default is false
disable_image_nvdimm = true

[agent.@PROJECT_TYPE@]
# If enabled, make the agent display debug-level messages.
# (default: disabled)
Expand Down
1 change: 1 addition & 0 deletions src/runtime/pkg/katautils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ func newClhHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
FileBackedMemRootList: h.FileBackedMemRootList,
Debug: h.Debug,
DisableNestingChecks: h.DisableNestingChecks,
DisableImageNvdimm: h.DisableImageNvdimm,
BlockDeviceDriver: blockDriver,
BlockDeviceCacheSet: h.BlockDeviceCacheSet,
BlockDeviceCacheDirect: h.BlockDeviceCacheDirect,
Expand Down
11 changes: 9 additions & 2 deletions src/runtime/virtcontainers/clh.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
clh.ctx = newCtx
defer span.End()

clh.Logger().
WithField("DisableImageNvdimm", hypervisorConfig.DisableImageNvdimm).
WithField("ConfidentialGuest", hypervisorConfig.ConfidentialGuest).
Info("CreateVM")

if err := clh.setConfig(hypervisorConfig); err != nil {
return err
}
Expand Down Expand Up @@ -578,7 +583,9 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
// Set initial amount of cpu's for the virtual machine
clh.vmconfig.Cpus = chclient.NewCpusConfig(int32(clh.config.NumVCPUs()), int32(clh.config.DefaultMaxVCPUs))

params, err := GetKernelRootParams(hypervisorConfig.RootfsType, clh.config.ConfidentialGuest, false)
disableNvdimm := (clh.config.DisableImageNvdimm || clh.config.ConfidentialGuest)
enableDax := false
params, err := GetKernelRootParams(hypervisorConfig.RootfsType, disableNvdimm, enableDax)
if err != nil {
return err
}
Expand Down Expand Up @@ -621,7 +628,7 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
}

if assetType == types.ImageAsset {
if clh.config.ConfidentialGuest {
if disableNvdimm {
disk := chclient.NewDiskConfig(assetPath)
disk.SetReadonly(true)

Expand Down

0 comments on commit f0b8fc8

Please sign in to comment.