[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: Specify the target ram size to Qemu (new) when calling it



# HG changeset patch
# User Anthony PERARD <anthony.perard@xxxxxxxxxx>
# Date 1294324053 0
# Node ID 6874a9d26fd98661a0806d5de8333b30199d6d5e
# Parent  63fd6f886f49683de71bb3f687c52eb123adac6e
libxl: Specify the target ram size to Qemu (new) when calling it

This patch adds target_ram in device_model_info structure, to be used in
libxl_build_device_model_args_new. Qemu upstream needs to know about it.

It introduces also libxl__sizekb_to_mb to convert size from KB to MB by
rounding up the result.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c       |    4 ++++
 tools/libxl/libxl.idl     |    1 +
 tools/libxl/libxl_utils.h |    4 ++++
 tools/libxl/xl_cmdimpl.c  |    3 ++-
 4 files changed, 11 insertions(+), 1 deletion(-)

diff -r 63fd6f886f49 -r 6874a9d26fd9 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Jan 06 14:25:10 2011 +0000
+++ b/tools/libxl/libxl.c       Thu Jan 06 14:27:33 2011 +0000
@@ -1389,6 +1389,10 @@ static char ** libxl_build_device_model_
         flexarray_set(dm_args, num++, "xenpv");
     else
         flexarray_set(dm_args, num++, "xenfv");
+
+    /* RAM Size */
+    flexarray_set(dm_args, num++, "-m");
+    flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->target_ram));
 
     if (info->type == XENFV) {
         disks = libxl_device_disk_list(libxl__gc_owner(gc), info->domid, &nb);
diff -r 63fd6f886f49 -r 6874a9d26fd9 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl     Thu Jan 06 14:25:10 2011 +0000
+++ b/tools/libxl/libxl.idl     Thu Jan 06 14:27:33 2011 +0000
@@ -140,6 +140,7 @@ libxl_device_model_info = Struct("device
     ("device_model",     string),
     ("saved_state",      string),
     ("type",             libxl_qemu_machine_type),
+    ("target_ram",       uint32),
     ("videoram",         integer,           False, "size of the videoram in 
MB"),
     ("stdvga",           bool,              False, "stdvga enabled or 
disabled"),
     ("vnc",              bool,              False, "vnc enabled or disabled"),
diff -r 63fd6f886f49 -r 6874a9d26fd9 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h Thu Jan 06 14:25:10 2011 +0000
+++ b/tools/libxl/libxl_utils.h Thu Jan 06 14:27:33 2011 +0000
@@ -85,5 +85,9 @@ void libxl_cpumap_reset(libxl_cpumap *cp
 
 int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
 
+static inline uint32_t libxl__sizekb_to_mb(uint32_t s) {
+    return (s + 1023) / 1024;
+}
+
 #endif
 
diff -r 63fd6f886f49 -r 6874a9d26fd9 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Jan 06 14:25:10 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Jan 06 14:27:33 2011 +0000
@@ -359,7 +359,8 @@ static void init_dm_info(libxl_device_mo
 
     dm_info->dom_name = strdup(c_info->name);
     dm_info->device_model = strdup("qemu-dm");
-    dm_info->videoram = b_info->video_memkb / 1024;
+    dm_info->target_ram = libxl__sizekb_to_mb(b_info->target_memkb);
+    dm_info->videoram = libxl__sizekb_to_mb(b_info->video_memkb);
     dm_info->apic = b_info->u.hvm.apic;
     dm_info->vcpus = b_info->max_vcpus;
     dm_info->vcpu_avail = b_info->cur_vcpus;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.