[libvirt] PING: [RFC PATCH 0/3] Implement mockup capabilities cache in QEMU tests

Hello! I remember you were worrying about a temporary hack in qemu's postparse, because test suite could not generate proper capability cache. I promised to solve this, and here is (almost) a solution, i've outlined one small problem to solve together in the cover message. Since then, no response... Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
-----Original Message----- From: libvir-list-bounces@redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Pavel Fedin Sent: Tuesday, August 18, 2015 12:40 PM To: libvir-list@redhat.com Cc: Martin Kletzander Subject: [libvirt] [RFC PATCH 0/3] Implement mockup capabilities cache in QEMU tests
Since commit e8d55172544c1fafe31a9e09346bdebca4f0d6f9 qemu driver checks emulator capabilities during domain XML post-parse. However, test suite does not initialize it, therefore a condition to skip all checks if there is no cache supplied was added. This is actually a hack, whose sole purpose is to make existing test suite working. Additionally, it prevents from writing new tests for this particular functionality.
This series attempts to solve this problem by implementing proper cache mockup in test suite. The main idea is to create a cache in standard way and put there a pre-defined capabilities set (which tests already have).
The main problem here is to know emulator binary name, which is contained in the source XML. However, we have to create our cache before reading the XML. The simplest way to resolve this is to assume particular binary name from test name. Currently tests which assume cross-architecture binary are all prefixed with the architecture name (with one exception of "keywrap" tests which all assume /usr/bin/qemu-system-s390x and do not have "s390-" prefix in their name).
This scheme works fine, unless we use "native" emulator binary. Here we have a mess. Most newer tests use /usr/bin/qemu, however there is a large number of tests which use /usr/libexec/qemu-kvm or /usr/bin/kvm (i guess these are leftovers from the epoch when qemu-kvm was a separate fork of qemu). This is currently not handled in any way, and these tests may report errors due to missing binaries (because virQEMUCapsCacheLookup() attempts to populate the cache automatically by querying the binary if not already known).
There are several possible ways to resolve this: a) Add all possible names as aliases for /usr/bin/qemu b) Forbid to use oldstyle names at all in these tests c) Declare some prefix like "kvm-" for those tests who want to use /usr/libexec/qemu-kvm. Again, this would ban /usr/bin/kvm and /usr/bin/qemu-kvm (if not using aliases like in (b) d) Hardcode (optional) emulator name per test. IMHO a bad idea because number of tests is huge. e) Do some preparsing of the XML and extract binary name from it. Again, i disliked it for not being simple enough.
I also thought about an alternate implementation which would patch postParseCallback and insert own function there which builds a cache. At this point binary name is already known from the XML. However, such a design looks like an ugly hack by itself, so i stopped going in this direction.
Comments and opinions are welcome.
Pavel Fedin (3): Implement virQEMUCapsCache mockup Use mockup cache Removed unneeded check
src/qemu/qemu_capabilities.c | 10 +--------- src/qemu/qemu_capspriv.h | 36 +++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.c | 5 +---- tests/qemuagenttest.c | 9 ++++++++- tests/qemuargv2xmltest.c | 5 +++++ tests/qemuhotplugtest.c | 23 ++++++++++++++-------- tests/qemuxml2argvtest.c | 5 +++++ tests/qemuxml2xmltest.c | 6 ++++++ tests/qemuxmlnstest.c | 5 +++++ tests/testutilsqemu.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ tests/testutilsqemu.h | 3 +++ 11 files changed, 130 insertions(+), 22 deletions(-) create mode 100644 src/qemu/qemu_capspriv.h mode change 100644 => 100755 tests/qemuagenttest.c mode change 100644 => 100755 tests/qemuhotplugtest.c mode change 100644 => 100755 tests/qemuxml2xmltest.c mode change 100644 => 100755 tests/testutilsqemu.c
-- 2.1.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 08/27/2015 02:37 AM, Pavel Fedin wrote:
Hello! I remember you were worrying about a temporary hack in qemu's postparse, because test suite could not generate proper capability cache. I promised to solve this, and here is (almost) a solution, i've outlined one small problem to solve together in the cover message. Since then, no response...
Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
Sorry about all the delays, I'll be more responsive going forward. For my part I've been offline for 2 weeks on my honeymoon, just came back today... it's been a hectic 2 months for me between moving across the state, planning a wedding, then travelling out of the country for 2 weeks. I'm back now so I'll check the patches when I get caught up on other stuff. Most other people on this list were preparing for and attending KVM forum/Linuxcon the past couple weeks. So it's just bad timing in this case - Cole
-----Original Message----- From: libvir-list-bounces@redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Pavel Fedin Sent: Tuesday, August 18, 2015 12:40 PM To: libvir-list@redhat.com Cc: Martin Kletzander Subject: [libvirt] [RFC PATCH 0/3] Implement mockup capabilities cache in QEMU tests
Since commit e8d55172544c1fafe31a9e09346bdebca4f0d6f9 qemu driver checks emulator capabilities during domain XML post-parse. However, test suite does not initialize it, therefore a condition to skip all checks if there is no cache supplied was added. This is actually a hack, whose sole purpose is to make existing test suite working. Additionally, it prevents from writing new tests for this particular functionality.
This series attempts to solve this problem by implementing proper cache mockup in test suite. The main idea is to create a cache in standard way and put there a pre-defined capabilities set (which tests already have).
The main problem here is to know emulator binary name, which is contained in the source XML. However, we have to create our cache before reading the XML. The simplest way to resolve this is to assume particular binary name from test name. Currently tests which assume cross-architecture binary are all prefixed with the architecture name (with one exception of "keywrap" tests which all assume /usr/bin/qemu-system-s390x and do not have "s390-" prefix in their name).
This scheme works fine, unless we use "native" emulator binary. Here we have a mess. Most newer tests use /usr/bin/qemu, however there is a large number of tests which use /usr/libexec/qemu-kvm or /usr/bin/kvm (i guess these are leftovers from the epoch when qemu-kvm was a separate fork of qemu). This is currently not handled in any way, and these tests may report errors due to missing binaries (because virQEMUCapsCacheLookup() attempts to populate the cache automatically by querying the binary if not already known).
There are several possible ways to resolve this: a) Add all possible names as aliases for /usr/bin/qemu b) Forbid to use oldstyle names at all in these tests c) Declare some prefix like "kvm-" for those tests who want to use /usr/libexec/qemu-kvm. Again, this would ban /usr/bin/kvm and /usr/bin/qemu-kvm (if not using aliases like in (b) d) Hardcode (optional) emulator name per test. IMHO a bad idea because number of tests is huge. e) Do some preparsing of the XML and extract binary name from it. Again, i disliked it for not being simple enough.
I also thought about an alternate implementation which would patch postParseCallback and insert own function there which builds a cache. At this point binary name is already known from the XML. However, such a design looks like an ugly hack by itself, so i stopped going in this direction.
Comments and opinions are welcome.
Pavel Fedin (3): Implement virQEMUCapsCache mockup Use mockup cache Removed unneeded check
src/qemu/qemu_capabilities.c | 10 +--------- src/qemu/qemu_capspriv.h | 36 +++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.c | 5 +---- tests/qemuagenttest.c | 9 ++++++++- tests/qemuargv2xmltest.c | 5 +++++ tests/qemuhotplugtest.c | 23 ++++++++++++++-------- tests/qemuxml2argvtest.c | 5 +++++ tests/qemuxml2xmltest.c | 6 ++++++ tests/qemuxmlnstest.c | 5 +++++ tests/testutilsqemu.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ tests/testutilsqemu.h | 3 +++ 11 files changed, 130 insertions(+), 22 deletions(-) create mode 100644 src/qemu/qemu_capspriv.h mode change 100644 => 100755 tests/qemuagenttest.c mode change 100644 => 100755 tests/qemuhotplugtest.c mode change 100644 => 100755 tests/qemuxml2xmltest.c mode change 100644 => 100755 tests/testutilsqemu.c
-- 2.1.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Hello!
Sorry about all the delays, I'll be more responsive going forward.
For my part I've been offline for 2 weeks on my honeymoon, just came back today...
Wow, congratulations then! I didn't know, of course, this is very important thing. And of course i know about LinuxCon too, unfortunately i was unable to get a US visa in time, so my attendance failed. :( Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
participants (2)
-
Cole Robinson
-
Pavel Fedin