-
Notifications
You must be signed in to change notification settings - Fork 43
hypervisor: Add Default{VCPUs, MemSz} to HypervisorConfig #299
Conversation
Okay, I see the problem. I'm on it. |
bef3c12
to
a56b81f
Compare
I see. I have the same problem on my host. It seems like QEMU has an issue with less than 512 MiB guest physical memory size. |
a56b81f
to
4c2d2e3
Compare
Hi @dlespiau , are you OK with this patch? |
You have two things in this PR:
I don't remember we have a great reason to default to 2G but I suspect quite a few images won't start with only 512MB of RAM. If you only introduce the first point in this PR (configuration), it can have my lgtm. Changing the default will need more work (we have a script to test the top 100 containers for instance, it probably has to go through it). So maybe a good idea is to only have the configurability in this PR and merge it, with another PR to change the default if you so wish. Of course, we can also specify 2G in the clear containers runtime, that should result in no effective change either. |
@dlespiau , I'm OK to keep it 2G. I'll update the PR in a minute. |
4c2d2e3
to
98ff4b8
Compare
hypervisor.go
Outdated
} | ||
|
||
if conf.DefaultMemSz == 0 { | ||
conf.DefaultMemSz = 2048 // MiB |
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.
Nit: I'd be tempted to do something like:
// 2G
const defaultMemSzMiB = 2048
:
conf.DefaultMemSz = defaultMemSzMiB
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.
Ok. Also did for conf.DefaultVCPUs
hypervisor_test.go
Outdated
ImagePath: fmt.Sprintf("%s/%s", testDir, testImage), | ||
HypervisorPath: "", | ||
DefaultVCPUs: 1, | ||
DefaultMemSz: 2048, |
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.
Again, since this value is used here and in qemu_test.go
, I'd define the following at the top of virtcontainers_test.go
since that is where we place "shared" test variables:
const testDefaultMemSzMiB = 2048
A runtime implementation can use these fields to setup the default vCPU number and default memory size for new VMs. VMConfig can overwrite these settings. Signed-off-by: Dmitry Voytik <[email protected]>
98ff4b8
to
ceb467e
Compare
lgtm |
A runtime implementation can use these fields to setup the default
vCPU number and default memory size for new VMs.
VMConfig can overwrite these settings.
Signed-off-by: Dmitry Voytik [email protected]