[libvirt] [PATCH 0/2] Xen: cleanup use of virErrorDomain enum

While reviewing a patch from Ian Campbell, I noticed the various Xen-related elements in the virErrorDomain enum were not used correctly throughout the corresponding source files. Patch 1 fixes use of existing Xen-related elements in virErrorDomain. Patch 2 adds a new element for Xen XL config and uses it in src/xenconfig/xen_xl.c. Jim Fehlig (2): Xen: VIR_FROM_THIS cleanup Xen: add XENXL to virErrorDomain enum include/libvirt/virterror.h | 1 + src/util/virerror.c | 1 + src/xen/xs_internal.c | 2 +- src/xenconfig/xen_common.c | 1 + src/xenconfig/xen_sxpr.c | 2 ++ src/xenconfig/xen_xl.c | 2 +- src/xenconfig/xen_xm.c | 1 + src/xenconfig/xenxs_private.h | 2 -- 8 files changed, 8 insertions(+), 4 deletions(-) -- 2.6.1

The virErrorDomain enum has VIR_FROM_XEN, VIR_FROM_XEND, VIR_FROM_XENSTORE, VIR_FROM_SEXPR, and VIR_FROM_XENXM. Use these elements in the corresponding .c files. While at it, remove the VIR_FROM_THIS define in src/xenconfig/xenxs_private.h. Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- src/xen/xs_internal.c | 2 +- src/xenconfig/xen_common.c | 1 + src/xenconfig/xen_sxpr.c | 2 ++ src/xenconfig/xen_xm.c | 1 + src/xenconfig/xenxs_private.h | 2 -- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 7e2d477..7c82a34 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -52,7 +52,7 @@ #include "xen_hypervisor.h" #include "virstring.h" -#define VIR_FROM_THIS VIR_FROM_XEN +#define VIR_FROM_THIS VIR_FROM_XENSTORE VIR_LOG_INIT("xen.xs_internal"); diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 7cc8639..284a2e5 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -39,6 +39,7 @@ #include "virstring.h" #include "xen_common.h" +#define VIR_FROM_THIS VIR_FROM_XEN /* * Convenience method to grab a long int from the config file object diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index cd6f207..252a48b 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -41,6 +41,8 @@ #include "virstoragefile.h" #include "virstring.h" +#define VIR_FROM_THIS VIR_FROM_SEXPR + VIR_LOG_INIT("xenconfig.xen_sxpr"); /* Get a domain id from a S-expression string */ diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c index f3e2f71..e09d97e 100644 --- a/src/xenconfig/xen_xm.c +++ b/src/xenconfig/xen_xm.c @@ -36,6 +36,7 @@ #include "virstring.h" #include "xen_common.h" +#define VIR_FROM_THIS VIR_FROM_XENXM static int xenParseXMOS(virConfPtr conf, virDomainDefPtr def) diff --git a/src/xenconfig/xenxs_private.h b/src/xenconfig/xenxs_private.h index 4f529d6..71e8a1a 100644 --- a/src/xenconfig/xenxs_private.h +++ b/src/xenconfig/xenxs_private.h @@ -46,6 +46,4 @@ # define DEFAULT_VIF_SCRIPT "vif-bridge" # endif -# define VIR_FROM_THIS VIR_FROM_NONE - #endif /* __VIR_XENXS_PRIVATE_H__ */ -- 2.6.1

On Wed, 2016-01-20 at 11:58 -0700, Jim Fehlig wrote:
The virErrorDomain enum has VIR_FROM_XEN, VIR_FROM_XEND, VIR_FROM_XENSTORE, VIR_FROM_SEXPR, and VIR_FROM_XENXM. Use these elements in the corresponding .c files. While at it, remove the VIR_FROM_THIS define in src/xenconfig/xenxs_private.h.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

Add "Xen XL Config" to the virErrorDomain enum and use it in src/xenconfig/xen_xl.c. Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- include/libvirt/virterror.h | 1 + src/util/virerror.c | 1 + src/xenconfig/xen_xl.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 0539e48..c6d1a76 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -128,6 +128,7 @@ typedef enum { VIR_FROM_THREAD = 61, /* Error from thread utils */ VIR_FROM_ADMIN = 62, /* Error from admin backend */ VIR_FROM_LOGGING = 63, /* Error from log manager */ + VIR_FROM_XENXL = 64, /* Error from Xen xl config code */ # ifdef VIR_ENUM_SENTINELS VIR_ERR_DOMAIN_LAST diff --git a/src/util/virerror.c b/src/util/virerror.c index 098211a..3a3ddef 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -135,6 +135,7 @@ VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST, "Thread jobs", "Admin Interface", "Log Manager", + "Xen XL Config", ) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 91cdff6..026cbcc 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -33,7 +33,7 @@ #include "virstoragefile.h" #include "xen_xl.h" -#define VIR_FROM_THIS VIR_FROM_NONE +#define VIR_FROM_THIS VIR_FROM_XENXL /* * Xen provides a libxl utility library, with several useful functions, -- 2.6.1

On Wed, 2016-01-20 at 11:58 -0700, Jim Fehlig wrote:
Add "Xen XL Config" to the virErrorDomain enum and use it in src/xenconfig/xen_xl.c.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

Ian Campbell wrote:
On Wed, 2016-01-20 at 11:58 -0700, Jim Fehlig wrote:
Add "Xen XL Config" to the virErrorDomain enum and use it in src/xenconfig/xen_xl.c.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Thanks! I've now pushed these trivial patches. Regards, Jim
participants (2)
-
Ian Campbell
-
Jim Fehlig