dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.6k stars 458 forks source link

Manage balloon memory #953

Open MOURADMAZOUZ opened 2 years ago

MOURADMAZOUZ commented 2 years ago

Checklist

Description of Issue/Question

By default terraform module don't manage over allocate memory and allocate all memory on start up. Is it possible to add option "MemoryUse" to be able to do over allocate memory on deployment ?

Setup

I try to patch with success this code,:

terraform-provider-libvirt/libvirt$ diff resource_libvirt_domain.go 
70,75d69
<           "currentmemory": {
<               Type:     schema.TypeInt,
<               Optional: true,
<               Default:  256,
<               ForceNew: true,
<           },
518,521d511
<   domainDef.CurrentMemory = &libvirtxml.DomainCurrentMemory{
<       Value: uint(d.Get("currentmemory").(int)),
<       Unit:  "MiB",
<   }
840d829
<   d.Set("currentmemory", domainDef.CurrentMemory)

Default at 0 allocate all memory, it's like non over allocate memory

(Please provide the full main.tf file for reproducing the issue (Be sure to remove sensitive information)

scabala commented 2 months ago

Hi @MOURADMAZOUZ, this is very nice feature. I have trouble following patch you presented. AFAIU, it should be possible to specify CurrentMemory via additional argument, right? Would you be interested in providing a PR?