Hi
The minimum value of the memory guarded with virsh setmem is 4096KB(4MB).
In general, when host's memory is set to 4MB, the host stops.
Therefore, I propose the patch to which host's minimum value of the memory
is guarded by 256MB.
Signed-off-by: Masayuki Sunou <fj1826dm(a)aa.jp.fujitsu.com>
Thanks,
Masayuki Sunou.
libvirt-0.2.0
--------------------------------------------------------------------------------
Index: libvirt/src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.97
diff -u -p -r1.97 xend_internal.c
--- libvirt/src/xend_internal.c 2 Mar 2007 20:19:08 -0000 1.97
+++ libvirt/src/xend_internal.c 6 Mar 2007 01:42:44 -0000
@@ -2243,6 +2243,9 @@ xenDaemonDomainSetMemory(virDomainPtr do
if (domain->id < 0 && domain->conn->xendConfigVersion < 3)
return(-1);
+ if (domain->id == 0 && memory < (256 * 1024))
+ return(-1);
+
snprintf(buf, sizeof(buf), "%lu", memory >> 10);
return xend_op(domain->conn, domain->name, "op",
"mem_target_set",
"target", buf, NULL);
Index: libvirt/src/xm_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xm_internal.c,v
retrieving revision 1.14
diff -u -p -r1.14 xm_internal.c
--- libvirt/src/xm_internal.c 23 Feb 2007 08:51:30 -0000 1.14
+++ libvirt/src/xm_internal.c 6 Mar 2007 01:42:46 -0000
@@ -1025,6 +1025,9 @@ int xenXMDomainSetMemory(virDomainPtr do
if (domain->id != -1)
return (-1);
+ if (domain->id == 0 && memory < (256 * 1024))
+ return(-1);
+
if (!(filename = virHashLookup(nameConfigMap, domain->name)))
return (-1);
Index: libvirt/src/xs_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xs_internal.c,v
retrieving revision 1.32
diff -u -p -r1.32 xs_internal.c
--- libvirt/src/xs_internal.c 23 Feb 2007 08:51:30 -0000 1.32
+++ libvirt/src/xs_internal.c 6 Mar 2007 01:42:46 -0000
@@ -434,6 +434,10 @@ xenStoreDomainSetMemory(virDomainPtr dom
}
if (domain->id == -1)
return(-1);
+
+ if (domain->id == 0 && memory < (256 * 1024))
+ return(-1);
+
snprintf(value, 19, "%lu", memory);
value[19] = 0;
ret = virDomainDoStoreWrite(domain, "memory/target", &value[0]);
--------------------------------------------------------------------------------