[Libvir] [PATCH] setmem checks

Mark Johnson johnson.nh at gmail.com
Thu Jun 14 20:45:49 UTC 2007


This one may be a little contentious...

This patch does a couple of things... It won't let you
set memory if the value is greater that maxmem.
It also will lower memory if max memory is set
to less than memory.

I think it's a good argument that this checking
should be in the hypervisor control daemon.
IMO, it should be both here and in the daemon.

I have no idea why the patch diff is so big,
Below is the diff after it is applied.  A little easier
to read.


Mark

[root at fedora libvirt]# diff src/virsh.orig src/virsh.c
1664a1665
>     virDomainInfo info;
1673a1675,1677
>     if (virDomainGetInfo(dom, &info) != 0) {
>       info.maxMem = 0;
>     }
1675c1679
<     if (kilobytes <= 0) {
---
>     if ((kilobytes <= 0)  || (kilobytes > info.maxMem)) {
1708a1713
>     virDomainInfo info;
1723a1729,1737
>     if (virDomainGetInfo(dom, &info) != 0) {
>       info.memory = 0x7fffffff;
>     }
>
>     if (kilobytes < info.memory) {
>        if (virDomainSetMemory(dom, kilobytes) != 0) {
>           return FALSE;
>        }
>     }
[root at fedora libvirt]#
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setmem-fixes
Type: application/octet-stream
Size: 3302 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070614/64fb71ba/attachment-0001.obj>


More information about the libvir-list mailing list