提交 217e21be 编写于 作者: L liguang 提交者: Anthony Liguori

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: Nliguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 e3c66d93
...@@ -2557,8 +2557,8 @@ static int configure_accelerator(void) ...@@ -2557,8 +2557,8 @@ static int configure_accelerator(void)
const char *p = NULL; const char *p = NULL;
char buf[10]; char buf[10];
int i, ret; int i, ret;
bool accel_initialised = 0; bool accel_initialised = false;
bool init_failed = 0; bool init_failed = false;
QemuOptsList *list = qemu_find_opts("machine"); QemuOptsList *list = qemu_find_opts("machine");
if (!QTAILQ_EMPTY(&list->head)) { if (!QTAILQ_EMPTY(&list->head)) {
...@@ -2585,13 +2585,13 @@ static int configure_accelerator(void) ...@@ -2585,13 +2585,13 @@ static int configure_accelerator(void)
*(accel_list[i].allowed) = 1; *(accel_list[i].allowed) = 1;
ret = accel_list[i].init(); ret = accel_list[i].init();
if (ret < 0) { if (ret < 0) {
init_failed = 1; init_failed = true;
fprintf(stderr, "failed to initialize %s: %s\n", fprintf(stderr, "failed to initialize %s: %s\n",
accel_list[i].name, accel_list[i].name,
strerror(-ret)); strerror(-ret));
*(accel_list[i].allowed) = 0; *(accel_list[i].allowed) = 0;
} else { } else {
accel_initialised = 1; accel_initialised = true;
} }
break; break;
} }
...@@ -2602,7 +2602,9 @@ static int configure_accelerator(void) ...@@ -2602,7 +2602,9 @@ static int configure_accelerator(void)
} }
if (!accel_initialised) { if (!accel_initialised) {
fprintf(stderr, "No accelerator found!\n"); if (!init_failed) {
fprintf(stderr, "No accelerator found!\n");
}
exit(1); exit(1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册