-
Notifications
You must be signed in to change notification settings - Fork 92
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
951f560
cbde4c9
e0fd727
5ab16fa
36c06e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean 8196 here? |
||
#- PAUSE_IMAGE="" # Uncomment and set if you want to use a specific pause image | ||
#- TUNNEL_TYPE="" # Uncomment and set if you want to use a specific tunnel type. Defaults to vxlan | ||
#- VXLAN_PORT="" # Uncomment and set if you want to use a specific vxlan port. Defaults to 4789 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ | |
|
||
const maxInstanceNameLen = 63 | ||
|
||
// Convert Memory size from MegaBytes to GigaBytes | ||
LIBVIRT_CONV_MEM = 1000 | ||
Check failure on line 24 in src/cloud-providers/libvirt/provider.go GitHub Actions / govulncheck
Check failure on line 24 in src/cloud-providers/libvirt/provider.go GitHub Actions / vet and fmt
|
||
|
||
type libvirtProvider struct { | ||
libvirtClient *libvirtClient | ||
serviceConfig *Config | ||
|
@@ -57,8 +60,15 @@ | |
} | ||
|
||
// Convert the memory units in gigabytes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment need updating too. |
||
instanceMemory := uint(spec.Memory / LIBVIRT_CONV_MEM) | ||
if instanceMemory == 0 { | ||
instanceMemory = uint(p.serviceConfig.Memory / LIBVIRT_CONV_MEM) | ||
} | ||
|
||
instanceVCPUs := uint(spec.VCPUs) | ||
if instanceVCPUs == 0 { | ||
instanceVCPUs = uint(p.serviceConfig.CPU) | ||
} | ||
|
||
// TODO: Specify the maximum instance name length in Libvirt | ||
vm := &vmConfig{name: instanceName, cpu: instanceVCPUs, mem: instanceMemory, userData: userData, firmware: p.serviceConfig.Firmware} | ||
|
There was a problem hiding this comment.
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