From 1dbbcb629a9edbc1ab1b0fb5bbdbe1878e9e15b8 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 5 Jul 2017 11:24:48 +0100 Subject: [PATCH] Remove incorrectly used TODO macro The TODO macro expands to an fprintf() call and is used in several places in the Xen driver. Anything that wishes to print such debug messages should use the logging macros. In this case though, all the places in the Xen driver should have been raising a formal libvirt error instead. Add proper error handling and delete the TODO macro to prevent future misuse. Signed-off-by: Daniel P. Berrange --- src/internal.h | 9 --------- src/xen/xen_hypervisor.c | 6 ++++-- src/xen/xend_internal.c | 6 ++++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/internal.h b/src/internal.h index 2b8cc0922a..c29f20f022 100644 --- a/src/internal.h +++ b/src/internal.h @@ -243,15 +243,6 @@ */ # define EMPTYSTR(s) ((s) ? (s) : "-") -/** - * TODO: - * - * macro to flag unimplemented blocks - */ -# define TODO \ - fprintf(stderr, "Unimplemented block at %s:%d\n", \ - __FILE__, __LINE__); - /** * SWAP: * diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index bce7b56123..e18a4729db 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -1262,7 +1262,8 @@ xenHypervisorGetSchedulerParameters(virConnectPtr conn, } /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("SEDF schedular parameters not supported")); return -1; case XEN_SCHEDULER_CREDIT: memset(&op_dom, 0, sizeof(op_dom)); @@ -1359,7 +1360,8 @@ xenHypervisorSetSchedulerParameters(virConnectPtr conn, switch (op_sys.u.getschedulerid.sched_id) { case XEN_SCHEDULER_SEDF: /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("SEDF schedular parameters not supported")); return -1; case XEN_SCHEDULER_CREDIT: { memset(&op_dom, 0, sizeof(op_dom)); diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 605c3cdccf..6da2950901 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -2881,7 +2881,8 @@ xenDaemonGetSchedulerParameters(virConnectPtr conn, } /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("SEDF schedular parameters not supported")); goto error; case XEN_SCHED_CRED_NPARAM: /* get cpu_weight/cpu_cap from xend/domain */ @@ -2972,7 +2973,8 @@ xenDaemonSetSchedulerParameters(virConnectPtr conn, switch (sched_nparam) { case XEN_SCHED_SEDF_NPARAM: /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("SEDF schedular parameters not supported")); goto error; case XEN_SCHED_CRED_NPARAM: { char buf_weight[VIR_UUID_BUFLEN]; -- GitLab