diff options
author | liguang <lig.fnst@cn.fujitsu.com> | 2013-01-24 13:03:26 +0800 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-02-01 15:07:44 -0600 |
commit | 217e21be6e0f2c1caa0b644f56aa60dba7ea7893 (patch) | |
tree | 4a416b08b5ff8e502f3ca637e5541d2cef7639fa /vl.c | |
parent | e3c66d939480e0f372316c22184c07fb3de12873 (diff) |
vl: correct error message when fail to init kvm
command:
qemu-system-x86_64 -hda disk.img -smp 32 --enable-kvm
error:
Number of SMP cpus requested (32) exceeds max cpus supported by KVM (16)
failed to initialize KVM: Invalid argument
No accelerator found!
well, it did find kvm, but failed to init,
so message "No accelerator found!" is confusing,
this commit remove the confusing error message.
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -2557,8 +2557,8 @@ static int configure_accelerator(void) const char *p = NULL; char buf[10]; int i, ret; - bool accel_initialised = 0; - bool init_failed = 0; + bool accel_initialised = false; + bool init_failed = false; QemuOptsList *list = qemu_find_opts("machine"); if (!QTAILQ_EMPTY(&list->head)) { @@ -2585,13 +2585,13 @@ static int configure_accelerator(void) *(accel_list[i].allowed) = 1; ret = accel_list[i].init(); if (ret < 0) { - init_failed = 1; + init_failed = true; fprintf(stderr, "failed to initialize %s: %s\n", accel_list[i].name, strerror(-ret)); *(accel_list[i].allowed) = 0; } else { - accel_initialised = 1; + accel_initialised = true; } break; } @@ -2602,7 +2602,9 @@ static int configure_accelerator(void) } if (!accel_initialised) { - fprintf(stderr, "No accelerator found!\n"); + if (!init_failed) { + fprintf(stderr, "No accelerator found!\n"); + } exit(1); } |