libxl: introduce the concept of dom0 minimum memory
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 22 Sep 2010 16:40:44 +0000 (17:40 +0100)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 22 Sep 2010 16:40:44 +0000 (17:40 +0100)
Introduce a minimum value for the memory assigned to dom0.

[fixed up for conflicts with libxl__ naming policy changes -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_internal.h

index 8687441f1b922d8b813b993c14b7bb7ea0cf82ac..83830d1dbd0c82c0046bee8e0db8381a2bb47c94 100644 (file)
@@ -2916,6 +2916,12 @@ retry_transaction:
         abort = 1;
         goto out;
     }
+    if (!domid && new_target_memkb < LIBXL_MIN_DOM0_MEM) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                "new target for dom0 is below the minimum threshold\n");
+        abort = 1;
+        goto out;
+    }
 
     if (relative)
         new_target_memkb = current_target_memkb + target_memkb;
index 97e92965f62391b70f05bb528a0005ac1ee854b3..180fdcd1ea1dadd7451e12d5c78cbf15ffc419cd 100644 (file)
@@ -43,6 +43,7 @@
 #define LIBXL_MAXMEM_CONSTANT 1024
 #define LIBXL_PV_EXTRA_MEMORY 1024
 #define LIBXL_HVM_EXTRA_MEMORY 2048
+#define LIBXL_MIN_DOM0_MEM (128*1024)
 #define QEMU_SIGNATURE "QemuDeviceModelRecord"
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))