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@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@fedora libvirt]#
Attachment:
setmem-fixes
Description: Binary data