On 07/05/2017 04:34 AM, Daniel P. Berrange wrote:
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 <berrange(a)redhat.com>
---
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 bf1eeb5..6a4a91f 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -239,15 +239,6 @@
# define EMPTYSTR(s) ((s) ? (s) : "-")
/**
- * TODO:
- *
- * macro to flag unimplemented blocks
- */
-# define TODO \
- fprintf(stderr, "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-/**
Yuk. ACK to killing it!
Regards,
Jim
* SWAP:
*
* In place exchange of two values
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index bce7b56..c4d7b2d 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,
+ _("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,
+ _("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 605c3cd..e0404e1 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,
+ _("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,
+ _("SEDF schedular parameters not supported"));
goto error;
case XEN_SCHED_CRED_NPARAM: {
char buf_weight[VIR_UUID_BUFLEN];