[libvirt] [PATCH 0/4] Misc cleanups for internal.h

Looking at internal.h there was some cruft we could usefully clean out. Daniel P. Berrange (4): Remove duplicate define of __GNUC_PREREQ Require use of GCC 4.4 or CLang compilers Remove network constants out of internal.h Remove incorrectly used TODO macro config-post.h | 24 +++--- src/internal.h | 153 +++++++-------------------------- src/libxl/libxl_conf.c | 1 + src/nwfilter/nwfilter_dhcpsnoop.c | 1 + src/nwfilter/nwfilter_gentech_driver.c | 1 + src/qemu/qemu_conf.c | 1 + src/util/virsocketaddr.h | 16 ++++ src/util/virutil.c | 1 + src/vz/vz_sdk.c | 1 + src/xen/xen_hypervisor.c | 6 +- src/xen/xend_internal.c | 6 +- 11 files changed, 76 insertions(+), 135 deletions(-) -- 2.9.4

Back in this commit: commit b436a8ae5ccb04f8cf893d882d52ab5efc713307 Author: Fabian Freyer <fabian.freyer@physik.tu-berlin.de> Date: Thu Jun 9 00:50:35 2016 +0000 gnulib: add getopt module config-post.h was modified to define __GNUC_PREREQ, but the original definition was never removed from internal.h, and that is now dead code since config.h is always the first file included. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- config-post.h | 4 ++-- src/internal.h | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/config-post.h b/config-post.h index ffd0904..75e7d02 100644 --- a/config-post.h +++ b/config-post.h @@ -75,11 +75,11 @@ #endif /* LIBVIRT_NSS */ /* - * Define __GNUC__ to a sane default if it isn't yet defined. + * Define __GNUC_PREREQ to a sane default if it isn't yet defined. * This is done here so that it's included as early as possible; gnulib relies * on this to be defined in features.h, which should be included from ctype.h. * This doesn't happen on many non-glibc systems. - * When __GNUC__ is not defined, gnulib defines it to 0, which breaks things. + * When __GNUC_PREREQ is not defined, gnulib defines it to 0, which breaks things. */ #ifdef __GNUC__ # ifndef __GNUC_PREREQ diff --git a/src/internal.h b/src/internal.h index 03a973c..faf3e2b 100644 --- a/src/internal.h +++ b/src/internal.h @@ -106,18 +106,6 @@ # define __FUNCTION__ __func__ # endif -# ifdef __GNUC__ - -# ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif - -# endif /* __GNUC__ */ - /** * ATTRIBUTE_UNUSED: * -- 2.9.4

We only ever test libvirt with GCC or CLang which provides a GCC compatible compilation environment. Between them, these compilers cover every important operating system platform, even Windows. Mandate their use to make it explicit that we don't care about compilers like Microsoft VCC or other UNIX vendor C compilers. GCC 4.4 was picked as the baseline, since RHEL-6 ships 4.4.7 and that lets us remove a large set of checks. There is a slight issue that CLang reports itself as GCC 4.2, so we must also check if __clang__ is defined. We could check a particular CLang version too, but that would require someone to figure out a suitable min version which is fun because OS-X reports totally different CLang version numbers from CLang builds on Linux/BSD Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- config-post.h | 20 +++++----- src/internal.h | 116 ++++++++++++++++----------------------------------------- 2 files changed, 44 insertions(+), 92 deletions(-) diff --git a/config-post.h b/config-post.h index 75e7d02..4bddbac 100644 --- a/config-post.h +++ b/config-post.h @@ -74,6 +74,10 @@ # undef WITH_CAPNG #endif /* LIBVIRT_NSS */ +#ifndef __GNUC__ +# error "Libvirt requires GCC >= 4.4, or CLang" +#endif + /* * Define __GNUC_PREREQ to a sane default if it isn't yet defined. * This is done here so that it's included as early as possible; gnulib relies @@ -81,13 +85,11 @@ * This doesn't happen on many non-glibc systems. * When __GNUC_PREREQ is not defined, gnulib defines it to 0, which breaks things. */ -#ifdef __GNUC__ -# ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -# endif +#ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#endif + +#if !__GNUC_PREREQ(4, 4) || defined(__clang__) +# error "Libvirt requires GCC >= 4.4, or CLang" #endif diff --git a/src/internal.h b/src/internal.h index faf3e2b..9e2e72c 100644 --- a/src/internal.h +++ b/src/internal.h @@ -101,41 +101,32 @@ # define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0) # define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array))) -/* C99 uses __func__. __FUNCTION__ is legacy. */ -# ifndef __GNUC__ -# define __FUNCTION__ __func__ -# endif - /** * ATTRIBUTE_UNUSED: * * Macro to flag consciously unused parameters to functions */ -# ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__((__unused__)) -# endif +# ifndef ATTRIBUTE_UNUSED +# define ATTRIBUTE_UNUSED __attribute__((__unused__)) +# endif /** * ATTRIBUTE_NORETURN: * * Macro to indicate that a function won't return to the caller */ -# ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) -# endif +# ifndef ATTRIBUTE_NORETURN +# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) +# endif /** * ATTRIBUTE_SENTINEL: * * Macro to check for NULL-terminated varargs lists */ -# ifndef ATTRIBUTE_SENTINEL -# if __GNUC_PREREQ (4, 0) -# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__)) -# else -# define ATTRIBUTE_SENTINEL -# endif -# endif +# ifndef ATTRIBUTE_SENTINEL +# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__)) +# endif /** * ATTRIBUTE_NOINLINE: @@ -143,13 +134,9 @@ * Force compiler not to inline a method. Should be used if * the method need to be overridable by test mocks. */ -# ifndef ATTRIBUTE_NOINLINE -# if __GNUC_PREREQ (4, 0) -# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) -# else -# define ATTRIBUTE_NOINLINE -# endif -# endif +# ifndef ATTRIBUTE_NOINLINE +# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) +# endif /** * ATTRIBUTE_FMT_PRINTF @@ -161,23 +148,14 @@ * printf format specifiers even on broken Win32 platforms * hence we have to force 'gnu_printf' for new GCC */ -# ifndef ATTRIBUTE_FMT_PRINTF -# if __GNUC_PREREQ (4, 4) -# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \ - __attribute__((__format__ (__gnu_printf__, fmtpos, argpos))) -# else -# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \ - __attribute__((__format__ (__printf__, fmtpos, argpos))) -# endif -# endif +# ifndef ATTRIBUTE_FMT_PRINTF +# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \ + __attribute__((__format__ (__gnu_printf__, fmtpos, argpos))) +# endif -# ifndef ATTRIBUTE_RETURN_CHECK -# if __GNUC_PREREQ (3, 4) -# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) -# else -# define ATTRIBUTE_RETURN_CHECK -# endif -# endif +# ifndef ATTRIBUTE_RETURN_CHECK +# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) +# endif /** * ATTRIBUTE_PACKED @@ -188,13 +166,9 @@ * ethernet packets. * Others compiler than gcc may use something different e.g. #pragma pack(1) */ -# ifndef ATTRIBUTE_PACKED -# if __GNUC_PREREQ (3, 3) -# define ATTRIBUTE_PACKED __attribute__((packed)) -# else -# error "Need an __attribute__((packed)) equivalent" -# endif -# endif +# ifndef ATTRIBUTE_PACKED +# define ATTRIBUTE_PACKED __attribute__((packed)) +# endif /* gcc's handling of attribute nonnull is less than stellar - it does * NOT improve diagnostics, and merely allows gcc to optimize away @@ -205,45 +179,21 @@ * based on whether we are compiling for real or for analysis, while * still requiring correct gcc syntax when it is turned off. See also * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308 */ -# ifndef ATTRIBUTE_NONNULL -# if __GNUC_PREREQ (3, 3) -# if STATIC_ANALYSIS -# define ATTRIBUTE_NONNULL(m) __attribute__((__nonnull__(m))) -# else -# define ATTRIBUTE_NONNULL(m) __attribute__(()) -# endif -# else -# define ATTRIBUTE_NONNULL(m) -# endif -# endif - -# ifndef ATTRIBUTE_FALLTHROUGH -# if __GNUC_PREREQ (7, 0) -# define ATTRIBUTE_FALLTHROUGH __attribute__((fallthrough)) -# else -# define ATTRIBUTE_FALLTHROUGH do {} while(0) -# endif +# ifndef ATTRIBUTE_NONNULL +# if STATIC_ANALYSIS +# define ATTRIBUTE_NONNULL(m) __attribute__((__nonnull__(m))) +# else +# define ATTRIBUTE_NONNULL(m) __attribute__(()) # endif +# endif -# else -# ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED -# endif -# ifndef ATTRIBUTE_FMT_PRINTF -# define ATTRIBUTE_FMT_PRINTF(...) -# endif -# ifndef ATTRIBUTE_RETURN_CHECK -# define ATTRIBUTE_RETURN_CHECK -# endif -# ifndef ATTRIBUTE_NOINLINE -# define ATTRIBUTE_NOINLINE -# endif -# -# ifndef ATTRIBUTE_FALLTHROUGH +# ifndef ATTRIBUTE_FALLTHROUGH +# if __GNUC_PREREQ (7, 0) +# define ATTRIBUTE_FALLTHROUGH __attribute__((fallthrough)) +# else # define ATTRIBUTE_FALLTHROUGH do {} while(0) # endif -# endif /* __GNUC__ */ - +# endif # if WORKING_PRAGMA_PUSH # define VIR_WARNINGS_NO_CAST_ALIGN \ -- 2.9.4

On Wed, Jul 05, 2017 at 11:34:10AM +0100, Daniel P. Berrange wrote:
We only ever test libvirt with GCC or CLang which provides a GCC compatible compilation environment. Between them, these compilers cover every important operating system platform, even Windows.
Mandate their use to make it explicit that we don't care about compilers like Microsoft VCC or other UNIX vendor C compilers.
GCC 4.4 was picked as the baseline, since RHEL-6 ships 4.4.7 and that lets us remove a large set of checks. There is a slight issue that CLang reports itself as GCC 4.2, so we must also check if __clang__ is defined. We could check a particular CLang version too, but that would require someone to figure out a suitable min version which is fun because OS-X reports totally different CLang version numbers from CLang builds on Linux/BSD
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- config-post.h | 20 +++++----- src/internal.h | 116 ++++++++++++++++----------------------------------------- 2 files changed, 44 insertions(+), 92 deletions(-)
diff --git a/config-post.h b/config-post.h index 75e7d02..4bddbac 100644 --- a/config-post.h +++ b/config-post.h @@ -74,6 +74,10 @@ # undef WITH_CAPNG #endif /* LIBVIRT_NSS */
+#ifndef __GNUC__ +# error "Libvirt requires GCC >= 4.4, or CLang" +#endif + /* * Define __GNUC_PREREQ to a sane default if it isn't yet defined. * This is done here so that it's included as early as possible; gnulib relies @@ -81,13 +85,11 @@ * This doesn't happen on many non-glibc systems. * When __GNUC_PREREQ is not defined, gnulib defines it to 0, which breaks things. */ -#ifdef __GNUC__ -# ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -# endif +#ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#endif + +#if !__GNUC_PREREQ(4, 4) || defined(__clang__)
Opps, messed up precedence there - it should have been #if !(__GNUC_PREREQ(4, 4) || defined(__clang__))
+# error "Libvirt requires GCC >= 4.4, or CLang" #endif
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

The HOST_NAME_MAX, INET_ADDRSTRLEN and VIR_LOOPBACK_IPV4_ADDR constants are only used by a handful of files, so are better kept in virsocketaddr.h Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/internal.h | 16 ---------------- src/libxl/libxl_conf.c | 1 + src/nwfilter/nwfilter_dhcpsnoop.c | 1 + src/nwfilter/nwfilter_gentech_driver.c | 1 + src/qemu/qemu_conf.c | 1 + src/util/virsocketaddr.h | 16 ++++++++++++++++ src/util/virutil.c | 1 + src/vz/vz_sdk.c | 1 + 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/internal.h b/src/internal.h index 9e2e72c..bf1eeb5 100644 --- a/src/internal.h +++ b/src/internal.h @@ -65,22 +65,6 @@ # include "ignore-value.h" # include "count-leading-zeros.h" -/* On architectures which lack these limits, define them (ie. Cygwin). - * Note that the libvirt code should be robust enough to handle the - * case where actual value is longer than these limits (eg. by setting - * length correctly in second argument to gethostname and by always - * using strncpy instead of strcpy). - */ -# ifndef HOST_NAME_MAX -# define HOST_NAME_MAX 256 -# endif - -# ifndef INET_ADDRSTRLEN -# define INET_ADDRSTRLEN 16 -# endif - -# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" - /* String equality tests, suggested by Jim Meyering. */ # define STREQ(a, b) (strcmp(a, b) == 0) # define STRCASEEQ(a, b) (c_strcasecmp(a, b) == 0) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 938e09d..a85bc71 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -42,6 +42,7 @@ #include "viralloc.h" #include "viruuid.h" #include "vircommand.h" +#include "virsocketaddr.h" #include "libxl_domain.h" #include "libxl_conf.h" #include "libxl_utils.h" diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 702abe1..4436e39 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -65,6 +65,7 @@ #include "virnetdev.h" #include "virfile.h" #include "viratomic.h" +#include "virsocketaddr.h" #include "virthreadpool.h" #include "configmake.h" #include "virtime.h" diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index 82e20de..3d809fb 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -37,6 +37,7 @@ #include "nwfilter_learnipaddr.h" #include "virnetdev.h" #include "datatypes.h" +#include "virsocketaddr.h" #include "virstring.h" #define VIR_FROM_THIS VIR_FROM_NWFILTER diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 73c33d6..a65c92a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -49,6 +49,7 @@ #include "cpu/cpu.h" #include "domain_nwfilter.h" #include "virfile.h" +#include "virsocketaddr.h" #include "virstring.h" #include "viratomic.h" #include "storage_conf.h" diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h index 43a3706..ae76166 100644 --- a/src/util/virsocketaddr.h +++ b/src/util/virsocketaddr.h @@ -32,6 +32,22 @@ # include <sys/un.h> # endif +/* On architectures which lack these limits, define them (ie. Cygwin). + * Note that the libvirt code should be robust enough to handle the + * case where actual value is longer than these limits (eg. by setting + * length correctly in second argument to gethostname and by always + * using strncpy instead of strcpy). + */ +# ifndef HOST_NAME_MAX +# define HOST_NAME_MAX 256 +# endif + +# ifndef INET_ADDRSTRLEN +# define INET_ADDRSTRLEN 16 +# endif + +# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" + typedef struct { union { struct sockaddr sa; diff --git a/src/util/virutil.c b/src/util/virutil.c index e4de4ca..88fff64 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -81,6 +81,7 @@ #include "virprocess.h" #include "virstring.h" #include "virutil.h" +#include "virsocketaddr.h" verify(sizeof(gid_t) <= sizeof(unsigned int) && sizeof(uid_t) <= sizeof(unsigned int)); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 0aa1a30..c5f11a4 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -31,6 +31,7 @@ #include "domain_conf.h" #include "virtime.h" #include "virhostcpu.h" +#include "virsocketaddr.h" #include "storage/storage_driver.h" #include "vz_sdk.h" -- 2.9.4

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@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__); - -/** * 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]; -- 2.9.4

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@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];
participants (2)
-
Daniel P. Berrange
-
Jim Fehlig