[libvirt] [PATCH] qemu: improve error message for domain stats API

Filtering specific list of domains is not supported yet. Print a better error message. old error message: error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats new error message: error: using filters with list of domains is not implemented yet Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143837 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Luyao Huang <lhuang@redhat.com> --- Based on https://www.redhat.com/archives/libvir-list/2014-November/msg00069.html with different commit and error message. src/qemu/qemu_driver.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f8d493d..b88e2cc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19809,15 +19809,19 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, unsigned int privflags = 0; unsigned int domflags = 0; - if (ndoms) - virCheckFlags(VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING | - VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -1); - else - virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE | - VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT | - VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE | - VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING | - VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -1); + if (ndoms && (flags & (VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE | + VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT | + VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE))) { + virReportInvalidArg(flags, "%s", _("using filters with list of domains " + "is not implemented yet")); + return -1; + } + + virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE | + VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT | + VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE | + VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING | + VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -1); if (virConnectGetAllDomainStatsEnsureACL(conn) < 0) return -1; -- 2.3.6

On 04.05.2015 12:44, Pavel Hrdina wrote:
Filtering specific list of domains is not supported yet. Print a better error message.
old error message: error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
new error message: error: using filters with list of domains is not implemented yet
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143837
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Luyao Huang <lhuang@redhat.com> ---
Based on https://www.redhat.com/archives/libvir-list/2014-November/msg00069.html with different commit and error message.
src/qemu/qemu_driver.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
NACK. Once Peter's series is merged, this feature is implemented. https://www.redhat.com/archives/libvir-list/2015-April/msg01561.html Michal

On Mon, May 04, 2015 at 01:29:03PM +0200, Michal Privoznik wrote:
On 04.05.2015 12:44, Pavel Hrdina wrote:
Filtering specific list of domains is not supported yet. Print a better error message.
old error message: error: unsupported flags (0x1) in function qemuConnectGetAllDomainStats
new error message: error: using filters with list of domains is not implemented yet
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143837
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Luyao Huang <lhuang@redhat.com> ---
Based on https://www.redhat.com/archives/libvir-list/2014-November/msg00069.html with different commit and error message.
src/qemu/qemu_driver.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
NACK. Once Peter's series is merged, this feature is implemented.
https://www.redhat.com/archives/libvir-list/2015-April/msg01561.html
Michal
That's good. I should probably read all marked series to catch up on things and not post another patch like this :). I'll watch that series and close the bug after it will get merged. Pavel
participants (2)
-
Michal Privoznik
-
Pavel Hrdina