]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Move comments to virQEMUCapsGuestIsNative()
authorAndrea Bolognani <abologna@redhat.com>
Tue, 18 Sep 2018 11:32:29 +0000 (13:32 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 21 Sep 2018 13:53:35 +0000 (15:53 +0200)
The function performing the checks, rather than its callers,
should contain comments explaining the rationale behind said
checks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_capabilities.c

index 394202942f0ab96da8156ffb0e7a97efc5203d23..2bfd94995f00a0a4c89427d1ecd8b4c75f6ec9b8 100644 (file)
@@ -631,15 +631,19 @@ bool
 virQEMUCapsGuestIsNative(virArch host,
                          virArch guest)
 {
+    /* host & guest arches match */
     if (host == guest)
         return true;
 
+    /* hostarch is x86_64 and guest arch is i686 (needs -cpu qemu32) */
     if (host == VIR_ARCH_X86_64 && guest == VIR_ARCH_I686)
         return true;
 
+    /* hostarch is aarch64 and guest arch is armv7l (needs -cpu aarch64=off) */
     if (host == VIR_ARCH_AARCH64 && guest == VIR_ARCH_ARMV7L)
         return true;
 
+    /* hostarch and guestarch are both ppc64 */
     if (ARCH_IS_PPC64(host) && ARCH_IS_PPC64(guest))
         return true;
 
@@ -753,12 +757,6 @@ virQEMUCapsInitGuest(virCapsPtr caps,
         }
     }
 
-    /* qemu-kvm/kvm binaries can only be used if
-     *  - host & guest arches match
-     *  - hostarch is x86_64 and guest arch is i686 (needs -cpu qemu32)
-     *  - hostarch is aarch64 and guest arch is armv7l (needs -cpu aarch64=off)
-     *  - hostarch and guestarch are both ppc64*
-     */
     if (virQEMUCapsGuestIsNative(hostarch, guestarch)) {
         const char *kvmbins[] = {
             "/usr/libexec/qemu-kvm", /* RHEL */