Re: [LTP] [PATCH] lib/tst_virt: rename is_kvm to is_qemu

Wanlong Gao
2015-03-03T01:58:26Z

On 03/03/2015 09:35 AM, Wei,Jiangang wrote:
> KVM guest is on top of QEMU, and KVM is used by QEMU to
> provide hardware-accelerated virtualization.
> Although there is an association between them,
> difference is very obvious.
>
> The function named is_kvm() is only can be applied to
> determine QEMU, which couldn't distinguish QEMU and QEMU-KVM.
> In other words,
> Its' name doesn't match its' content and function.
> so is_qemu() more reasonable.

NACK, KVM is the name in the same stand of Xen, while qemu
is just a client program. You are making wrong sense to others.

Thanks,
Wanlong Gao

>
> Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
> ---
> include/test.h | 2 +-
> lib/tst_virt.c | 6 +++---
> testcases/kernel/syscalls/getrusage/getrusage04.c | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/test.h b/include/test.h
> index f45bb36..12f913b 100644
> --- a/include/test.h
> +++ b/include/test.h
> @@ -54,7 +54,7 @@
>
> /* virt types for tst_is_virt() */
> #define VIRT_XEN 1 /* xen dom0/domU */
> -#define VIRT_KVM 2 /* only default virtual CPU */
> +#define VIRT_QEMU 2 /* only default virtual CPU */
>
> /*
> * Ensure that NUMSIGS is defined.
> diff --git a/lib/tst_virt.c b/lib/tst_virt.c
> index 87f73dc..d0d701e 100644
> --- a/lib/tst_virt.c
> +++ b/lib/tst_virt.c
> @@ -26,7 +26,7 @@
> #include "test.h"
> #include "safe_macros.h"
>
> -static int is_kvm(void)
> +static int is_qemu(void)
> {
> FILE *cpuinfo;
> char line[64];
> @@ -69,8 +69,8 @@ int tst_is_virt(int virt_type)
> switch (virt_type) {
> case VIRT_XEN:
> return is_xen();
> - case VIRT_KVM:
> - return is_kvm();
> + case VIRT_QEMU:
> + return is_qemu();
> }
> tst_brkm(TBROK, NULL, "invalid virt_type flag: %d", virt_type);
> }
> diff --git a/testcases/kernel/syscalls/getrusage/getrusage04.c b/testcases/kernel/syscalls/getrusage/getrusage04.c
> index c2f34f4..f34f0c1 100644
> --- a/testcases/kernel/syscalls/getrusage/getrusage04.c
> +++ b/testcases/kernel/syscalls/getrusage/getrusage04.c
> @@ -200,7 +200,7 @@ static void setup(void)
> {
> tst_sig(NOFORK, DEF_HANDLER, cleanup);
>
> - if (tst_is_virt(VIRT_XEN) || tst_is_virt(VIRT_KVM))
> + if (tst_is_virt(VIRT_XEN) || tst_is_virt(VIRT_QEMU))
> tst_brkm(TCONF, NULL, "This testcase is not supported on this"
> " virtual machine.");