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

libvirt: Add podvm instance cpu and mem size support for libvirt #2116

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

savitrilh
Copy link

Use io.katacontainers.config.hypervisor.default_vcpus and io.katacontainers.config.hypervisor.default_memory annotations to set the libvirt podvm instance. Use the default values if no annotations are provided.

Fixes: #1650

Signed-off-by : savitrilh [email protected]

@savitrilh savitrilh requested a review from a team as a code owner October 14, 2024 09:55
Add podvm instance cpu and mem size support for libvirt

Fixes: confidential-containers#1650

Signed-off-by : SAVITRI HUNASHEEKATTI <[email protected]>
@savitrilh savitrilh marked this pull request as draft October 14, 2024 15:06
Add podvm instance cpu and mem size support for libvirt

Fixes: confidential-containers#1650

Signed-off-by : SAVITRI HUNASHEEKATTI <[email protected]>
Add podvm instance cpu and mem size support for libvirt

Fixes: confidential-containers#1650

Signed-off-by : SAVITRI HUNASHEEKATTI <[email protected]>
@savitrilh savitrilh force-pushed the libvirt-resource branch 2 times, most recently from ca6e52a to 0bf4a2d Compare January 8, 2025 09:17
Removed extra closing bracket

Signed-off-by : SAVITRI HUNASHEEKATTI <[email protected]>
Copy link
Member

@stevenhorsman stevenhorsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a couple of comments, but we also need the commits squashed together so it is more reviewable. Thanks

Comment on lines 34 to 35
// Convert Memory size from MegaBytes to GigaBytes
LIBVIRT_CONV_MEM = 1000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kata annotation is in MiB (https://github.com/kata-containers/kata-containers/blob/main/docs/how-to/how-to-set-sandbox-config-kata.md#hypervisor-options) and the domainXML we create is in GiB (

Memory: &libvirtxml.DomainMemory{Value: cfg.mem, Unit: "GiB", DumpCore: "on"},
), so the comment and conversion constant needs correcting.

@@ -56,9 +56,12 @@ func (p *libvirtProvider) CreateInstance(ctx context.Context, podName, sandboxID
return nil, err
}

// TODO: Specify the maximum instance name length in Libvirt
vm := &vmConfig{name: instanceName, userData: userData, firmware: p.serviceConfig.Firmware}
// Convert the memory units in gigabytes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment need updating too.

Comment on lines +155 to +156
[[ "${LIBVIRT_CPU}" ]] && optionals+="-CPU ${LIBVIRT_CPU} "
[[ "${LIBVIRT_MEMORY}" ]] && optionals+="-Memory ${LIBVIRT_MEMORY} "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like convention is for the flags to be lowercase

@@ -28,6 +28,8 @@ configMapGenerator:
- LIBVIRT_EFI_FIRMWARE="/usr/share/OVMF/OVMF_CODE_4M.fd" # Edit to change the EFI firmware path, or comment to unset, if not using EFI.
#- LIBVIRT_LAUNCH_SECURITY="" #sev or s390-pv
#- LIBVIRT_VOL_NAME="" # Uncomment and set if you want to use a specific volume name. Defaults to podvm-base.qcow2
#- LIBVIRT_CPU="2"
#- LIBVIRT_Memory="800
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean 8196 here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libvirt: Add podvm instance cpu/mem size support for libvirt
2 participants