Skip to content

Commit

Permalink
utils/qemu: allow to specify qemu size
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
  • Loading branch information
outscale-mgo committed Jan 2, 2020
1 parent 4e3410c commit 11a8fca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ hugetlbfs /mnt/huge hugetlbfs rw,mode=0777 0 0

# Compille Time Option
-DTAP_IGNORE_ERROR: when packetgrapg can't burst or poll a tap, it return 0 instead of returning an error
-DPG_QEMU_MEM_SIZE=SIZE: allow to specify qemy ram size in test, parameter must be a string in qemu format, examples: -DPG_QEMU_MEM_SIZE="1G", -DPG_QEMU_MEM_SIZE="512M"

# Licence

Expand Down
5 changes: 4 additions & 1 deletion src/utils/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ static inline void pg_brick_ptrptr_destroy(struct pg_brick **brick)
#define PG_STRCAT7(a, b, c, d, e, f, g) (a b c d e f g)
#define PG_STRCAT8(a, b, c, d, e, f, g, h) (a b c d e f g h)
#define PG_STRCAT9(a, b, c, d, e, f, g, h, i) (a b c d e f g h i)
#define PG_STRCAT10(a, b, c, d, e, f, g, h, i, j) (a b c d e f g h i j)
#define PG_STRCAT10(a, b, c, d, e, f, g, h, i, j) \
(a b c d e f g h i j)
#define PG_STRCAT11(a, b, c, d, e, f, g, h, i, j, k) \
(a b c d e f g h i j k)

#define PG_CAT(a, b) a ## b

Expand Down
13 changes: 10 additions & 3 deletions src/utils/qemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#include "utils/qemu.h"
#include "utils/common.h"

#ifndef PG_QEMU_MEM_SIZE
#define PG_QEMU_MEM_SIZE "128G"
#endif

int pg_util_cmdloop(const char *cmd, int timeout_s)
{
struct timeval start, end;
Expand Down Expand Up @@ -111,10 +115,13 @@ int pg_util_spawn_qemu(const char *socket_path_0,

argv_qemu = g_strdup_printf(
PG_STRCAT(
"qemu-system-x86_64 -m 1G -enable-kvm",
"qemu-system-x86_64 -m ",
PG_QEMU_MEM_SIZE,
" -enable-kvm",
" -vnc :%u -display none -snapshot -object",
" memory-backend-file,id=mem,size=1G,",
"mem-path=%s,share=on -numa node,memdev=mem",
" memory-backend-file,id=mem,size=",
PG_QEMU_MEM_SIZE,
",mem-path=%s,share=on -numa node,memdev=mem",
" -mem-prealloc -drive file=%s",
" -netdev user,id=net0,hostfwd=tcp::%u-:22",
" -device e1000,netdev=net0%s%s",
Expand Down

0 comments on commit 11a8fca

Please sign in to comment.