[PATCH 27/28] Rename virterror.c virterror_internal.h to virerror.{c, h}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

---
 cfg.mk                                    |    2 +-
 daemon/libvirtd-config.c                  |    2 +-
 daemon/libvirtd.c                         |    2 +-
 daemon/remote.c                           |    2 +-
 daemon/stream.c                           |    2 +-
 docs/Makefile.am                          |    2 +-
 po/POTFILES.in                            |    4 +-
 src/Makefile.am                           |    2 +-
 src/conf/capabilities.c                   |    2 +-
 src/conf/cpu_conf.c                       |    2 +-
 src/conf/device_conf.c                    |    2 +-
 src/conf/domain_conf.c                    |    2 +-
 src/conf/domain_event.c                   |    2 +-
 src/conf/interface_conf.c                 |    2 +-
 src/conf/netdev_bandwidth_conf.c          |    2 +-
 src/conf/netdev_vlan_conf.c               |    2 +-
 src/conf/netdev_vport_profile_conf.c      |    2 +-
 src/conf/network_conf.c                   |    2 +-
 src/conf/node_device_conf.c               |    2 +-
 src/conf/nwfilter_conf.c                  |    2 +-
 src/conf/nwfilter_ipaddrmap.c             |    2 +-
 src/conf/nwfilter_params.c                |    2 +-
 src/conf/secret_conf.c                    |    2 +-
 src/conf/snapshot_conf.c                  |    2 +-
 src/conf/storage_conf.c                   |    2 +-
 src/conf/storage_encryption_conf.c        |    2 +-
 src/conf/virconsole.c                     |    2 +-
 src/cpu/cpu.h                             |    2 +-
 src/datatypes.c                           |    2 +-
 src/esx/esx_private.h                     |    2 +-
 src/esx/esx_vi.h                          |    2 +-
 src/fdstream.c                            |    2 +-
 src/hyperv/hyperv_device_monitor.c        |    2 +-
 src/hyperv/hyperv_interface_driver.c      |    2 +-
 src/hyperv/hyperv_network_driver.c        |    2 +-
 src/hyperv/hyperv_nwfilter_driver.c       |    2 +-
 src/hyperv/hyperv_private.h               |    2 +-
 src/hyperv/hyperv_secret_driver.c         |    2 +-
 src/hyperv/hyperv_storage_driver.c        |    2 +-
 src/hyperv/hyperv_wmi.c                   |    2 +-
 src/interface/interface_backend_netcf.c   |    2 +-
 src/interface/interface_backend_udev.c    |    2 +-
 src/libvirt-qemu.c                        |    2 +-
 src/libvirt.c                             |    2 +-
 src/libxl/libxl_conf.c                    |    2 +-
 src/libxl/libxl_driver.c                  |    2 +-
 src/locking/domain_lock.c                 |    2 +-
 src/locking/lock_daemon.c                 |    2 +-
 src/locking/lock_daemon_config.c          |    2 +-
 src/locking/lock_daemon_dispatch.c        |    2 +-
 src/locking/lock_driver_lockd.c           |    2 +-
 src/locking/lock_driver_sanlock.c         |    2 +-
 src/locking/lock_manager.c                |    2 +-
 src/lxc/lxc_cgroup.c                      |    2 +-
 src/lxc/lxc_conf.c                        |    2 +-
 src/lxc/lxc_container.c                   |    2 +-
 src/lxc/lxc_controller.c                  |    2 +-
 src/lxc/lxc_domain.c                      |    2 +-
 src/lxc/lxc_driver.c                      |    2 +-
 src/lxc/lxc_fuse.c                        |    2 +-
 src/lxc/lxc_monitor.c                     |    2 +-
 src/lxc/lxc_process.c                     |    2 +-
 src/network/bridge_driver.c               |    2 +-
 src/node_device/node_device_driver.c      |    2 +-
 src/node_device/node_device_hal.c         |    2 +-
 src/node_device/node_device_linux_sysfs.c |    2 +-
 src/node_device/node_device_udev.c        |    2 +-
 src/nodeinfo.c                            |    2 +-
 src/nwfilter/nwfilter_dhcpsnoop.c         |    2 +-
 src/nwfilter/nwfilter_driver.c            |    2 +-
 src/nwfilter/nwfilter_ebiptables_driver.c |    2 +-
 src/nwfilter/nwfilter_gentech_driver.c    |    2 +-
 src/nwfilter/nwfilter_learnipaddr.c       |    2 +-
 src/openvz/openvz_conf.c                  |    2 +-
 src/openvz/openvz_driver.c                |    2 +-
 src/openvz/openvz_util.c                  |    2 +-
 src/parallels/parallels_driver.c          |    2 +-
 src/parallels/parallels_network.c         |    2 +-
 src/parallels/parallels_storage.c         |    2 +-
 src/parallels/parallels_utils.c           |    2 +-
 src/phyp/phyp_driver.c                    |    2 +-
 src/qemu/qemu_agent.c                     |    2 +-
 src/qemu/qemu_bridge_filter.c             |    2 +-
 src/qemu/qemu_capabilities.c              |    2 +-
 src/qemu/qemu_cgroup.c                    |    2 +-
 src/qemu/qemu_command.c                   |    2 +-
 src/qemu/qemu_conf.c                      |    2 +-
 src/qemu/qemu_domain.c                    |    2 +-
 src/qemu/qemu_driver.c                    |    2 +-
 src/qemu/qemu_hostdev.c                   |    2 +-
 src/qemu/qemu_hotplug.c                   |    2 +-
 src/qemu/qemu_migration.c                 |    2 +-
 src/qemu/qemu_monitor.c                   |    2 +-
 src/qemu/qemu_monitor_json.c              |    2 +-
 src/qemu/qemu_monitor_text.c              |    2 +-
 src/qemu/qemu_process.c                   |    2 +-
 src/remote/remote_driver.c                |    2 +-
 src/rpc/virkeepalive.c                    |    2 +-
 src/rpc/virnetclient.c                    |    2 +-
 src/rpc/virnetclientprogram.c             |    2 +-
 src/rpc/virnetclientstream.c              |    2 +-
 src/rpc/virnetmessage.c                   |    2 +-
 src/rpc/virnetsaslcontext.c               |    2 +-
 src/rpc/virnetserver.c                    |    2 +-
 src/rpc/virnetserverclient.c              |    2 +-
 src/rpc/virnetservermdns.c                |    2 +-
 src/rpc/virnetserverprogram.c             |    2 +-
 src/rpc/virnetserverservice.c             |    2 +-
 src/rpc/virnetsocket.c                    |    2 +-
 src/rpc/virnetsshsession.c                |    2 +-
 src/rpc/virnettlscontext.c                |    2 +-
 src/secret/secret_driver.c                |    2 +-
 src/security/security_apparmor.c          |    2 +-
 src/security/security_dac.c               |    2 +-
 src/security/security_driver.c            |    2 +-
 src/security/security_manager.c           |    2 +-
 src/security/security_nop.c               |    2 +-
 src/security/security_selinux.c           |    2 +-
 src/security/security_stack.c             |    2 +-
 src/storage/storage_backend.c             |    2 +-
 src/storage/storage_backend_disk.c        |    2 +-
 src/storage/storage_backend_fs.c          |    2 +-
 src/storage/storage_backend_iscsi.c       |    2 +-
 src/storage/storage_backend_logical.c     |    2 +-
 src/storage/storage_backend_mpath.c       |    2 +-
 src/storage/storage_backend_rbd.c         |    2 +-
 src/storage/storage_backend_scsi.c        |    2 +-
 src/storage/storage_backend_sheepdog.c    |    2 +-
 src/storage/storage_driver.c              |    2 +-
 src/test/test_driver.c                    |    2 +-
 src/uml/uml_conf.h                        |    2 +-
 src/util/iohelper.c                       |    2 +-
 src/util/viraudit.c                       |    2 +-
 src/util/virauth.c                        |    2 +-
 src/util/virauthconfig.c                  |    2 +-
 src/util/vircommand.c                     |    2 +-
 src/util/virconf.c                        |    2 +-
 src/util/virdbus.c                        |    2 +-
 src/util/virdnsmasq.c                     |    2 +-
 src/util/virebtables.c                    |    2 +-
 src/util/virerror.c                       | 1369 +++++++++++++++++++++++++++++
 src/util/virerror.h                       |  167 ++++
 src/util/virevent.c                       |    2 +-
 src/util/vireventpoll.c                   |    2 +-
 src/util/virfile.c                        |    2 +-
 src/util/virhash.c                        |    2 +-
 src/util/virhooks.c                       |    2 +-
 src/util/virinitctl.c                     |    2 +-
 src/util/viriptables.c                    |    2 +-
 src/util/virjson.c                        |    2 +-
 src/util/virkeyfile.c                     |    2 +-
 src/util/virlockspace.c                   |    2 +-
 src/util/virlog.c                         |    2 +-
 src/util/virnetdev.c                      |    2 +-
 src/util/virnetdevbandwidth.c             |    2 +-
 src/util/virnetdevbridge.c                |    2 +-
 src/util/virnetdevmacvlan.c               |    2 +-
 src/util/virnetdevopenvswitch.c           |    2 +-
 src/util/virnetdevtap.c                   |    4 +-
 src/util/virnetdevveth.c                  |    2 +-
 src/util/virnetdevvlan.c                  |    2 +-
 src/util/virnetdevvportprofile.c          |    2 +-
 src/util/virnetlink.c                     |    2 +-
 src/util/virnodesuspend.c                 |    2 +-
 src/util/virobject.c                      |    2 +-
 src/util/virpci.c                         |    2 +-
 src/util/virpidfile.c                     |    2 +-
 src/util/virprocess.c                     |    2 +-
 src/util/virrandom.c                      |    2 +-
 src/util/virsexpr.c                       |    2 +-
 src/util/virsocketaddr.c                  |    2 +-
 src/util/virstatslinux.c                  |    2 +-
 src/util/virstoragefile.c                 |    2 +-
 src/util/virstring.c                      |    2 +-
 src/util/virsysinfo.c                     |    2 +-
 src/util/virterror.c                      | 1369 -----------------------------
 src/util/virterror_internal.h             |  167 ----
 src/util/virthreadpool.c                  |    2 +-
 src/util/virtime.c                        |    2 +-
 src/util/virtypedparam.c                  |    2 +-
 src/util/viruri.c                         |    2 +-
 src/util/virusb.c                         |    2 +-
 src/util/virutil.c                        |    2 +-
 src/util/viruuid.c                        |    2 +-
 src/util/virxml.c                         |    2 +-
 src/vbox/vbox_MSCOMGlue.c                 |    2 +-
 src/vbox/vbox_XPCOMCGlue.c                |    2 +-
 src/vbox/vbox_driver.c                    |    2 +-
 src/vbox/vbox_tmpl.c                      |    2 +-
 src/vmware/vmware_conf.c                  |    2 +-
 src/vmware/vmware_driver.c                |    2 +-
 src/vmx/vmx.c                             |    2 +-
 src/xen/block_stats.c                     |    2 +-
 src/xen/xen_driver.c                      |    2 +-
 src/xen/xen_hypervisor.c                  |    2 +-
 src/xen/xen_inotify.c                     |    2 +-
 src/xen/xend_internal.c                   |    2 +-
 src/xen/xm_internal.c                     |    2 +-
 src/xen/xs_internal.c                     |    2 +-
 src/xenapi/xenapi_driver.c                |    2 +-
 src/xenapi/xenapi_driver_private.h        |    2 +-
 src/xenapi/xenapi_utils.c                 |    2 +-
 src/xenxs/xen_sxpr.c                      |    2 +-
 src/xenxs/xen_xm.c                        |    2 +-
 tests/commandtest.c                       |    2 +-
 tests/libvirtdconftest.c                  |    2 +-
 tests/qemumonitorjsontest.c               |    2 +-
 tests/qemumonitortestutils.c              |    2 +-
 tests/securityselinuxtest.c               |    2 +-
 tests/testutils.c                         |    2 +-
 tests/virauthconfigtest.c                 |    2 +-
 tests/virdrivermoduletest.c               |    2 +-
 tests/virkeyfiletest.c                    |    2 +-
 tests/virlockspacetest.c                  |    2 +-
 tests/virnetmessagetest.c                 |    2 +-
 tests/virnetsockettest.c                  |    2 +-
 tests/virnettlscontexttest.c              |    2 +-
 tests/virstringtest.c                     |    2 +-
 tests/virtimetest.c                       |    2 +-
 tests/viruritest.c                        |    2 +-
 tools/console.c                           |    2 +-
 tools/virsh-domain.c                      |    2 +-
 tools/virsh.c                             |    2 +-
 tools/virsh.h                             |    2 +-
 224 files changed, 1758 insertions(+), 1758 deletions(-)
 create mode 100644 src/util/virerror.c
 create mode 100644 src/util/virerror.h
 delete mode 100644 src/util/virterror.c
 delete mode 100644 src/util/virterror_internal.h

diff --git a/cfg.mk b/cfg.mk
index 2fcb444..26147bd 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -762,7 +762,7 @@ exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
 exclude_file_name_regexp--sc_po_check = ^(docs/|src/rpc/gendispatch\.pl$$)
 
 exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY = \
-  ^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virterror\.c)$$
+  ^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virerror\.c)$$
 
 exclude_file_name_regexp--sc_prohibit_access_xok = ^src/util/virutil\.c$$
 
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
index b979a23..8b74bf1 100644
--- a/daemon/libvirtd-config.c
+++ b/daemon/libvirtd-config.c
@@ -26,7 +26,7 @@
 #include "libvirtd-config.h"
 #include "virconf.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "rpc/virnetserver.h"
 #include "configmake.h"
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 560746f..f2a3036 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -33,7 +33,7 @@
 #include <locale.h>
 
 #include "libvirt_internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virfile.h"
 #include "virpidfile.h"
 #include "virprocess.h"
diff --git a/daemon/remote.c b/daemon/remote.c
index 1a054d5..817d5ed 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -22,7 +22,7 @@
 
 #include <config.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #if HAVE_POLKIT0
 # include <polkit/polkit.h>
diff --git a/daemon/stream.c b/daemon/stream.c
index f208139..4df1145 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -28,7 +28,7 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "virnetserverclient.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_STREAMS
 
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 4fea3a0..cba9d4b 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -239,7 +239,7 @@ $(APIBUILD_STAMP): $(srcdir)/apibuild.py \
 		$(srcdir)/../include/libvirt/virterror.h \
 		$(srcdir)/../src/libvirt.c \
 		$(srcdir)/../src/libvirt-qemu.c \
-		$(srcdir)/../src/util/virterror.c
+		$(srcdir)/../src/util/virerror.c
 	$(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(APIBUILD)
 	touch $@
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1afdca5..c79aa73 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -173,8 +173,8 @@ src/util/virsocketaddr.c
 src/util/virstatslinux.c
 src/util/virstoragefile.c
 src/util/virsysinfo.c
-src/util/virterror.c
-src/util/virterror_internal.h
+src/util/virerror.c
+src/util/virerror.h
 src/util/virtime.c
 src/util/virtypedparam.c
 src/util/viruri.c
diff --git a/src/Makefile.am b/src/Makefile.am
index dddd162..0c77062 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,6 +64,7 @@ UTIL_SOURCES =							\
 		util/virconf.c util/virconf.h			\
 		util/virdnsmasq.c util/virdnsmasq.h             \
 		util/virebtables.c util/virebtables.h		\
+		util/virerror.c util/virerror.h			\
 		util/virevent.c util/virevent.h			\
 		util/vireventpoll.c util/vireventpoll.h		\
 		util/virfile.c util/virfile.h			\
@@ -85,7 +86,6 @@ UTIL_SOURCES =							\
 		util/virthreadwin32.h				\
 		util/virthreadpool.c util/virthreadpool.h	\
 		util/virtypedparam.c util/virtypedparam.h	\
-		util/virterror.c util/virterror_internal.h	\
 		util/vircgroup.c util/vircgroup.h		\
 		util/virdbus.c util/virdbus.h			\
 		util/virhash.c util/virhash.h			\
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index f6badcc..e6cb2a6 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -31,7 +31,7 @@
 #include "virutil.h"
 #include "viruuid.h"
 #include "cpu_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_CAPABILITIES
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 95c6ca1..7acf327 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -23,7 +23,7 @@
 
 #include <config.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virutil.h"
 #include "virbuffer.h"
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 45ecb28..099b1cb 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -21,7 +21,7 @@
  */
 
 #include <config.h>
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "viralloc.h"
 #include "virxml.h"
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a4f33ed..db4b274 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30,7 +30,7 @@
 #include <unistd.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "domain_conf.h"
 #include "snapshot_conf.h"
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index d523808..96a07ac 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -27,7 +27,7 @@
 #include "virlog.h"
 #include "datatypes.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 3867274..9301ec0 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -22,7 +22,7 @@
  */
 
 #include <config.h>
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 
 #include "interface_conf.h"
diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c
index e64aeff..b830cd0 100644
--- a/src/conf/netdev_bandwidth_conf.c
+++ b/src/conf/netdev_bandwidth_conf.c
@@ -23,7 +23,7 @@
 #include <config.h>
 
 #include "netdev_bandwidth_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "viralloc.h"
 #include "domain_conf.h"
diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c
index 8cee025..9207184 100644
--- a/src/conf/netdev_vlan_conf.c
+++ b/src/conf/netdev_vlan_conf.c
@@ -22,7 +22,7 @@
 #include <config.h>
 
 #include "netdev_vlan_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_profile_conf.c
index a9a38d7..701e17e 100644
--- a/src/conf/netdev_vport_profile_conf.c
+++ b/src/conf/netdev_vport_profile_conf.c
@@ -23,7 +23,7 @@
 #include <config.h>
 
 #include "netdev_vport_profile_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 2bd04c5..f949f79 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <dirent.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "network_conf.h"
 #include "netdev_vport_profile_conf.h"
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 3c68011..53b6af2 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "viralloc.h"
 
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 810de6c..ca22411 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -40,7 +40,7 @@
 
 #include "viruuid.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "nwfilter_params.h"
 #include "nwfilter_conf.h"
diff --git a/src/conf/nwfilter_ipaddrmap.c b/src/conf/nwfilter_ipaddrmap.c
index ddad49e..317069d 100644
--- a/src/conf/nwfilter_ipaddrmap.c
+++ b/src/conf/nwfilter_ipaddrmap.c
@@ -26,7 +26,7 @@
 
 #include "internal.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "nwfilter_params.h"
 #include "nwfilter_ipaddrmap.h"
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 1429952..7aebc8d 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -26,7 +26,7 @@
 #include "internal.h"
 
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "nwfilter_params.h"
 #include "domain_conf.h"
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 46d2ae5..891af65 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -28,7 +28,7 @@
 #include "virlog.h"
 #include "viralloc.h"
 #include "secret_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "virxml.h"
 #include "viruuid.h"
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index f7f8f63..201c586 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -45,7 +45,7 @@
 #include "virutil.h"
 #include "viruuid.h"
 #include "virfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_DOMAIN_SNAPSHOT
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 04b2581..7a39998 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -33,7 +33,7 @@
 #include <fcntl.h>
 #include <string.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "storage_conf.h"
 #include "virstoragefile.h"
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 35e9da4..88dff1b 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -33,7 +33,7 @@
 #include "storage_encryption_conf.h"
 #include "virutil.h"
 #include "virxml.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viruuid.h"
 #include "virfile.h"
 
diff --git a/src/conf/virconsole.c b/src/conf/virconsole.c
index 515c5fa..239e2d2 100644
--- a/src/conf/virconsole.c
+++ b/src/conf/virconsole.c
@@ -35,7 +35,7 @@
 #include "viralloc.h"
 #include "virpidfile.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 01c732c..a00a469 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -24,7 +24,7 @@
 #ifndef __VIR_CPU_H__
 # define __VIR_CPU_H__
 
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "datatypes.h"
 # include "conf/cpu_conf.h"
 # include "cpu_x86_data.h"
diff --git a/src/datatypes.c b/src/datatypes.c
index 038c47d..068233c 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -23,7 +23,7 @@
 #include <unistd.h>
 
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "viralloc.h"
 #include "viruuid.h"
diff --git a/src/esx/esx_private.h b/src/esx/esx_private.h
index de6ba5d..f1e7adf 100644
--- a/src/esx/esx_private.h
+++ b/src/esx/esx_private.h
@@ -24,7 +24,7 @@
 # define __ESX_PRIVATE_H__
 
 # include "internal.h"
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "capabilities.h"
 # include "esx_vi.h"
 
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index a121d1c..3eaeb38 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -29,7 +29,7 @@
 # include <curl/curl.h>
 
 # include "internal.h"
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "datatypes.h"
 # include "esx_vi_types.h"
 # include "esx_util.h"
diff --git a/src/fdstream.c b/src/fdstream.c
index f7f101e..cc2dfe9 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -33,7 +33,7 @@
 #include <netinet/in.h>
 
 #include "fdstream.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virlog.h"
 #include "viralloc.h"
diff --git a/src/hyperv/hyperv_device_monitor.c b/src/hyperv/hyperv_device_monitor.c
index 43ee1fc..9432081 100644
--- a/src/hyperv/hyperv_device_monitor.c
+++ b/src/hyperv/hyperv_device_monitor.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/hyperv/hyperv_interface_driver.c b/src/hyperv/hyperv_interface_driver.c
index 7dd6912..b42dbce 100644
--- a/src/hyperv/hyperv_interface_driver.c
+++ b/src/hyperv/hyperv_interface_driver.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/hyperv/hyperv_network_driver.c b/src/hyperv/hyperv_network_driver.c
index f34a451..c75c943 100644
--- a/src/hyperv/hyperv_network_driver.c
+++ b/src/hyperv/hyperv_network_driver.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/hyperv/hyperv_nwfilter_driver.c b/src/hyperv/hyperv_nwfilter_driver.c
index c6125ec..faa9074 100644
--- a/src/hyperv/hyperv_nwfilter_driver.c
+++ b/src/hyperv/hyperv_nwfilter_driver.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/hyperv/hyperv_private.h b/src/hyperv/hyperv_private.h
index 30051ea..9c9fd3e 100644
--- a/src/hyperv/hyperv_private.h
+++ b/src/hyperv/hyperv_private.h
@@ -25,7 +25,7 @@
 # define __HYPERV_PRIVATE_H__
 
 # include "internal.h"
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "hyperv_util.h"
 # include "openwsman.h"
 
diff --git a/src/hyperv/hyperv_secret_driver.c b/src/hyperv/hyperv_secret_driver.c
index b830e4e..602ae99 100644
--- a/src/hyperv/hyperv_secret_driver.c
+++ b/src/hyperv/hyperv_secret_driver.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/hyperv/hyperv_storage_driver.c b/src/hyperv/hyperv_storage_driver.c
index 38385a0..a169b14 100644
--- a/src/hyperv/hyperv_storage_driver.c
+++ b/src/hyperv/hyperv_storage_driver.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index e029028..33ba21f 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -25,7 +25,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virlog.h"
 #include "viralloc.h"
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 74a749b..35335c2 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -25,7 +25,7 @@
 
 #include <netcf.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "interface_driver.h"
 #include "interface_conf.h"
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 248b02e..cc20b98 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -23,7 +23,7 @@
 #include <dirent.h>
 #include <libudev.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "interface_driver.h"
 #include "interface_conf.h"
diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c
index 8d53b5c..11da2f3 100644
--- a/src/libvirt-qemu.c
+++ b/src/libvirt-qemu.c
@@ -23,7 +23,7 @@
 
 #include <config.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "libvirt/libvirt-qemu.h"
diff --git a/src/libvirt.c b/src/libvirt.c
index e06b643..bf674d1 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -45,7 +45,7 @@
 # include <curl/curl.h>
 #endif
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "driver.h"
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index aad1374..15d2271 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -33,7 +33,7 @@
 
 #include "internal.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virfile.h"
 #include "virstring.h"
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 76afe34..db821c5 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -33,7 +33,7 @@
 
 #include "internal.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virconf.h"
 #include "datatypes.h"
 #include "virfile.h"
diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index 0354e26..6191e9b 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -24,7 +24,7 @@
 #include "domain_lock.h"
 #include "viralloc.h"
 #include "viruuid.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_LOCKING
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index a445b2e..7288f7a 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -37,7 +37,7 @@
 #include "virfile.h"
 #include "virpidfile.h"
 #include "virprocess.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "viralloc.h"
 #include "virconf.h"
diff --git a/src/locking/lock_daemon_config.c b/src/locking/lock_daemon_config.c
index e370dd4..12b06e2 100644
--- a/src/locking/lock_daemon_config.c
+++ b/src/locking/lock_daemon_config.c
@@ -26,7 +26,7 @@
 #include "lock_daemon_config.h"
 #include "virconf.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "rpc/virnetserver.h"
 #include "configmake.h"
diff --git a/src/locking/lock_daemon_dispatch.c b/src/locking/lock_daemon_dispatch.c
index def7c2f..45d2cae 100644
--- a/src/locking/lock_daemon_dispatch.c
+++ b/src/locking/lock_daemon_dispatch.c
@@ -30,7 +30,7 @@
 #include "lock_daemon.h"
 #include "lock_protocol.h"
 #include "lock_daemon_dispatch_stubs.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 9c7ce6d..4b72a05 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -28,7 +28,7 @@
 #include "viruuid.h"
 #include "virutil.h"
 #include "virfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "rpc/virnetclient.h"
 #include "lock_protocol.h"
 #include "configmake.h"
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 511543a..75ced84 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -38,7 +38,7 @@
 #include "dirname.h"
 #include "lock_driver.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virutil.h"
 #include "virfile.h"
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index 1b88838..ae60caf 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -23,7 +23,7 @@
 
 #include "lock_manager.h"
 #include "lock_driver_nop.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 5d1f7ff..a490551 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -24,7 +24,7 @@
 #include "lxc_cgroup.h"
 #include "lxc_container.h"
 #include "virfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "viralloc.h"
 #include "vircgroup.h"
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 36c49d0..689215a 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -30,7 +30,7 @@
 
 #include "lxc_conf.h"
 #include "nodeinfo.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virconf.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 57c432a..655b610 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -53,7 +53,7 @@
 # include <blkid/blkid.h>
 #endif
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "lxc_container.h"
 #include "virutil.h"
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index a8e99f2..5517f68 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -52,7 +52,7 @@
 # include <numa.h>
 #endif
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virutil.h"
 
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index fab1506..1b02aa5 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -25,7 +25,7 @@
 
 #include "viralloc.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 42c6f80..bdd4fba 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -35,7 +35,7 @@
 #include <unistd.h>
 #include <wait.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "lxc_conf.h"
diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index 485456e..fdba042 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -31,7 +31,7 @@
 
 #include "lxc_fuse.h"
 #include "lxc_cgroup.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virfile.h"
 #include "virbuffer.h"
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index b0da21f..65194a5 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -27,7 +27,7 @@
 
 #include "viralloc.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virthread.h"
 #include "rpc/virnetclient.h"
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index af14f6a..57d1ae8 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -40,7 +40,7 @@
 #include "network/bridge_driver.h"
 #include "viralloc.h"
 #include "domain_audit.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "vircommand.h"
 #include "virhooks.h"
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 953e571..9ea09c7 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -44,7 +44,7 @@
 #include <sys/ioctl.h>
 #include <net/if.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "bridge_driver.h"
 #include "network_conf.h"
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 6cc1837..522af99 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -30,7 +30,7 @@
 #include <time.h>
 #include <sys/stat.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 8ee816b..610df8d 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -30,7 +30,7 @@
 
 #include "node_device_conf.h"
 #include "node_device_hal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "driver.h"
 #include "datatypes.h"
 #include "viralloc.h"
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index be5d3ed..9c305d3 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -28,7 +28,7 @@
 
 #include "node_device_driver.h"
 #include "node_device_hal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "virfile.h"
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 61e5a0e..a9b30b2 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -27,7 +27,7 @@
 #include <c-ctype.h>
 
 #include "node_device_udev.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "node_device_conf.h"
 #include "node_device_driver.h"
 #include "driver.h"
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 65f4431..9cde01a 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -44,7 +44,7 @@
 #include "physmem.h"
 #include "virutil.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "count-one-bits.h"
 #include "intprops.h"
 #include "virfile.h"
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index c1ab622..90b5615 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -57,7 +57,7 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "conf/domain_conf.h"
 #include "nwfilter_gentech_driver.h"
 #include "nwfilter_dhcpsnoop.h"
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 4b1188d..1ac91cf 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -32,7 +32,7 @@
 
 #include "internal.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "viralloc.h"
 #include "domain_conf.h"
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 092ae5a..4fec52d 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -33,7 +33,7 @@
 #include "virbuffer.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "domain_conf.h"
 #include "nwfilter_conf.h"
 #include "nwfilter_driver.h"
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 2b4cc8e..086bb13 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -29,7 +29,7 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "domain_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "nwfilter_gentech_driver.h"
 #include "nwfilter_ebiptables_driver.h"
 #include "nwfilter_dhcpsnoop.h"
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 442cc83..7a4f983 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -46,7 +46,7 @@
 #include "virlog.h"
 #include "datatypes.h"
 #include "virnetdev.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virthread.h"
 #include "conf/nwfilter_params.h"
 #include "conf/domain_conf.h"
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 35f5c97..f208753 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -43,7 +43,7 @@
 #include <sys/utsname.h>
 #include <sys/wait.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "openvz_conf.h"
 #include "openvz_util.h"
 #include "viruuid.h"
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index a407193..17c44a3 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -45,7 +45,7 @@
 #include <stdio.h>
 #include <sys/wait.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "openvz_driver.h"
 #include "openvz_util.h"
diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c
index 51b22c9..dc69df2 100644
--- a/src/openvz/openvz_util.c
+++ b/src/openvz/openvz_util.c
@@ -25,7 +25,7 @@
 
 #include "internal.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "vircommand.h"
 #include "datatypes.h"
 #include "viralloc.h"
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 87d098e..cf7db2e 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -42,7 +42,7 @@
 #include <sys/statvfs.h>
 
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virutil.h"
 #include "virlog.h"
diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index 4729f18..c5ece79 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -24,7 +24,7 @@
 
 #include "datatypes.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "md5.h"
 
 #include "parallels_utils.h"
diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
index 0e6c100..e768d88 100644
--- a/src/parallels/parallels_storage.c
+++ b/src/parallels/parallels_storage.c
@@ -34,7 +34,7 @@
 #include "viralloc.h"
 #include "configmake.h"
 #include "virstoragefile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #include "parallels_utils.h"
 
diff --git a/src/parallels/parallels_utils.c b/src/parallels/parallels_utils.c
index 9e317b1..dd2f0b7 100644
--- a/src/parallels/parallels_utils.c
+++ b/src/parallels/parallels_utils.c
@@ -25,7 +25,7 @@
 #include <stdarg.h>
 
 #include "vircommand.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virjson.h"
 
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index cd1911e..4333c90 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -52,7 +52,7 @@
 #include "virlog.h"
 #include "driver.h"
 #include "libvirt/libvirt.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viruuid.h"
 #include "domain_conf.h"
 #include "storage_conf.h"
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index ec1e300..bb421bd 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -36,7 +36,7 @@
 #include "qemu_command.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virjson.h"
 #include "virfile.h"
 #include "virprocess.h"
diff --git a/src/qemu/qemu_bridge_filter.c b/src/qemu/qemu_bridge_filter.c
index 6d84f47..3bc1141 100644
--- a/src/qemu/qemu_bridge_filter.c
+++ b/src/qemu/qemu_bridge_filter.c
@@ -26,7 +26,7 @@
 #include "qemu_conf.h"
 #include "qemu_driver.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 
 #include "qemu_bridge_filter.h"
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7a27183..f4de93b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -26,7 +26,7 @@
 #include "qemu_capabilities.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "virfile.h"
 #include "virpidfile.h"
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 9db7ad9..4fe98e9 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -29,7 +29,7 @@
 #include "vircgroup.h"
 #include "virlog.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "domain_audit.h"
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 79e5faa..8afe31b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -30,7 +30,7 @@
 #include "cpu/cpu.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "virfile.h"
 #include "viruuid.h"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 56c93a8..eb0a479 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -35,7 +35,7 @@
 #include <arpa/inet.h>
 #include <sys/utsname.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "qemu_conf.h"
 #include "qemu_command.h"
 #include "qemu_capabilities.h"
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 46b7656..5d11f83 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -29,7 +29,7 @@
 #include "qemu_migration.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "c-ctype.h"
 #include "cpu/cpu.h"
 #include "viruuid.h"
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d24527b..c7cbfbf 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -59,7 +59,7 @@
 #include "qemu_process.h"
 #include "qemu_migration.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "virbuffer.h"
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 5c23ccb..c7d4987 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -25,7 +25,7 @@
 
 #include "qemu_hostdev.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virpci.h"
 #include "virusb.h"
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e5b28da..8de108d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -34,7 +34,7 @@
 #include "domain_nwfilter.h"
 #include "virlog.h"
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virpci.h"
 #include "virfile.h"
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index afe2374..b2c412d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -37,7 +37,7 @@
 
 #include "domain_audit.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virutil.h"
 #include "virfile.h"
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 5ca1f89..99642b6 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -31,7 +31,7 @@
 #include "qemu_monitor.h"
 #include "qemu_monitor_text.h"
 #include "qemu_monitor_json.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "virfile.h"
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 0137291..2d2d254 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -39,7 +39,7 @@
 #include "virlog.h"
 #include "driver.h"
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virjson.h"
 
 #ifdef WITH_DTRACE_PROBES
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 82e9108..6506f9d 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -38,7 +38,7 @@
 #include "virlog.h"
 #include "driver.h"
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virbuffer.h"
 
 #ifdef WITH_DTRACE_PROBES
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 5ffc5a5..1d5200f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -52,7 +52,7 @@
 
 #include "datatypes.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virhooks.h"
 #include "virfile.h"
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index ac7dc87..ae861cc 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -29,7 +29,7 @@
 #include "virnetclient.h"
 #include "virnetclientprogram.h"
 #include "virnetclientstream.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "domain_event.h"
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index 18be350..a8ceff5 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -27,7 +27,7 @@
 #include "virfile.h"
 #include "virlog.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virnetsocket.h"
 #include "virkeepaliveprotocol.h"
 #include "virkeepalive.h"
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 9347f0b..208e2e9 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -35,7 +35,7 @@
 #include "virfile.h"
 #include "virlog.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c
index eff4a4c..a179b8d 100644
--- a/src/rpc/virnetclientprogram.c
+++ b/src/rpc/virnetclientprogram.c
@@ -29,7 +29,7 @@
 #include "virnetprotocol.h"
 
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virutil.h"
 #include "virfile.h"
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index 7e1f9c7..15ed91a 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -25,7 +25,7 @@
 #include "virnetclientstream.h"
 #include "virnetclient.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virthread.h"
 
diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c
index b2da65b..b7330de 100644
--- a/src/rpc/virnetmessage.c
+++ b/src/rpc/virnetmessage.c
@@ -25,7 +25,7 @@
 
 #include "virnetmessage.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virfile.h"
 #include "virutil.h"
diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c
index cd30f4d..cbf7261 100644
--- a/src/rpc/virnetsaslcontext.c
+++ b/src/rpc/virnetsaslcontext.c
@@ -25,7 +25,7 @@
 #include "virnetsaslcontext.h"
 #include "virnetmessage.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virthread.h"
 #include "virlog.h"
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 47a6293..5674309 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -30,7 +30,7 @@
 #include "virnetserver.h"
 #include "virlog.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virthread.h"
 #include "virthreadpool.h"
 #include "virutil.h"
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index f1eb69b..aefc511 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -30,7 +30,7 @@
 #include "virnetserverclient.h"
 
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virthread.h"
 #include "virkeepalive.h"
diff --git a/src/rpc/virnetservermdns.c b/src/rpc/virnetservermdns.c
index daef2b4..b6f8e8e 100644
--- a/src/rpc/virnetservermdns.c
+++ b/src/rpc/virnetservermdns.c
@@ -43,7 +43,7 @@
 #include "virnetservermdns.h"
 #include "vireventpoll.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index a8f875c..3ac3809 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -27,7 +27,7 @@
 #include "virnetserverclient.h"
 
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virfile.h"
 #include "virthread.h"
diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index 9992983..7d671f0 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -26,7 +26,7 @@
 #include "virnetserverservice.h"
 
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virthread.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index a959c30..ef93892 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -43,7 +43,7 @@
 #include "virnetsocket.h"
 #include "virutil.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virfile.h"
 #include "virthread.h"
diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index ad8bd48..661860f 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -32,7 +32,7 @@
 #include "configmake.h"
 #include "virthread.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virobject.h"
 
 #define VIR_FROM_THIS VIR_FROM_SSH
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index b01de8c..56e372b 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -31,7 +31,7 @@
 #include "virnettlscontext.h"
 
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "virlog.h"
 #include "virthread.h"
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 1784fea..5be33b9 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -39,7 +39,7 @@
 #include "virthread.h"
 #include "virutil.h"
 #include "viruuid.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virfile.h"
 #include "configmake.h"
 
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index ee96bac..edc81ac 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -40,7 +40,7 @@
 #include "security_apparmor.h"
 #include "virutil.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "viruuid.h"
 #include "virpci.h"
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 3104f42..d0e1731 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -24,7 +24,7 @@
 #include <fcntl.h>
 
 #include "security_dac.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/security/security_driver.c b/src/security/security_driver.c
index 82d3ca9..319b86f 100644
--- a/src/security/security_driver.c
+++ b/src/security/security_driver.c
@@ -23,7 +23,7 @@
 #include <config.h>
 #include <string.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 
 #include "security_driver.h"
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 2da6244..960fcc9 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -26,7 +26,7 @@
 #include "security_driver.h"
 #include "security_stack.h"
 #include "security_dac.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/src/security/security_nop.c b/src/security/security_nop.c
index 5f3270a..61b8e83 100644
--- a/src/security/security_nop.c
+++ b/src/security/security_nop.c
@@ -21,7 +21,7 @@
 
 #include "security_nop.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index ccba258..ae94ec3 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -33,7 +33,7 @@
 
 #include "security_driver.h"
 #include "security_selinux.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index 390bd3b..931d31d 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -22,7 +22,7 @@
 
 #include "security_stack.h"
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index f98a7c0..df79b28 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -46,7 +46,7 @@
 #endif
 
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "viralloc.h"
 #include "internal.h"
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index aceb82b..4214e97 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "storage_backend_disk.h"
 #include "virutil.h"
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 23fa0f5..2205371 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -41,7 +41,7 @@
 # include <blkid/blkid.h>
 #endif
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "storage_backend_fs.h"
 #include "storage_conf.h"
 #include "virstoragefile.h"
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index e91c4b1..f374961 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -34,7 +34,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "storage_backend_scsi.h"
 #include "storage_backend_iscsi.h"
 #include "virutil.h"
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 83b517c..2734689 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -31,7 +31,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "storage_backend_logical.h"
 #include "storage_conf.h"
 #include "vircommand.h"
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index 0e5d032..b12b81f 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -29,7 +29,7 @@
 
 #include <libdevmapper.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "storage_conf.h"
 #include "storage_backend.h"
 #include "viralloc.h"
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 7dc46b0..f5c6b0f 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -22,7 +22,7 @@
 
 #include <config.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "storage_backend_rbd.h"
 #include "storage_conf.h"
 #include "virutil.h"
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 1db8fdd..1a03c49 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -28,7 +28,7 @@
 #include <dirent.h>
 #include <fcntl.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "storage_backend_scsi.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index 1046ac9..cd18f33 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -26,7 +26,7 @@
 
 #include <config.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "storage_backend_sheepdog.h"
 #include "storage_conf.h"
 #include "vircommand.h"
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d93617c..ff56f4f 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -36,7 +36,7 @@
 #include <errno.h>
 #include <string.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "driver.h"
 #include "virutil.h"
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index bd557d6..8518fd3 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -32,7 +32,7 @@
 #include <libxml/xmlsave.h>
 
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "test_driver.h"
 #include "virbuffer.h"
diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
index dfa168e..a4e264f 100644
--- a/src/uml/uml_conf.h
+++ b/src/uml/uml_conf.h
@@ -29,7 +29,7 @@
 # include "network_conf.h"
 # include "domain_conf.h"
 # include "domain_event.h"
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "virthread.h"
 # include "vircommand.h"
 # include "virhash.h"
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index 40b04f9..2230bcb 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -37,7 +37,7 @@
 #include "virthread.h"
 #include "virfile.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "configmake.h"
 #include "virrandom.h"
 
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 05189d5..04ac323 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "viraudit.h"
 #include "virutil.h"
diff --git a/src/util/virauth.c b/src/util/virauth.c
index cbb16ec..c26e340 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -29,7 +29,7 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "datatypes.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "configmake.h"
 #include "virauthconfig.h"
 
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index d60f7bf..1d1f084 100644
--- a/src/util/virauthconfig.c
+++ b/src/util/virauthconfig.c
@@ -28,7 +28,7 @@
 #include "viralloc.h"
 #include "virutil.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 
 struct _virAuthConfig {
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index d059586..c906f2a 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -35,7 +35,7 @@
 
 #include "vircommand.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "virlog.h"
 #include "virfile.h"
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 7e4c8c1..16ed2cb 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -30,7 +30,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virbuffer.h"
 #include "virconf.h"
 #include "virutil.h"
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index f45074c..127e57f 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -23,7 +23,7 @@
 
 #include "virdbus.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virthread.h"
 
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 6b9abd9..e9148c1 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -44,7 +44,7 @@
 #include "virutil.h"
 #include "vircommand.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virfile.h"
 
diff --git a/src/util/virebtables.c b/src/util/virebtables.c
index edf4956..959599a 100644
--- a/src/util/virebtables.c
+++ b/src/util/virebtables.c
@@ -43,7 +43,7 @@
 #include "virebtables.h"
 #include "vircommand.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virthread.h"
 
diff --git a/src/util/virerror.c b/src/util/virerror.c
new file mode 100644
index 0000000..257880f
--- /dev/null
+++ b/src/util/virerror.c
@@ -0,0 +1,1369 @@
+/*
+ * virterror.c: implements error handling and reporting code for libvirt
+ *
+ * Copyright (C) 2006, 2008-2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Daniel Veillard <veillard@xxxxxxxxxx>
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include "virerror.h"
+#include "datatypes.h"
+#include "virlog.h"
+#include "viralloc.h"
+#include "virthread.h"
+#include "virutil.h"
+
+virThreadLocal virLastErr;
+
+virErrorFunc virErrorHandler = NULL;     /* global error handler */
+void *virUserData = NULL;        /* associated data */
+virErrorLogPriorityFunc virErrorLogPriorityFilter = NULL;
+
+static virLogPriority virErrorLevelPriority(virErrorLevel level) {
+    switch (level) {
+        case VIR_ERR_NONE:
+            return VIR_LOG_INFO;
+        case VIR_ERR_WARNING:
+            return VIR_LOG_WARN;
+        case VIR_ERR_ERROR:
+            return VIR_LOG_ERROR;
+    }
+    return VIR_LOG_ERROR;
+}
+
+
+VIR_ENUM_DECL(virErrorDomain)
+VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST,
+              "", /* 0 */
+              "Xen Driver",
+              "Xen Daemon",
+              "Xen Store",
+              "S-Expression",
+
+              "XML Util", /* 5 */
+              "Domain",
+              "XML-RPC",
+              "Proxy Daemon",
+              "Config File",
+
+              "QEMU Driver", /* 10 */
+              "Network",
+              "Test Driver",
+              "Remote Driver",
+              "OpenVZ Driver",
+
+              "Xen XM Driver", /* 15 */
+              "Linux Statistics",
+              "LXC Driver",
+              "Storage Driver",
+              "Network Driver",
+
+              "Domain Config", /* 20 */
+              "User Mode Linux Driver",
+              "Node Device Driver",
+              "Xen Inotify Driver",
+              "Security Driver",
+
+              "VirtualBox Driver", /* 25 */
+              "Network Interface Driver",
+              "Open Nebula Driver",
+              "ESX Driver",
+              "Power Hypervisor Driver",
+
+              "Secrets Driver", /* 30 */
+              "CPU Driver",
+              "XenAPI Driver",
+              "Network Filter Driver",
+              "Lifecycle Hook",
+
+              "Domain Snapshot", /* 35 */
+              "Audit Utils",
+              "Sysinfo Utils",
+              "I/O Stream Utils",
+              "VMWare Driver",
+
+              "Event Loop", /* 40 */
+              "Xen Light Driver",
+              "Lock Driver",
+              "Hyper-V Driver",
+              "Capabilities Utils",
+
+              "URI Utils", /* 45 */
+              "Authentication Utils",
+              "DBus Utils",
+              "Parallels Cloud Server",
+              "Device Config",
+
+              "SSH transport layer", /* 50 */
+              "Lock Space",
+              "Init control",
+    )
+
+
+/*
+ * Internal helper that is called when a thread exits, to
+ * release the error object stored in the thread local
+ */
+static void
+virLastErrFreeData(void *data)
+{
+    virErrorPtr err = data;
+    if (!err)
+        return;
+    virResetError(err);
+    VIR_FREE(err);
+}
+
+
+/**
+ * virErrorInitialize:
+ *
+ * Initialize the error data (per thread)
+ *
+ * Returns 0 in case of success, -1 in case of failure.
+ */
+int
+virErrorInitialize(void)
+{
+    return virThreadLocalInit(&virLastErr, virLastErrFreeData);
+}
+
+
+/*
+ * Internal helper to ensure a generic error code is stored
+ * in case where API returns failure, but forgot to set an
+ * error
+ */
+static void
+virErrorGenericFailure(virErrorPtr err)
+{
+    err->code = VIR_ERR_INTERNAL_ERROR;
+    err->domain = VIR_FROM_NONE;
+    err->level = VIR_ERR_ERROR;
+    err->message = strdup(_("An error occurred, but the cause is unknown"));
+}
+
+
+/*
+ * Internal helper to perform a deep copy of an error
+ */
+static int
+virCopyError(virErrorPtr from,
+             virErrorPtr to)
+{
+    int ret = 0;
+    if (!to)
+        return 0;
+    virResetError(to);
+    if (!from)
+        return 0;
+    to->code = from->code;
+    to->domain = from->domain;
+    to->level = from->level;
+    if (from->message && !(to->message = strdup(from->message)))
+        ret = -1;
+    if (from->str1 && !(to->str1 = strdup(from->str1)))
+        ret = -1;
+    if (from->str2 && !(to->str2 = strdup(from->str2)))
+        ret = -1;
+    if (from->str3 && !(to->str3 = strdup(from->str3)))
+        ret = -1;
+    to->int1 = from->int1;
+    to->int2 = from->int2;
+    /*
+     * Deliberately not setting 'conn', 'dom', 'net' references
+     */
+    return ret;
+}
+
+static virErrorPtr
+virLastErrorObject(void)
+{
+    virErrorPtr err;
+    err = virThreadLocalGet(&virLastErr);
+    if (!err) {
+        if (VIR_ALLOC(err) < 0)
+            return NULL;
+        if (virThreadLocalSet(&virLastErr, err) < 0)
+            VIR_FREE(err);
+    }
+    return err;
+}
+
+
+/**
+ * virGetLastError:
+ *
+ * Provide a pointer to the last error caught at the library level
+ *
+ * The error object is kept in thread local storage, so separate
+ * threads can safely access this concurrently.
+ *
+ * Returns a pointer to the last error or NULL if none occurred.
+ */
+virErrorPtr
+virGetLastError(void)
+{
+    virErrorPtr err = virLastErrorObject();
+    if (!err || err->code == VIR_ERR_OK)
+        return NULL;
+    return err;
+}
+
+/**
+ * virSetError:
+ * @newerr: previously saved error object
+ *
+ * Set the current error from a previously saved error object
+ *
+ * Can be used to re-set an old error, which may have been squashed by
+ * other functions (like cleanup routines).
+ *
+ * Returns 0 on success, -1 on failure.  Leaves errno unchanged.
+ */
+int
+virSetError(virErrorPtr newerr)
+{
+    virErrorPtr err;
+    int saved_errno = errno;
+    int ret = -1;
+
+    err = virLastErrorObject();
+    if (!err)
+        goto cleanup;
+
+    virResetError(err);
+    ret = virCopyError(newerr, err);
+cleanup:
+    errno = saved_errno;
+    return ret;
+}
+
+/**
+ * virCopyLastError:
+ * @to: target to receive the copy
+ *
+ * Copy the content of the last error caught at the library level
+ *
+ * The error object is kept in thread local storage, so separate
+ * threads can safely access this concurrently.
+ *
+ * One will need to free the result with virResetError()
+ *
+ * Returns 0 if no error was found and the error code otherwise and -1 in case
+ *         of parameter error.
+ */
+int
+virCopyLastError(virErrorPtr to)
+{
+    virErrorPtr err = virLastErrorObject();
+    /* We can't guarantee caller has initialized it to zero */
+    memset(to, 0, sizeof(*to));
+    if (err)
+        virCopyError(err, to);
+    else
+        virResetError(to);
+    return to->code;
+}
+
+/**
+ * virSaveLastError:
+ *
+ * Save the last error into a new error object.  On success, errno is
+ * unchanged; on failure, errno is ENOMEM.
+ *
+ * Returns a pointer to the copied error or NULL if allocation failed.
+ * It is the caller's responsibility to free the error with
+ * virFreeError().
+ */
+virErrorPtr
+virSaveLastError(void)
+{
+    virErrorPtr to;
+    int saved_errno = errno;
+
+    if (VIR_ALLOC(to) < 0)
+        return NULL;
+
+    virCopyLastError(to);
+    errno = saved_errno;
+    return to;
+}
+
+/**
+ * virResetError:
+ * @err: pointer to the virError to clean up
+ *
+ * Reset the error being pointed to
+ */
+void
+virResetError(virErrorPtr err)
+{
+    if (err == NULL)
+        return;
+    VIR_FREE(err->message);
+    VIR_FREE(err->str1);
+    VIR_FREE(err->str2);
+    VIR_FREE(err->str3);
+    memset(err, 0, sizeof(virError));
+}
+
+/**
+ * virFreeError:
+ * @err: error to free
+ *
+ * Resets and frees the given error.
+ */
+void
+virFreeError(virErrorPtr err)
+{
+    virResetError(err);
+    VIR_FREE(err);
+}
+
+/**
+ * virResetLastError:
+ *
+ * Reset the last error caught at the library level.
+ *
+ * The error object is kept in thread local storage, so separate
+ * threads can safely access this concurrently, only resetting
+ * their own error object.
+ */
+void
+virResetLastError(void)
+{
+    virErrorPtr err = virLastErrorObject();
+    if (err)
+        virResetError(err);
+}
+
+/**
+ * virConnGetLastError:
+ * @conn: pointer to the hypervisor connection
+ *
+ * Provide a pointer to the last error caught on that connection
+ *
+ * This method is not protected against access from multiple
+ * threads. In a multi-threaded application, always use the
+ * global virGetLastError() API which is backed by thread
+ * local storage.
+ *
+ * If the connection object was discovered to be invalid by
+ * an API call, then the error will be reported against the
+ * global error object.
+ *
+ * Since 0.6.0, all errors reported in the per-connection object
+ * are also duplicated in the global error object. As such an
+ * application can always use virGetLastError(). This method
+ * remains for backwards compatibility.
+ *
+ * Returns a pointer to the last error or NULL if none occurred.
+ */
+virErrorPtr
+virConnGetLastError(virConnectPtr conn)
+{
+    if (conn == NULL)
+        return NULL;
+    return &conn->err;
+}
+
+/**
+ * virConnCopyLastError:
+ * @conn: pointer to the hypervisor connection
+ * @to: target to receive the copy
+ *
+ * Copy the content of the last error caught on that connection
+ *
+ * This method is not protected against access from multiple
+ * threads. In a multi-threaded application, always use the
+ * global virGetLastError() API which is backed by thread
+ * local storage.
+ *
+ * If the connection object was discovered to be invalid by
+ * an API call, then the error will be reported against the
+ * global error object.
+ *
+ * Since 0.6.0, all errors reported in the per-connection object
+ * are also duplicated in the global error object. As such an
+ * application can always use virGetLastError(). This method
+ * remains for backwards compatibility.
+ *
+ * One will need to free the result with virResetError()
+ *
+ * Returns 0 if no error was found and the error code otherwise and -1 in case
+ *         of parameter error.
+ */
+int
+virConnCopyLastError(virConnectPtr conn, virErrorPtr to)
+{
+    /* We can't guarantee caller has initialized it to zero */
+    memset(to, 0, sizeof(*to));
+
+    if (conn == NULL)
+        return -1;
+    virMutexLock(&conn->lock);
+    if (conn->err.code == VIR_ERR_OK)
+        virResetError(to);
+    else
+        virCopyError(&conn->err, to);
+    virMutexUnlock(&conn->lock);
+    return to->code;
+}
+
+/**
+ * virConnResetLastError:
+ * @conn: pointer to the hypervisor connection
+ *
+ * The error object is kept in thread local storage, so separate
+ * threads can safely access this concurrently.
+ *
+ * Reset the last error caught on that connection
+ */
+void
+virConnResetLastError(virConnectPtr conn)
+{
+    if (conn == NULL)
+        return;
+    virMutexLock(&conn->lock);
+    virResetError(&conn->err);
+    virMutexUnlock(&conn->lock);
+}
+
+/**
+ * virSetErrorFunc:
+ * @userData: pointer to the user data provided in the handler callback
+ * @handler: the function to get called in case of error or NULL
+ *
+ * Set a library global error handling function, if @handler is NULL,
+ * it will reset to default printing on stderr. The error raised there
+ * are those for which no handler at the connection level could caught.
+ */
+void
+virSetErrorFunc(void *userData, virErrorFunc handler)
+{
+    virErrorHandler = handler;
+    virUserData = userData;
+}
+
+/**
+ * virConnSetErrorFunc:
+ * @conn: pointer to the hypervisor connection
+ * @userData: pointer to the user data provided in the handler callback
+ * @handler: the function to get called in case of error or NULL
+ *
+ * Set a connection error handling function, if @handler is NULL
+ * it will reset to default which is to pass error back to the global
+ * library handler.
+ */
+void
+virConnSetErrorFunc(virConnectPtr conn, void *userData,
+                    virErrorFunc handler)
+{
+    if (conn == NULL)
+        return;
+    virMutexLock(&conn->lock);
+    conn->handler = handler;
+    conn->userData = userData;
+    virMutexUnlock(&conn->lock);
+}
+
+/**
+ * virDefaultErrorFunc:
+ * @err: pointer to the error.
+ *
+ * Default routine reporting an error to stderr.
+ */
+void
+virDefaultErrorFunc(virErrorPtr err)
+{
+    const char *lvl = "", *dom = "", *domain = "", *network = "";
+    int len;
+
+    if ((err == NULL) || (err->code == VIR_ERR_OK))
+        return;
+    switch (err->level) {
+        case VIR_ERR_NONE:
+            lvl = "";
+            break;
+        case VIR_ERR_WARNING:
+            lvl = _("warning");
+            break;
+        case VIR_ERR_ERROR:
+            lvl = _("error");
+            break;
+    }
+    dom = virErrorDomainTypeToString(err->domain);
+    if (!dom)
+        dom = "Unknown";
+    if ((err->dom != NULL) && (err->code != VIR_ERR_INVALID_DOMAIN)) {
+        domain = err->dom->name;
+    } else if ((err->net != NULL) && (err->code != VIR_ERR_INVALID_NETWORK)) {
+        network = err->net->name;
+    }
+    len = strlen(err->message);
+    if ((err->domain == VIR_FROM_XML) && (err->code == VIR_ERR_XML_DETAIL) &&
+        (err->int1 != 0))
+        fprintf(stderr, "libvir: %s %s %s%s: line %d: %s",
+                dom, lvl, domain, network, err->int1, err->message);
+    else if ((len == 0) || (err->message[len - 1] != '\n'))
+        fprintf(stderr, "libvir: %s %s %s%s: %s\n",
+                dom, lvl, domain, network, err->message);
+    else
+        fprintf(stderr, "libvir: %s %s %s%s: %s",
+                dom, lvl, domain, network, err->message);
+}
+
+/**
+ * virDispatchError:
+ * @conn: pointer to the hypervisor connection
+ *
+ * Internal helper to do final stage of error
+ * reporting in public APIs.
+ *
+ *  - Copy the global error to per-connection error if needed
+ *  - Set a generic error message if none is already set
+ *  - Invoke the error callback functions
+ */
+void
+virDispatchError(virConnectPtr conn)
+{
+    virErrorPtr err = virLastErrorObject();
+    virErrorFunc handler = virErrorHandler;
+    void *userData = virUserData;
+
+    /* Can only happen on OOM.  */
+    if (!err)
+        return;
+
+    /* Set a generic error message if none is already set */
+    if (err->code == VIR_ERR_OK)
+        virErrorGenericFailure(err);
+
+    /* Copy the global error to per-connection error if needed */
+    if (conn) {
+        virMutexLock(&conn->lock);
+        virCopyError(err, &conn->err);
+
+        if (conn->handler != NULL) {
+            handler = conn->handler;
+            userData = conn->userData;
+        }
+        virMutexUnlock(&conn->lock);
+    }
+
+    /* Invoke the error callback functions */
+    if (handler != NULL) {
+        (handler)(userData, err);
+    } else {
+        virDefaultErrorFunc(err);
+    }
+}
+
+
+
+/**
+ * virRaiseErrorFull:
+ * @filename: filename where error was raised
+ * @funcname: function name where error was raised
+ * @linenr: line number where error was raised
+ * @domain: the virErrorDomain indicating where it's coming from
+ * @code: the virErrorNumber code for the error
+ * @level: the virErrorLevel for the error
+ * @str1: extra string info
+ * @str2: extra string info
+ * @str3: extra string info
+ * @int1: extra int info
+ * @int2: extra int info
+ * @fmt:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ *
+ * Internal routine called when an error is detected. It will raise it
+ * immediately if a callback is found and store it for later handling.
+ */
+void
+virRaiseErrorFull(const char *filename ATTRIBUTE_UNUSED,
+                  const char *funcname,
+                  size_t linenr,
+                  int domain,
+                  int code,
+                  virErrorLevel level,
+                  const char *str1,
+                  const char *str2,
+                  const char *str3,
+                  int int1,
+                  int int2,
+                  const char *fmt, ...)
+{
+    int save_errno = errno;
+    virErrorPtr to;
+    char *str;
+    int priority;
+
+    /*
+     * All errors are recorded in thread local storage
+     * For compatibility, public API calls will copy them
+     * to the per-connection error object when necessary
+     */
+    to = virLastErrorObject();
+    if (!to) {
+        errno = save_errno;
+        return; /* Hit OOM allocating thread error object, sod all we can do now */
+    }
+
+    virResetError(to);
+
+    if (code == VIR_ERR_OK) {
+        errno = save_errno;
+        return;
+    }
+
+    /*
+     * formats the message; drop message on OOM situations
+     */
+    if (fmt == NULL) {
+        str = strdup(_("No error message provided"));
+    } else {
+        va_list ap;
+        va_start(ap, fmt);
+        virVasprintf(&str, fmt, ap);
+        va_end(ap);
+    }
+
+    /*
+     * Save the information about the error
+     */
+    /*
+     * Deliberately not setting conn, dom & net fields since
+     * they're utterly unsafe
+     */
+    to->domain = domain;
+    to->code = code;
+    to->message = str;
+    to->level = level;
+    if (str1 != NULL)
+        to->str1 = strdup(str1);
+    if (str2 != NULL)
+        to->str2 = strdup(str2);
+    if (str3 != NULL)
+        to->str3 = strdup(str3);
+    to->int1 = int1;
+    to->int2 = int2;
+
+    /*
+     * Hook up the error or warning to the logging facility
+     */
+    priority = virErrorLevelPriority(level);
+    if (virErrorLogPriorityFilter)
+        priority = virErrorLogPriorityFilter(to, priority);
+    virLogMessage(virErrorLogPriorityFilter ? VIR_LOG_FROM_FILE : VIR_LOG_FROM_ERROR,
+                  priority,
+                  filename, linenr, funcname,
+                  NULL, "%s", str);
+
+    errno = save_errno;
+}
+
+/**
+ * virErrorMsg:
+ * @error: the virErrorNumber
+ * @info: usually the first parameter string
+ *
+ * Internal routine to get the message associated to an error raised
+ * from the library
+ *
+ * Returns the constant string associated to @error
+ */
+static const char *
+virErrorMsg(virErrorNumber error, const char *info)
+{
+    const char *errmsg = NULL;
+
+    switch (error) {
+        case VIR_ERR_OK:
+            return NULL;
+        case VIR_ERR_INTERNAL_ERROR:
+            if (info != NULL)
+              errmsg = _("internal error %s");
+            else
+              errmsg = _("internal error");
+            break;
+        case VIR_ERR_NO_MEMORY:
+            errmsg = _("out of memory");
+            break;
+        case VIR_ERR_NO_SUPPORT:
+            if (info == NULL)
+                errmsg = _("this function is not supported by the connection driver");
+            else
+                errmsg = _("this function is not supported by the connection driver: %s");
+            break;
+        case VIR_ERR_NO_CONNECT:
+            if (info == NULL)
+                errmsg = _("no connection driver available");
+            else
+                errmsg = _("no connection driver available for %s");
+            break;
+        case VIR_ERR_INVALID_CONN:
+            if (info == NULL)
+                errmsg = _("invalid connection pointer in");
+            else
+                errmsg = _("invalid connection pointer in %s");
+            break;
+        case VIR_ERR_INVALID_DOMAIN:
+            if (info == NULL)
+                errmsg = _("invalid domain pointer in");
+            else
+                errmsg = _("invalid domain pointer in %s");
+            break;
+        case VIR_ERR_INVALID_ARG:
+            if (info == NULL)
+                errmsg = _("invalid argument");
+            else
+                errmsg = _("invalid argument: %s");
+            break;
+        case VIR_ERR_OPERATION_FAILED:
+            if (info != NULL)
+                errmsg = _("operation failed: %s");
+            else
+                errmsg = _("operation failed");
+            break;
+        case VIR_ERR_GET_FAILED:
+            if (info != NULL)
+                errmsg = _("GET operation failed: %s");
+            else
+                errmsg = _("GET operation failed");
+            break;
+        case VIR_ERR_POST_FAILED:
+            if (info != NULL)
+                errmsg = _("POST operation failed: %s");
+            else
+                errmsg = _("POST operation failed");
+            break;
+        case VIR_ERR_HTTP_ERROR:
+            errmsg = _("got unknown HTTP error code %d");
+            break;
+        case VIR_ERR_UNKNOWN_HOST:
+            if (info != NULL)
+                errmsg = _("unknown host %s");
+            else
+                errmsg = _("unknown host");
+            break;
+        case VIR_ERR_SEXPR_SERIAL:
+            if (info != NULL)
+                errmsg = _("failed to serialize S-Expr: %s");
+            else
+                errmsg = _("failed to serialize S-Expr");
+            break;
+        case VIR_ERR_NO_XEN:
+            if (info == NULL)
+                errmsg = _("could not use Xen hypervisor entry");
+            else
+                errmsg = _("could not use Xen hypervisor entry %s");
+            break;
+        case VIR_ERR_NO_XENSTORE:
+            if (info == NULL)
+                errmsg = _("could not connect to Xen Store");
+            else
+                errmsg = _("could not connect to Xen Store %s");
+            break;
+        case VIR_ERR_XEN_CALL:
+            errmsg = _("failed Xen syscall %s");
+            break;
+        case VIR_ERR_OS_TYPE:
+            if (info == NULL)
+                errmsg = _("unknown OS type");
+            else
+                errmsg = _("unknown OS type %s");
+            break;
+        case VIR_ERR_NO_KERNEL:
+            errmsg = _("missing kernel information");
+            break;
+        case VIR_ERR_NO_ROOT:
+            if (info == NULL)
+                errmsg = _("missing root device information");
+            else
+                errmsg = _("missing root device information in %s");
+            break;
+        case VIR_ERR_NO_SOURCE:
+            if (info == NULL)
+                errmsg = _("missing source information for device");
+            else
+                errmsg = _("missing source information for device %s");
+            break;
+        case VIR_ERR_NO_TARGET:
+            if (info == NULL)
+                errmsg = _("missing target information for device");
+            else
+                errmsg = _("missing target information for device %s");
+            break;
+        case VIR_ERR_NO_NAME:
+            if (info == NULL)
+                errmsg = _("missing name information");
+            else
+                errmsg = _("missing name information in %s");
+            break;
+        case VIR_ERR_NO_OS:
+            if (info == NULL)
+                errmsg = _("missing operating system information");
+            else
+                errmsg = _("missing operating system information for %s");
+            break;
+        case VIR_ERR_NO_DEVICE:
+            if (info == NULL)
+                errmsg = _("missing devices information");
+            else
+                errmsg = _("missing devices information for %s");
+            break;
+        case VIR_ERR_DRIVER_FULL:
+            if (info == NULL)
+                errmsg = _("too many drivers registered");
+            else
+                errmsg = _("too many drivers registered in %s");
+            break;
+        case VIR_ERR_CALL_FAILED: /* DEPRECATED, use VIR_ERR_NO_SUPPORT */
+            if (info == NULL)
+                errmsg = _("library call failed, possibly not supported");
+            else
+                errmsg = _("library call %s failed, possibly not supported");
+            break;
+        case VIR_ERR_XML_ERROR:
+            if (info == NULL)
+                errmsg = _("XML description is invalid or not well formed");
+            else
+                errmsg = _("XML error: %s");
+            break;
+        case VIR_ERR_DOM_EXIST:
+            if (info == NULL)
+                errmsg = _("this domain exists already");
+            else
+                errmsg = _("domain %s exists already");
+            break;
+        case VIR_ERR_OPERATION_DENIED:
+            if (info == NULL)
+                errmsg = _("operation forbidden for read only access");
+            else
+                errmsg = _("operation %s forbidden for read only access");
+            break;
+        case VIR_ERR_OPEN_FAILED:
+            if (info == NULL)
+                errmsg = _("failed to open configuration file for reading");
+            else
+                errmsg = _("failed to open %s for reading");
+            break;
+        case VIR_ERR_READ_FAILED:
+            if (info == NULL)
+                errmsg = _("failed to read configuration file");
+            else
+                errmsg = _("failed to read configuration file %s");
+            break;
+        case VIR_ERR_PARSE_FAILED:
+            if (info == NULL)
+                errmsg = _("failed to parse configuration file");
+            else
+                errmsg = _("failed to parse configuration file %s");
+            break;
+        case VIR_ERR_CONF_SYNTAX:
+            if (info == NULL)
+                errmsg = _("configuration file syntax error");
+            else
+                errmsg = _("configuration file syntax error: %s");
+            break;
+        case VIR_ERR_WRITE_FAILED:
+            if (info == NULL)
+                errmsg = _("failed to write configuration file");
+            else
+                errmsg = _("failed to write configuration file: %s");
+            break;
+        case VIR_ERR_XML_DETAIL:
+            if (info == NULL)
+                errmsg = _("parser error");
+            else
+                errmsg = "%s";
+            break;
+        case VIR_ERR_INVALID_NETWORK:
+            if (info == NULL)
+                errmsg = _("invalid network pointer in");
+            else
+                errmsg = _("invalid network pointer in %s");
+            break;
+        case VIR_ERR_NETWORK_EXIST:
+            if (info == NULL)
+                errmsg = _("this network exists already");
+            else
+                errmsg = _("network %s exists already");
+            break;
+        case VIR_ERR_SYSTEM_ERROR:
+            if (info == NULL)
+                errmsg = _("system call error");
+            else
+                errmsg = "%s";
+            break;
+        case VIR_ERR_RPC:
+            if (info == NULL)
+                errmsg = _("RPC error");
+            else
+                errmsg = "%s";
+            break;
+        case VIR_ERR_GNUTLS_ERROR:
+            if (info == NULL)
+                errmsg = _("GNUTLS call error");
+            else
+                errmsg = "%s";
+            break;
+        case VIR_WAR_NO_NETWORK:
+            if (info == NULL)
+                errmsg = _("Failed to find the network");
+            else
+                errmsg = _("Failed to find the network: %s");
+            break;
+        case VIR_ERR_NO_DOMAIN:
+            if (info == NULL)
+                errmsg = _("Domain not found");
+            else
+                errmsg = _("Domain not found: %s");
+            break;
+        case VIR_ERR_NO_NETWORK:
+            if (info == NULL)
+                errmsg = _("Network not found");
+            else
+                errmsg = _("Network not found: %s");
+            break;
+        case VIR_ERR_INVALID_MAC:
+            if (info == NULL)
+                errmsg = _("invalid MAC address");
+            else
+                errmsg = _("invalid MAC address: %s");
+            break;
+        case VIR_ERR_AUTH_FAILED:
+            if (info == NULL)
+                errmsg = _("authentication failed");
+            else
+                errmsg = _("authentication failed: %s");
+            break;
+        case VIR_ERR_AUTH_CANCELLED:
+            if (info == NULL)
+                errmsg = _("authentication cancelled");
+            else
+                errmsg = _("authentication cancelled: %s");
+            break;
+        case VIR_ERR_NO_STORAGE_POOL:
+            if (info == NULL)
+                errmsg = _("Storage pool not found");
+            else
+                errmsg = _("Storage pool not found: %s");
+            break;
+        case VIR_ERR_NO_STORAGE_VOL:
+            if (info == NULL)
+                errmsg = _("Storage volume not found");
+            else
+                errmsg = _("Storage volume not found: %s");
+            break;
+        case VIR_ERR_STORAGE_PROBE_FAILED:
+            if (info == NULL)
+                errmsg = _("Storage pool probe failed");
+            else
+                errmsg = _("Storage pool probe failed: %s");
+            break;
+        case VIR_ERR_STORAGE_POOL_BUILT:
+            if (info == NULL)
+                errmsg = _("Storage pool already built");
+            else
+                errmsg = _("Storage pool already built: %s");
+            break;
+        case VIR_ERR_INVALID_STORAGE_POOL:
+            if (info == NULL)
+                errmsg = _("invalid storage pool pointer in");
+            else
+                errmsg = _("invalid storage pool pointer in %s");
+            break;
+        case VIR_ERR_INVALID_STORAGE_VOL:
+            if (info == NULL)
+                errmsg = _("invalid storage volume pointer in");
+            else
+                errmsg = _("invalid storage volume pointer in %s");
+            break;
+        case VIR_WAR_NO_STORAGE:
+            if (info == NULL)
+                errmsg = _("Failed to find a storage driver");
+            else
+                errmsg = _("Failed to find a storage driver: %s");
+            break;
+        case VIR_WAR_NO_NODE:
+            if (info == NULL)
+                errmsg = _("Failed to find a node driver");
+            else
+                errmsg = _("Failed to find a node driver: %s");
+            break;
+        case VIR_ERR_INVALID_NODE_DEVICE:
+            if (info == NULL)
+                errmsg = _("invalid node device pointer");
+            else
+                errmsg = _("invalid node device pointer in %s");
+            break;
+        case VIR_ERR_NO_NODE_DEVICE:
+            if (info == NULL)
+                errmsg = _("Node device not found");
+            else
+                errmsg = _("Node device not found: %s");
+            break;
+        case VIR_ERR_NO_SECURITY_MODEL:
+            if (info == NULL)
+                errmsg = _("Security model not found");
+            else
+                errmsg = _("Security model not found: %s");
+            break;
+        case VIR_ERR_OPERATION_INVALID:
+            if (info == NULL)
+                errmsg = _("Requested operation is not valid");
+            else
+                errmsg = _("Requested operation is not valid: %s");
+            break;
+        case VIR_WAR_NO_INTERFACE:
+            if (info == NULL)
+                errmsg = _("Failed to find the interface");
+            else
+                errmsg = _("Failed to find the interface: %s");
+            break;
+        case VIR_ERR_NO_INTERFACE:
+            if (info == NULL)
+                errmsg = _("Interface not found");
+            else
+                errmsg = _("Interface not found: %s");
+            break;
+        case VIR_ERR_INVALID_INTERFACE:
+            if (info == NULL)
+                errmsg = _("invalid interface pointer in");
+            else
+                errmsg = _("invalid interface pointer in %s");
+            break;
+        case VIR_ERR_MULTIPLE_INTERFACES:
+            if (info == NULL)
+                errmsg = _("multiple matching interfaces found");
+            else
+                errmsg = _("multiple matching interfaces found: %s");
+            break;
+        case VIR_WAR_NO_SECRET:
+            if (info == NULL)
+                errmsg = _("Failed to find a secret storage driver");
+            else
+                errmsg = _("Failed to find a secret storage driver: %s");
+            break;
+        case VIR_ERR_INVALID_SECRET:
+            if (info == NULL)
+                errmsg = _("Invalid secret");
+            else
+                errmsg = _("Invalid secret: %s");
+            break;
+        case VIR_ERR_NO_SECRET:
+            if (info == NULL)
+                errmsg = _("Secret not found");
+            else
+                errmsg = _("Secret not found: %s");
+            break;
+        case VIR_WAR_NO_NWFILTER:
+            if (info == NULL)
+                errmsg = _("Failed to start the nwfilter driver");
+            else
+                errmsg = _("Failed to start the nwfilter driver: %s");
+            break;
+        case VIR_ERR_INVALID_NWFILTER:
+            if (info == NULL)
+                errmsg = _("Invalid network filter");
+            else
+                errmsg = _("Invalid network filter: %s");
+            break;
+        case VIR_ERR_NO_NWFILTER:
+            if (info == NULL)
+                errmsg = _("Network filter not found");
+            else
+                errmsg = _("Network filter not found: %s");
+            break;
+        case VIR_ERR_BUILD_FIREWALL:
+            if (info == NULL)
+                errmsg = _("Error while building firewall");
+            else
+                errmsg = _("Error while building firewall: %s");
+            break;
+        case VIR_ERR_CONFIG_UNSUPPORTED:
+            if (info == NULL)
+                errmsg = _("unsupported configuration");
+            else
+                errmsg = _("unsupported configuration: %s");
+            break;
+        case VIR_ERR_OPERATION_TIMEOUT:
+            if (info == NULL)
+                errmsg = _("Timed out during operation");
+            else
+                errmsg = _("Timed out during operation: %s");
+            break;
+        case VIR_ERR_MIGRATE_PERSIST_FAILED:
+            if (info == NULL)
+                errmsg = _("Failed to make domain persistent after migration");
+            else
+                errmsg = _("Failed to make domain persistent after migration: %s");
+            break;
+        case VIR_ERR_HOOK_SCRIPT_FAILED:
+            if (info == NULL)
+                errmsg = _("Hook script execution failed");
+            else
+                errmsg = _("Hook script execution failed: %s");
+            break;
+        case VIR_ERR_INVALID_DOMAIN_SNAPSHOT:
+            if (info == NULL)
+                errmsg = _("Invalid snapshot");
+            else
+                errmsg = _("Invalid snapshot: %s");
+            break;
+        case VIR_ERR_NO_DOMAIN_SNAPSHOT:
+            if (info == NULL)
+                errmsg = _("Domain snapshot not found");
+            else
+                errmsg = _("Domain snapshot not found: %s");
+            break;
+        case VIR_ERR_INVALID_STREAM:
+            if (info == NULL)
+                errmsg = _("invalid stream pointer");
+            else
+                errmsg = _("invalid stream pointer in %s");
+            break;
+        case VIR_ERR_ARGUMENT_UNSUPPORTED:
+            if (info == NULL)
+                errmsg = _("argument unsupported");
+            else
+                errmsg = _("argument unsupported: %s");
+            break;
+        case VIR_ERR_SNAPSHOT_REVERT_RISKY:
+            if (info == NULL)
+                errmsg = _("revert requires force");
+            else
+                errmsg = _("revert requires force: %s");
+            break;
+        case VIR_ERR_OPERATION_ABORTED:
+            if (info == NULL)
+                errmsg = _("operation aborted");
+            else
+                errmsg = _("operation aborted: %s");
+            break;
+        case VIR_ERR_NO_DOMAIN_METADATA:
+            if (info == NULL)
+                errmsg = _("metadata not found");
+            else
+                errmsg = _("metadata not found: %s");
+            break;
+        case VIR_ERR_MIGRATE_UNSAFE:
+            if (!info)
+                errmsg = _("Unsafe migration");
+            else
+                errmsg = _("Unsafe migration: %s");
+            break;
+        case VIR_ERR_OVERFLOW:
+            if (!info)
+                errmsg = _("numerical overflow");
+            else
+                errmsg = _("numerical overflow: %s");
+            break;
+        case VIR_ERR_BLOCK_COPY_ACTIVE:
+            if (!info)
+                errmsg = _("block copy still active");
+            else
+                errmsg = _("block copy still active: %s");
+            break;
+        case VIR_ERR_OPERATION_UNSUPPORTED:
+            if (!info)
+                errmsg = _("Operation not supported");
+            else
+                errmsg = _("Operation not supported: %s");
+            break;
+        case VIR_ERR_SSH:
+            if (info == NULL)
+                errmsg = _("SSH transport error");
+            else
+                errmsg = _("SSH transport error: %s");
+            break;
+        case VIR_ERR_AGENT_UNRESPONSIVE:
+            if (info == NULL)
+                errmsg = _("Guest agent is not responding");
+            else
+                errmsg = _("Guest agent is not responding: %s");
+            break;
+        case VIR_ERR_RESOURCE_BUSY:
+            if (info == NULL)
+                errmsg = _("resource busy");
+            else
+                errmsg = _("resource busy %s");
+            break;
+    }
+    return errmsg;
+}
+
+/**
+ * virReportErrorHelper:
+ *
+ * @domcode: the virErrorDomain indicating where it's coming from
+ * @errorcode: the virErrorNumber code for the error
+ * @filename: Source file error is dispatched from
+ * @funcname: Function error is dispatched from
+ * @linenr: Line number error is dispatched from
+ * @fmt:  the format string
+ * @...:  extra parameters for the message display
+ *
+ * Helper function to do most of the grunt work for individual driver
+ * ReportError
+ */
+void virReportErrorHelper(int domcode,
+                          int errorcode,
+                          const char *filename,
+                          const char *funcname,
+                          size_t linenr,
+                          const char *fmt, ...)
+{
+    int save_errno = errno;
+    va_list args;
+    char errorMessage[1024];
+    const char *virerr;
+
+    if (fmt) {
+        va_start(args, fmt);
+        vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args);
+        va_end(args);
+    } else {
+        errorMessage[0] = '\0';
+    }
+
+    virerr = virErrorMsg(errorcode, (errorMessage[0] ? errorMessage : NULL));
+    virRaiseErrorFull(filename, funcname, linenr,
+                      domcode, errorcode, VIR_ERR_ERROR,
+                      virerr, errorMessage, NULL,
+                      -1, -1, virerr, errorMessage);
+    errno = save_errno;
+}
+
+/**
+ * virStrerror:
+ * @theerrno: the errno value
+ * @errBuf: the buffer to save the error to
+ * @errBufLen: the buffer length
+ *
+ * Generate an error string for the given errno
+ *
+ * Returns a pointer to the error string, possibly indicating that the
+ *         error is unknown
+ */
+const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen)
+{
+    int save_errno = errno;
+    const char *ret;
+
+    strerror_r(theerrno, errBuf, errBufLen);
+    ret = errBuf;
+    errno = save_errno;
+    return ret;
+}
+
+/**
+ * virReportSystemErrorFull:
+ * @domcode: the virErrorDomain indicating where it's coming from
+ * @theerrno: an errno number
+ * @filename: filename where error was raised
+ * @funcname: function name where error was raised
+ * @linenr: line number where error was raised
+ * @fmt:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ *
+ * Convenience internal routine called when a system error is detected.
+ */
+void virReportSystemErrorFull(int domcode,
+                              int theerrno,
+                              const char *filename,
+                              const char *funcname,
+                              size_t linenr,
+                              const char *fmt, ...)
+{
+    int save_errno = errno;
+    char strerror_buf[1024];
+    char msgDetailBuf[1024];
+
+    const char *errnoDetail = virStrerror(theerrno, strerror_buf,
+                                          sizeof(strerror_buf));
+    const char *msg = virErrorMsg(VIR_ERR_SYSTEM_ERROR, fmt);
+    const char *msgDetail = NULL;
+
+    if (fmt) {
+        va_list args;
+        int n;
+
+        va_start(args, fmt);
+        n = vsnprintf(msgDetailBuf, sizeof(msgDetailBuf), fmt, args);
+        va_end(args);
+
+        size_t len = strlen(errnoDetail);
+        if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
+          char *p = msgDetailBuf + n;
+          stpcpy(stpcpy(p, ": "), errnoDetail);
+          msgDetail = msgDetailBuf;
+        }
+    }
+
+    if (!msgDetail)
+        msgDetail = errnoDetail;
+
+    virRaiseErrorFull(filename, funcname, linenr,
+                      domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR,
+                      msg, msgDetail, NULL, theerrno, -1, msg, msgDetail);
+    errno = save_errno;
+}
+
+/**
+ * virReportOOMErrorFull:
+ * @domcode: the virErrorDomain indicating where it's coming from
+ * @filename: filename where error was raised
+ * @funcname: function name where error was raised
+ * @linenr: line number where error was raised
+ *
+ * Convenience internal routine called when an out of memory error is
+ * detected
+ */
+void virReportOOMErrorFull(int domcode,
+                           const char *filename,
+                           const char *funcname,
+                           size_t linenr)
+{
+    const char *virerr;
+
+    virerr = virErrorMsg(VIR_ERR_NO_MEMORY, NULL);
+    virRaiseErrorFull(filename, funcname, linenr,
+                      domcode, VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
+                      virerr, NULL, NULL, -1, -1, virerr, NULL);
+}
+
+/**
+ * virSetErrorLogPriorityFunc:
+ * @func: function to install
+ *
+ * Install a function used to filter error logging based on error priority.
+ */
+void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func)
+{
+    virErrorLogPriorityFilter = func;
+}
diff --git a/src/util/virerror.h b/src/util/virerror.h
new file mode 100644
index 0000000..961c423
--- /dev/null
+++ b/src/util/virerror.h
@@ -0,0 +1,167 @@
+/*
+ * virterror.h: internal error handling
+ *
+ * Copyright (C) 2006-2009, 2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __VIRT_ERROR_H_
+# define __VIRT_ERROR_H_
+
+# include "internal.h"
+
+extern virErrorFunc virErrorHandler;
+extern void *virUserData;
+
+/************************************************************************
+ *									*
+ *		API for error handling					*
+ *									*
+ ************************************************************************/
+int virErrorInitialize(void);
+void virRaiseErrorFull(const char *filename,
+                       const char *funcname,
+                       size_t linenr,
+                       int domain,
+                       int code,
+                       virErrorLevel level,
+                       const char *str1,
+                       const char *str2,
+                       const char *str3,
+                       int int1,
+                       int int2,
+                       const char *fmt, ...)
+    ATTRIBUTE_FMT_PRINTF(12, 13);
+
+void virReportErrorHelper(int domcode, int errcode,
+                          const char *filename,
+                          const char *funcname,
+                          size_t linenr,
+                          const char *fmt, ...)
+  ATTRIBUTE_FMT_PRINTF(6, 7);
+
+void virReportSystemErrorFull(int domcode,
+                              int theerrno,
+                              const char *filename,
+                              const char *funcname,
+                              size_t linenr,
+                              const char *fmt, ...)
+    ATTRIBUTE_FMT_PRINTF(6, 7);
+
+# define virReportSystemError(theerrno, fmt,...)                   \
+    virReportSystemErrorFull(VIR_FROM_THIS,                       \
+                             (theerrno),                          \
+                             __FILE__, __FUNCTION__, __LINE__,    \
+                             (fmt), __VA_ARGS__)
+
+# define virReportInvalidNullArg(argname)                            \
+    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
+                      VIR_FROM_THIS,                                 \
+                      VIR_ERR_INVALID_ARG,                           \
+                      VIR_ERR_ERROR,                                 \
+                      __FUNCTION__,                                  \
+                      #argname,                                      \
+                      NULL,                                          \
+                      0, 0,                                          \
+                      _("%s in %s must be NULL"),                    \
+                      #argname, __FUNCTION__)
+# define virReportInvalidNonNullArg(argname)                         \
+    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
+                      VIR_FROM_THIS,                                 \
+                      VIR_ERR_INVALID_ARG,                           \
+                      VIR_ERR_ERROR,                                 \
+                      __FUNCTION__,                                  \
+                      #argname,                                      \
+                      NULL,                                          \
+                      0, 0,                                          \
+                      _("%s in %s must not be NULL"),                \
+                      #argname, __FUNCTION__)
+# define virReportInvalidPositiveArg(argname)                        \
+    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
+                      VIR_FROM_THIS,                                 \
+                      VIR_ERR_INVALID_ARG,                           \
+                      VIR_ERR_ERROR,                                 \
+                      __FUNCTION__,                                  \
+                      #argname,                                      \
+                      NULL,                                          \
+                      0, 0,                                          \
+                      _("%s in %s must greater than zero"),          \
+                      #argname, __FUNCTION__)
+# define virReportInvalidNonZeroArg(argname)                         \
+    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
+                      VIR_FROM_THIS,                                 \
+                      VIR_ERR_INVALID_ARG,                           \
+                      VIR_ERR_ERROR,                                 \
+                      __FUNCTION__,                                  \
+                      #argname,                                      \
+                      NULL,                                          \
+                      0, 0,                                          \
+                      _("%s in %s must not be zero"),                \
+                      #argname, __FUNCTION__)
+# define virReportInvalidZeroArg(argname)                            \
+    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
+                      VIR_FROM_THIS,                                 \
+                      VIR_ERR_INVALID_ARG,                           \
+                      VIR_ERR_ERROR,                                 \
+                      __FUNCTION__,                                  \
+                      #argname,                                      \
+                      NULL,                                          \
+                      0, 0,                                          \
+                      _("%s in %s must  be zero"),                   \
+                      #argname, __FUNCTION__)
+# define virReportInvalidNonNegativeArg(argname)                     \
+    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
+                      VIR_FROM_THIS,                                 \
+                      VIR_ERR_INVALID_ARG,                           \
+                      VIR_ERR_ERROR,                                 \
+                      __FUNCTION__,                                  \
+                      #argname,                                      \
+                      NULL,                                          \
+                      0, 0,                                          \
+                      _("%s in %s must be zero or greater"),         \
+                      #argname, __FUNCTION__)
+# define virReportInvalidArg(argname, fmt, ...)                      \
+    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
+                      VIR_FROM_THIS,                                 \
+                      VIR_ERR_INVALID_ARG,                           \
+                      VIR_ERR_ERROR,                                 \
+                      __FUNCTION__,                                  \
+                      #argname,                                      \
+                      NULL,                                          \
+                      0, 0,                                          \
+                      (fmt), __VA_ARGS__)
+
+void virReportOOMErrorFull(int domcode,
+                           const char *filename,
+                           const char *funcname,
+                           size_t linenr);
+
+# define virReportOOMError() \
+    virReportOOMErrorFull(VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
+
+# define virReportError(code, ...)                                   \
+    virReportErrorHelper(VIR_FROM_THIS, code, __FILE__,              \
+                         __FUNCTION__, __LINE__, __VA_ARGS__)
+
+int virSetError(virErrorPtr newerr);
+void virDispatchError(virConnectPtr conn);
+const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
+
+typedef int (*virErrorLogPriorityFunc)(virErrorPtr, int);
+void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func);
+
+#endif
diff --git a/src/util/virevent.c b/src/util/virevent.c
index 573b4ac..a207a48 100644
--- a/src/util/virevent.c
+++ b/src/util/virevent.c
@@ -26,7 +26,7 @@
 #include "virevent.h"
 #include "vireventpoll.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #include <stdlib.h>
 
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index afb0e05..ac1bf8e 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -37,7 +37,7 @@
 #include "viralloc.h"
 #include "virutil.h"
 #include "virfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virtime.h"
 
 #define EVENT_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index f20ce64..50999aa 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -40,7 +40,7 @@
 #include "vircommand.h"
 #include "configmake.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virhash.c b/src/util/virhash.c
index a1234c4..2fe8751 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virhash.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/util/virhooks.c b/src/util/virhooks.c
index 54a869a..9ff158a 100644
--- a/src/util/virhooks.c
+++ b/src/util/virhooks.c
@@ -30,7 +30,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virhooks.h"
 #include "virutil.h"
 #include "virlog.h"
diff --git a/src/util/virinitctl.c b/src/util/virinitctl.c
index f8ac673..1618ffa 100644
--- a/src/util/virinitctl.c
+++ b/src/util/virinitctl.c
@@ -28,7 +28,7 @@
 
 #include "internal.h"
 #include "virinitctl.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "viralloc.h"
 #include "virfile.h"
diff --git a/src/util/viriptables.c b/src/util/viriptables.c
index eb8acf5..5ff3a1e 100644
--- a/src/util/viriptables.c
+++ b/src/util/viriptables.c
@@ -41,7 +41,7 @@
 #include "viriptables.h"
 #include "vircommand.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virthread.h"
 
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 4c9797c..2c412c2 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -25,7 +25,7 @@
 
 #include "virjson.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virutil.h"
 
diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c
index 99e5cd7..d77e95d 100644
--- a/src/util/virkeyfile.c
+++ b/src/util/virkeyfile.c
@@ -31,7 +31,7 @@
 #include "virutil.h"
 #include "virhash.h"
 #include "virkeyfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_CONF
 
diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index 81a1d81..9ada6a6 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -24,7 +24,7 @@
 #include "virlockspace.h"
 #include "virlog.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "virfile.h"
 #include "virhash.h"
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 43a59b4..d0e996d 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -40,7 +40,7 @@
 # include <sys/un.h>
 #endif
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "viralloc.h"
 #include "virutil.h"
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 3ea0e39..ce02d2c 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -25,7 +25,7 @@
 #include "virnetdev.h"
 #include "virmacaddr.h"
 #include "virfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "vircommand.h"
 #include "viralloc.h"
 #include "virpci.h"
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index 9cc8858..2c5b63a 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -25,7 +25,7 @@
 #include "virnetdevbandwidth.h"
 #include "vircommand.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index 4de88e3..b87c601 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -23,7 +23,7 @@
 #include <config.h>
 
 #include "virnetdevbridge.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 #include "virfile.h"
 #include "viralloc.h"
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 720a48a..a74db1e 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -30,7 +30,7 @@
 #include "virnetdevmacvlan.h"
 #include "virmacaddr.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NET
 
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index b876a4e..47c3db8 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -26,7 +26,7 @@
 #include "virnetdevopenvswitch.h"
 #include "vircommand.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virmacaddr.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 3565bbd..a884de1 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -27,9 +27,9 @@
 #include "virnetdev.h"
 #include "virnetdevbridge.h"
 #include "virnetdevopenvswitch.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "virutil.h"
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index c6568b7..3f81655 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -29,7 +29,7 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "vircommand.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virnetdevvlan.c b/src/util/virnetdevvlan.c
index 53c6b65..2fe2017 100644
--- a/src/util/virnetdevvlan.c
+++ b/src/util/virnetdevvlan.c
@@ -22,7 +22,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virnetdevvlan.h"
 #include "viralloc.h"
 
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index 60acabd..bb97e3a 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -23,7 +23,7 @@
 #include <config.h>
 
 #include "virnetdevvportprofile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 
 #define VIR_FROM_THIS VIR_FROM_NET
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index fdd4c0d..0b36fdc 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -40,7 +40,7 @@
 #include "viralloc.h"
 #include "virthread.h"
 #include "virmacaddr.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #ifndef SOL_NETLINK
 # define SOL_NETLINK 270
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 878be1d..df40ccd 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -28,7 +28,7 @@
 
 #include "viralloc.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virobject.c b/src/util/virobject.c
index aca6182..f51b735 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -25,7 +25,7 @@
 #include "virthread.h"
 #include "viralloc.h"
 #include "viratomic.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 8875aa6..83e9a7b 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -37,7 +37,7 @@
 #include "virlog.h"
 #include "viralloc.h"
 #include "vircommand.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virfile.h"
 
 #define PCI_SYSFS "/sys/bus/pci/"
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 29097e3..14c9f9f 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -33,7 +33,7 @@
 #include "virutil.h"
 #include "intprops.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "c-ctype.h"
 #include "areadlink.h"
 
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index b276643..e8001e5 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -28,7 +28,7 @@
 #include <sched.h>
 
 #include "virprocess.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "virutil.h"
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 1b6de6b..6c5bc91 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -30,7 +30,7 @@
 #include "virthread.h"
 #include "count-one-bits.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virsexpr.c b/src/util/virsexpr.c
index 8b70404..18d3c2d 100644
--- a/src/util/virsexpr.c
+++ b/src/util/virsexpr.c
@@ -17,7 +17,7 @@
 #include "c-ctype.h"
 #include <errno.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virsexpr.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 0f2f23d..7bc43a9 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "virsocketaddr.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 
 #include <netdb.h>
diff --git a/src/util/virstatslinux.c b/src/util/virstatslinux.c
index 135df75..3505b96 100644
--- a/src/util/virstatslinux.c
+++ b/src/util/virstatslinux.c
@@ -32,7 +32,7 @@
 # include <unistd.h>
 # include <regex.h>
 
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "datatypes.h"
 # include "virutil.h"
 # include "virstatslinux.h"
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index f183f19..4ff3e14 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -36,7 +36,7 @@
 #endif
 #include "dirname.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virfile.h"
 #include "c-ctype.h"
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 5607b3e..0420ca3 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -24,7 +24,7 @@
 #include "virstring.h"
 #include "viralloc.h"
 #include "virbuffer.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 88e4f5c..61f7288 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -30,7 +30,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virsysinfo.h"
 #include "virutil.h"
 #include "virlog.h"
diff --git a/src/util/virterror.c b/src/util/virterror.c
deleted file mode 100644
index a586738..0000000
--- a/src/util/virterror.c
+++ /dev/null
@@ -1,1369 +0,0 @@
-/*
- * virterror.c: implements error handling and reporting code for libvirt
- *
- * Copyright (C) 2006, 2008-2012 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Author: Daniel Veillard <veillard@xxxxxxxxxx>
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include "virterror_internal.h"
-#include "datatypes.h"
-#include "virlog.h"
-#include "viralloc.h"
-#include "virthread.h"
-#include "virutil.h"
-
-virThreadLocal virLastErr;
-
-virErrorFunc virErrorHandler = NULL;     /* global error handler */
-void *virUserData = NULL;        /* associated data */
-virErrorLogPriorityFunc virErrorLogPriorityFilter = NULL;
-
-static virLogPriority virErrorLevelPriority(virErrorLevel level) {
-    switch (level) {
-        case VIR_ERR_NONE:
-            return VIR_LOG_INFO;
-        case VIR_ERR_WARNING:
-            return VIR_LOG_WARN;
-        case VIR_ERR_ERROR:
-            return VIR_LOG_ERROR;
-    }
-    return VIR_LOG_ERROR;
-}
-
-
-VIR_ENUM_DECL(virErrorDomain)
-VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST,
-              "", /* 0 */
-              "Xen Driver",
-              "Xen Daemon",
-              "Xen Store",
-              "S-Expression",
-
-              "XML Util", /* 5 */
-              "Domain",
-              "XML-RPC",
-              "Proxy Daemon",
-              "Config File",
-
-              "QEMU Driver", /* 10 */
-              "Network",
-              "Test Driver",
-              "Remote Driver",
-              "OpenVZ Driver",
-
-              "Xen XM Driver", /* 15 */
-              "Linux Statistics",
-              "LXC Driver",
-              "Storage Driver",
-              "Network Driver",
-
-              "Domain Config", /* 20 */
-              "User Mode Linux Driver",
-              "Node Device Driver",
-              "Xen Inotify Driver",
-              "Security Driver",
-
-              "VirtualBox Driver", /* 25 */
-              "Network Interface Driver",
-              "Open Nebula Driver",
-              "ESX Driver",
-              "Power Hypervisor Driver",
-
-              "Secrets Driver", /* 30 */
-              "CPU Driver",
-              "XenAPI Driver",
-              "Network Filter Driver",
-              "Lifecycle Hook",
-
-              "Domain Snapshot", /* 35 */
-              "Audit Utils",
-              "Sysinfo Utils",
-              "I/O Stream Utils",
-              "VMWare Driver",
-
-              "Event Loop", /* 40 */
-              "Xen Light Driver",
-              "Lock Driver",
-              "Hyper-V Driver",
-              "Capabilities Utils",
-
-              "URI Utils", /* 45 */
-              "Authentication Utils",
-              "DBus Utils",
-              "Parallels Cloud Server",
-              "Device Config",
-
-              "SSH transport layer", /* 50 */
-              "Lock Space",
-              "Init control",
-    )
-
-
-/*
- * Internal helper that is called when a thread exits, to
- * release the error object stored in the thread local
- */
-static void
-virLastErrFreeData(void *data)
-{
-    virErrorPtr err = data;
-    if (!err)
-        return;
-    virResetError(err);
-    VIR_FREE(err);
-}
-
-
-/**
- * virErrorInitialize:
- *
- * Initialize the error data (per thread)
- *
- * Returns 0 in case of success, -1 in case of failure.
- */
-int
-virErrorInitialize(void)
-{
-    return virThreadLocalInit(&virLastErr, virLastErrFreeData);
-}
-
-
-/*
- * Internal helper to ensure a generic error code is stored
- * in case where API returns failure, but forgot to set an
- * error
- */
-static void
-virErrorGenericFailure(virErrorPtr err)
-{
-    err->code = VIR_ERR_INTERNAL_ERROR;
-    err->domain = VIR_FROM_NONE;
-    err->level = VIR_ERR_ERROR;
-    err->message = strdup(_("An error occurred, but the cause is unknown"));
-}
-
-
-/*
- * Internal helper to perform a deep copy of an error
- */
-static int
-virCopyError(virErrorPtr from,
-             virErrorPtr to)
-{
-    int ret = 0;
-    if (!to)
-        return 0;
-    virResetError(to);
-    if (!from)
-        return 0;
-    to->code = from->code;
-    to->domain = from->domain;
-    to->level = from->level;
-    if (from->message && !(to->message = strdup(from->message)))
-        ret = -1;
-    if (from->str1 && !(to->str1 = strdup(from->str1)))
-        ret = -1;
-    if (from->str2 && !(to->str2 = strdup(from->str2)))
-        ret = -1;
-    if (from->str3 && !(to->str3 = strdup(from->str3)))
-        ret = -1;
-    to->int1 = from->int1;
-    to->int2 = from->int2;
-    /*
-     * Deliberately not setting 'conn', 'dom', 'net' references
-     */
-    return ret;
-}
-
-static virErrorPtr
-virLastErrorObject(void)
-{
-    virErrorPtr err;
-    err = virThreadLocalGet(&virLastErr);
-    if (!err) {
-        if (VIR_ALLOC(err) < 0)
-            return NULL;
-        if (virThreadLocalSet(&virLastErr, err) < 0)
-            VIR_FREE(err);
-    }
-    return err;
-}
-
-
-/**
- * virGetLastError:
- *
- * Provide a pointer to the last error caught at the library level
- *
- * The error object is kept in thread local storage, so separate
- * threads can safely access this concurrently.
- *
- * Returns a pointer to the last error or NULL if none occurred.
- */
-virErrorPtr
-virGetLastError(void)
-{
-    virErrorPtr err = virLastErrorObject();
-    if (!err || err->code == VIR_ERR_OK)
-        return NULL;
-    return err;
-}
-
-/**
- * virSetError:
- * @newerr: previously saved error object
- *
- * Set the current error from a previously saved error object
- *
- * Can be used to re-set an old error, which may have been squashed by
- * other functions (like cleanup routines).
- *
- * Returns 0 on success, -1 on failure.  Leaves errno unchanged.
- */
-int
-virSetError(virErrorPtr newerr)
-{
-    virErrorPtr err;
-    int saved_errno = errno;
-    int ret = -1;
-
-    err = virLastErrorObject();
-    if (!err)
-        goto cleanup;
-
-    virResetError(err);
-    ret = virCopyError(newerr, err);
-cleanup:
-    errno = saved_errno;
-    return ret;
-}
-
-/**
- * virCopyLastError:
- * @to: target to receive the copy
- *
- * Copy the content of the last error caught at the library level
- *
- * The error object is kept in thread local storage, so separate
- * threads can safely access this concurrently.
- *
- * One will need to free the result with virResetError()
- *
- * Returns 0 if no error was found and the error code otherwise and -1 in case
- *         of parameter error.
- */
-int
-virCopyLastError(virErrorPtr to)
-{
-    virErrorPtr err = virLastErrorObject();
-    /* We can't guarantee caller has initialized it to zero */
-    memset(to, 0, sizeof(*to));
-    if (err)
-        virCopyError(err, to);
-    else
-        virResetError(to);
-    return to->code;
-}
-
-/**
- * virSaveLastError:
- *
- * Save the last error into a new error object.  On success, errno is
- * unchanged; on failure, errno is ENOMEM.
- *
- * Returns a pointer to the copied error or NULL if allocation failed.
- * It is the caller's responsibility to free the error with
- * virFreeError().
- */
-virErrorPtr
-virSaveLastError(void)
-{
-    virErrorPtr to;
-    int saved_errno = errno;
-
-    if (VIR_ALLOC(to) < 0)
-        return NULL;
-
-    virCopyLastError(to);
-    errno = saved_errno;
-    return to;
-}
-
-/**
- * virResetError:
- * @err: pointer to the virError to clean up
- *
- * Reset the error being pointed to
- */
-void
-virResetError(virErrorPtr err)
-{
-    if (err == NULL)
-        return;
-    VIR_FREE(err->message);
-    VIR_FREE(err->str1);
-    VIR_FREE(err->str2);
-    VIR_FREE(err->str3);
-    memset(err, 0, sizeof(virError));
-}
-
-/**
- * virFreeError:
- * @err: error to free
- *
- * Resets and frees the given error.
- */
-void
-virFreeError(virErrorPtr err)
-{
-    virResetError(err);
-    VIR_FREE(err);
-}
-
-/**
- * virResetLastError:
- *
- * Reset the last error caught at the library level.
- *
- * The error object is kept in thread local storage, so separate
- * threads can safely access this concurrently, only resetting
- * their own error object.
- */
-void
-virResetLastError(void)
-{
-    virErrorPtr err = virLastErrorObject();
-    if (err)
-        virResetError(err);
-}
-
-/**
- * virConnGetLastError:
- * @conn: pointer to the hypervisor connection
- *
- * Provide a pointer to the last error caught on that connection
- *
- * This method is not protected against access from multiple
- * threads. In a multi-threaded application, always use the
- * global virGetLastError() API which is backed by thread
- * local storage.
- *
- * If the connection object was discovered to be invalid by
- * an API call, then the error will be reported against the
- * global error object.
- *
- * Since 0.6.0, all errors reported in the per-connection object
- * are also duplicated in the global error object. As such an
- * application can always use virGetLastError(). This method
- * remains for backwards compatibility.
- *
- * Returns a pointer to the last error or NULL if none occurred.
- */
-virErrorPtr
-virConnGetLastError(virConnectPtr conn)
-{
-    if (conn == NULL)
-        return NULL;
-    return &conn->err;
-}
-
-/**
- * virConnCopyLastError:
- * @conn: pointer to the hypervisor connection
- * @to: target to receive the copy
- *
- * Copy the content of the last error caught on that connection
- *
- * This method is not protected against access from multiple
- * threads. In a multi-threaded application, always use the
- * global virGetLastError() API which is backed by thread
- * local storage.
- *
- * If the connection object was discovered to be invalid by
- * an API call, then the error will be reported against the
- * global error object.
- *
- * Since 0.6.0, all errors reported in the per-connection object
- * are also duplicated in the global error object. As such an
- * application can always use virGetLastError(). This method
- * remains for backwards compatibility.
- *
- * One will need to free the result with virResetError()
- *
- * Returns 0 if no error was found and the error code otherwise and -1 in case
- *         of parameter error.
- */
-int
-virConnCopyLastError(virConnectPtr conn, virErrorPtr to)
-{
-    /* We can't guarantee caller has initialized it to zero */
-    memset(to, 0, sizeof(*to));
-
-    if (conn == NULL)
-        return -1;
-    virMutexLock(&conn->lock);
-    if (conn->err.code == VIR_ERR_OK)
-        virResetError(to);
-    else
-        virCopyError(&conn->err, to);
-    virMutexUnlock(&conn->lock);
-    return to->code;
-}
-
-/**
- * virConnResetLastError:
- * @conn: pointer to the hypervisor connection
- *
- * The error object is kept in thread local storage, so separate
- * threads can safely access this concurrently.
- *
- * Reset the last error caught on that connection
- */
-void
-virConnResetLastError(virConnectPtr conn)
-{
-    if (conn == NULL)
-        return;
-    virMutexLock(&conn->lock);
-    virResetError(&conn->err);
-    virMutexUnlock(&conn->lock);
-}
-
-/**
- * virSetErrorFunc:
- * @userData: pointer to the user data provided in the handler callback
- * @handler: the function to get called in case of error or NULL
- *
- * Set a library global error handling function, if @handler is NULL,
- * it will reset to default printing on stderr. The error raised there
- * are those for which no handler at the connection level could caught.
- */
-void
-virSetErrorFunc(void *userData, virErrorFunc handler)
-{
-    virErrorHandler = handler;
-    virUserData = userData;
-}
-
-/**
- * virConnSetErrorFunc:
- * @conn: pointer to the hypervisor connection
- * @userData: pointer to the user data provided in the handler callback
- * @handler: the function to get called in case of error or NULL
- *
- * Set a connection error handling function, if @handler is NULL
- * it will reset to default which is to pass error back to the global
- * library handler.
- */
-void
-virConnSetErrorFunc(virConnectPtr conn, void *userData,
-                    virErrorFunc handler)
-{
-    if (conn == NULL)
-        return;
-    virMutexLock(&conn->lock);
-    conn->handler = handler;
-    conn->userData = userData;
-    virMutexUnlock(&conn->lock);
-}
-
-/**
- * virDefaultErrorFunc:
- * @err: pointer to the error.
- *
- * Default routine reporting an error to stderr.
- */
-void
-virDefaultErrorFunc(virErrorPtr err)
-{
-    const char *lvl = "", *dom = "", *domain = "", *network = "";
-    int len;
-
-    if ((err == NULL) || (err->code == VIR_ERR_OK))
-        return;
-    switch (err->level) {
-        case VIR_ERR_NONE:
-            lvl = "";
-            break;
-        case VIR_ERR_WARNING:
-            lvl = _("warning");
-            break;
-        case VIR_ERR_ERROR:
-            lvl = _("error");
-            break;
-    }
-    dom = virErrorDomainTypeToString(err->domain);
-    if (!dom)
-        dom = "Unknown";
-    if ((err->dom != NULL) && (err->code != VIR_ERR_INVALID_DOMAIN)) {
-        domain = err->dom->name;
-    } else if ((err->net != NULL) && (err->code != VIR_ERR_INVALID_NETWORK)) {
-        network = err->net->name;
-    }
-    len = strlen(err->message);
-    if ((err->domain == VIR_FROM_XML) && (err->code == VIR_ERR_XML_DETAIL) &&
-        (err->int1 != 0))
-        fprintf(stderr, "libvir: %s %s %s%s: line %d: %s",
-                dom, lvl, domain, network, err->int1, err->message);
-    else if ((len == 0) || (err->message[len - 1] != '\n'))
-        fprintf(stderr, "libvir: %s %s %s%s: %s\n",
-                dom, lvl, domain, network, err->message);
-    else
-        fprintf(stderr, "libvir: %s %s %s%s: %s",
-                dom, lvl, domain, network, err->message);
-}
-
-/**
- * virDispatchError:
- * @conn: pointer to the hypervisor connection
- *
- * Internal helper to do final stage of error
- * reporting in public APIs.
- *
- *  - Copy the global error to per-connection error if needed
- *  - Set a generic error message if none is already set
- *  - Invoke the error callback functions
- */
-void
-virDispatchError(virConnectPtr conn)
-{
-    virErrorPtr err = virLastErrorObject();
-    virErrorFunc handler = virErrorHandler;
-    void *userData = virUserData;
-
-    /* Can only happen on OOM.  */
-    if (!err)
-        return;
-
-    /* Set a generic error message if none is already set */
-    if (err->code == VIR_ERR_OK)
-        virErrorGenericFailure(err);
-
-    /* Copy the global error to per-connection error if needed */
-    if (conn) {
-        virMutexLock(&conn->lock);
-        virCopyError(err, &conn->err);
-
-        if (conn->handler != NULL) {
-            handler = conn->handler;
-            userData = conn->userData;
-        }
-        virMutexUnlock(&conn->lock);
-    }
-
-    /* Invoke the error callback functions */
-    if (handler != NULL) {
-        (handler)(userData, err);
-    } else {
-        virDefaultErrorFunc(err);
-    }
-}
-
-
-
-/**
- * virRaiseErrorFull:
- * @filename: filename where error was raised
- * @funcname: function name where error was raised
- * @linenr: line number where error was raised
- * @domain: the virErrorDomain indicating where it's coming from
- * @code: the virErrorNumber code for the error
- * @level: the virErrorLevel for the error
- * @str1: extra string info
- * @str2: extra string info
- * @str3: extra string info
- * @int1: extra int info
- * @int2: extra int info
- * @fmt:  the message to display/transmit
- * @...:  extra parameters for the message display
- *
- * Internal routine called when an error is detected. It will raise it
- * immediately if a callback is found and store it for later handling.
- */
-void
-virRaiseErrorFull(const char *filename ATTRIBUTE_UNUSED,
-                  const char *funcname,
-                  size_t linenr,
-                  int domain,
-                  int code,
-                  virErrorLevel level,
-                  const char *str1,
-                  const char *str2,
-                  const char *str3,
-                  int int1,
-                  int int2,
-                  const char *fmt, ...)
-{
-    int save_errno = errno;
-    virErrorPtr to;
-    char *str;
-    int priority;
-
-    /*
-     * All errors are recorded in thread local storage
-     * For compatibility, public API calls will copy them
-     * to the per-connection error object when necessary
-     */
-    to = virLastErrorObject();
-    if (!to) {
-        errno = save_errno;
-        return; /* Hit OOM allocating thread error object, sod all we can do now */
-    }
-
-    virResetError(to);
-
-    if (code == VIR_ERR_OK) {
-        errno = save_errno;
-        return;
-    }
-
-    /*
-     * formats the message; drop message on OOM situations
-     */
-    if (fmt == NULL) {
-        str = strdup(_("No error message provided"));
-    } else {
-        va_list ap;
-        va_start(ap, fmt);
-        virVasprintf(&str, fmt, ap);
-        va_end(ap);
-    }
-
-    /*
-     * Save the information about the error
-     */
-    /*
-     * Deliberately not setting conn, dom & net fields since
-     * they're utterly unsafe
-     */
-    to->domain = domain;
-    to->code = code;
-    to->message = str;
-    to->level = level;
-    if (str1 != NULL)
-        to->str1 = strdup(str1);
-    if (str2 != NULL)
-        to->str2 = strdup(str2);
-    if (str3 != NULL)
-        to->str3 = strdup(str3);
-    to->int1 = int1;
-    to->int2 = int2;
-
-    /*
-     * Hook up the error or warning to the logging facility
-     */
-    priority = virErrorLevelPriority(level);
-    if (virErrorLogPriorityFilter)
-        priority = virErrorLogPriorityFilter(to, priority);
-    virLogMessage(virErrorLogPriorityFilter ? VIR_LOG_FROM_FILE : VIR_LOG_FROM_ERROR,
-                  priority,
-                  filename, linenr, funcname,
-                  NULL, "%s", str);
-
-    errno = save_errno;
-}
-
-/**
- * virErrorMsg:
- * @error: the virErrorNumber
- * @info: usually the first parameter string
- *
- * Internal routine to get the message associated to an error raised
- * from the library
- *
- * Returns the constant string associated to @error
- */
-static const char *
-virErrorMsg(virErrorNumber error, const char *info)
-{
-    const char *errmsg = NULL;
-
-    switch (error) {
-        case VIR_ERR_OK:
-            return NULL;
-        case VIR_ERR_INTERNAL_ERROR:
-            if (info != NULL)
-              errmsg = _("internal error %s");
-            else
-              errmsg = _("internal error");
-            break;
-        case VIR_ERR_NO_MEMORY:
-            errmsg = _("out of memory");
-            break;
-        case VIR_ERR_NO_SUPPORT:
-            if (info == NULL)
-                errmsg = _("this function is not supported by the connection driver");
-            else
-                errmsg = _("this function is not supported by the connection driver: %s");
-            break;
-        case VIR_ERR_NO_CONNECT:
-            if (info == NULL)
-                errmsg = _("no connection driver available");
-            else
-                errmsg = _("no connection driver available for %s");
-            break;
-        case VIR_ERR_INVALID_CONN:
-            if (info == NULL)
-                errmsg = _("invalid connection pointer in");
-            else
-                errmsg = _("invalid connection pointer in %s");
-            break;
-        case VIR_ERR_INVALID_DOMAIN:
-            if (info == NULL)
-                errmsg = _("invalid domain pointer in");
-            else
-                errmsg = _("invalid domain pointer in %s");
-            break;
-        case VIR_ERR_INVALID_ARG:
-            if (info == NULL)
-                errmsg = _("invalid argument");
-            else
-                errmsg = _("invalid argument: %s");
-            break;
-        case VIR_ERR_OPERATION_FAILED:
-            if (info != NULL)
-                errmsg = _("operation failed: %s");
-            else
-                errmsg = _("operation failed");
-            break;
-        case VIR_ERR_GET_FAILED:
-            if (info != NULL)
-                errmsg = _("GET operation failed: %s");
-            else
-                errmsg = _("GET operation failed");
-            break;
-        case VIR_ERR_POST_FAILED:
-            if (info != NULL)
-                errmsg = _("POST operation failed: %s");
-            else
-                errmsg = _("POST operation failed");
-            break;
-        case VIR_ERR_HTTP_ERROR:
-            errmsg = _("got unknown HTTP error code %d");
-            break;
-        case VIR_ERR_UNKNOWN_HOST:
-            if (info != NULL)
-                errmsg = _("unknown host %s");
-            else
-                errmsg = _("unknown host");
-            break;
-        case VIR_ERR_SEXPR_SERIAL:
-            if (info != NULL)
-                errmsg = _("failed to serialize S-Expr: %s");
-            else
-                errmsg = _("failed to serialize S-Expr");
-            break;
-        case VIR_ERR_NO_XEN:
-            if (info == NULL)
-                errmsg = _("could not use Xen hypervisor entry");
-            else
-                errmsg = _("could not use Xen hypervisor entry %s");
-            break;
-        case VIR_ERR_NO_XENSTORE:
-            if (info == NULL)
-                errmsg = _("could not connect to Xen Store");
-            else
-                errmsg = _("could not connect to Xen Store %s");
-            break;
-        case VIR_ERR_XEN_CALL:
-            errmsg = _("failed Xen syscall %s");
-            break;
-        case VIR_ERR_OS_TYPE:
-            if (info == NULL)
-                errmsg = _("unknown OS type");
-            else
-                errmsg = _("unknown OS type %s");
-            break;
-        case VIR_ERR_NO_KERNEL:
-            errmsg = _("missing kernel information");
-            break;
-        case VIR_ERR_NO_ROOT:
-            if (info == NULL)
-                errmsg = _("missing root device information");
-            else
-                errmsg = _("missing root device information in %s");
-            break;
-        case VIR_ERR_NO_SOURCE:
-            if (info == NULL)
-                errmsg = _("missing source information for device");
-            else
-                errmsg = _("missing source information for device %s");
-            break;
-        case VIR_ERR_NO_TARGET:
-            if (info == NULL)
-                errmsg = _("missing target information for device");
-            else
-                errmsg = _("missing target information for device %s");
-            break;
-        case VIR_ERR_NO_NAME:
-            if (info == NULL)
-                errmsg = _("missing name information");
-            else
-                errmsg = _("missing name information in %s");
-            break;
-        case VIR_ERR_NO_OS:
-            if (info == NULL)
-                errmsg = _("missing operating system information");
-            else
-                errmsg = _("missing operating system information for %s");
-            break;
-        case VIR_ERR_NO_DEVICE:
-            if (info == NULL)
-                errmsg = _("missing devices information");
-            else
-                errmsg = _("missing devices information for %s");
-            break;
-        case VIR_ERR_DRIVER_FULL:
-            if (info == NULL)
-                errmsg = _("too many drivers registered");
-            else
-                errmsg = _("too many drivers registered in %s");
-            break;
-        case VIR_ERR_CALL_FAILED: /* DEPRECATED, use VIR_ERR_NO_SUPPORT */
-            if (info == NULL)
-                errmsg = _("library call failed, possibly not supported");
-            else
-                errmsg = _("library call %s failed, possibly not supported");
-            break;
-        case VIR_ERR_XML_ERROR:
-            if (info == NULL)
-                errmsg = _("XML description is invalid or not well formed");
-            else
-                errmsg = _("XML error: %s");
-            break;
-        case VIR_ERR_DOM_EXIST:
-            if (info == NULL)
-                errmsg = _("this domain exists already");
-            else
-                errmsg = _("domain %s exists already");
-            break;
-        case VIR_ERR_OPERATION_DENIED:
-            if (info == NULL)
-                errmsg = _("operation forbidden for read only access");
-            else
-                errmsg = _("operation %s forbidden for read only access");
-            break;
-        case VIR_ERR_OPEN_FAILED:
-            if (info == NULL)
-                errmsg = _("failed to open configuration file for reading");
-            else
-                errmsg = _("failed to open %s for reading");
-            break;
-        case VIR_ERR_READ_FAILED:
-            if (info == NULL)
-                errmsg = _("failed to read configuration file");
-            else
-                errmsg = _("failed to read configuration file %s");
-            break;
-        case VIR_ERR_PARSE_FAILED:
-            if (info == NULL)
-                errmsg = _("failed to parse configuration file");
-            else
-                errmsg = _("failed to parse configuration file %s");
-            break;
-        case VIR_ERR_CONF_SYNTAX:
-            if (info == NULL)
-                errmsg = _("configuration file syntax error");
-            else
-                errmsg = _("configuration file syntax error: %s");
-            break;
-        case VIR_ERR_WRITE_FAILED:
-            if (info == NULL)
-                errmsg = _("failed to write configuration file");
-            else
-                errmsg = _("failed to write configuration file: %s");
-            break;
-        case VIR_ERR_XML_DETAIL:
-            if (info == NULL)
-                errmsg = _("parser error");
-            else
-                errmsg = "%s";
-            break;
-        case VIR_ERR_INVALID_NETWORK:
-            if (info == NULL)
-                errmsg = _("invalid network pointer in");
-            else
-                errmsg = _("invalid network pointer in %s");
-            break;
-        case VIR_ERR_NETWORK_EXIST:
-            if (info == NULL)
-                errmsg = _("this network exists already");
-            else
-                errmsg = _("network %s exists already");
-            break;
-        case VIR_ERR_SYSTEM_ERROR:
-            if (info == NULL)
-                errmsg = _("system call error");
-            else
-                errmsg = "%s";
-            break;
-        case VIR_ERR_RPC:
-            if (info == NULL)
-                errmsg = _("RPC error");
-            else
-                errmsg = "%s";
-            break;
-        case VIR_ERR_GNUTLS_ERROR:
-            if (info == NULL)
-                errmsg = _("GNUTLS call error");
-            else
-                errmsg = "%s";
-            break;
-        case VIR_WAR_NO_NETWORK:
-            if (info == NULL)
-                errmsg = _("Failed to find the network");
-            else
-                errmsg = _("Failed to find the network: %s");
-            break;
-        case VIR_ERR_NO_DOMAIN:
-            if (info == NULL)
-                errmsg = _("Domain not found");
-            else
-                errmsg = _("Domain not found: %s");
-            break;
-        case VIR_ERR_NO_NETWORK:
-            if (info == NULL)
-                errmsg = _("Network not found");
-            else
-                errmsg = _("Network not found: %s");
-            break;
-        case VIR_ERR_INVALID_MAC:
-            if (info == NULL)
-                errmsg = _("invalid MAC address");
-            else
-                errmsg = _("invalid MAC address: %s");
-            break;
-        case VIR_ERR_AUTH_FAILED:
-            if (info == NULL)
-                errmsg = _("authentication failed");
-            else
-                errmsg = _("authentication failed: %s");
-            break;
-        case VIR_ERR_AUTH_CANCELLED:
-            if (info == NULL)
-                errmsg = _("authentication cancelled");
-            else
-                errmsg = _("authentication cancelled: %s");
-            break;
-        case VIR_ERR_NO_STORAGE_POOL:
-            if (info == NULL)
-                errmsg = _("Storage pool not found");
-            else
-                errmsg = _("Storage pool not found: %s");
-            break;
-        case VIR_ERR_NO_STORAGE_VOL:
-            if (info == NULL)
-                errmsg = _("Storage volume not found");
-            else
-                errmsg = _("Storage volume not found: %s");
-            break;
-        case VIR_ERR_STORAGE_PROBE_FAILED:
-            if (info == NULL)
-                errmsg = _("Storage pool probe failed");
-            else
-                errmsg = _("Storage pool probe failed: %s");
-            break;
-        case VIR_ERR_STORAGE_POOL_BUILT:
-            if (info == NULL)
-                errmsg = _("Storage pool already built");
-            else
-                errmsg = _("Storage pool already built: %s");
-            break;
-        case VIR_ERR_INVALID_STORAGE_POOL:
-            if (info == NULL)
-                errmsg = _("invalid storage pool pointer in");
-            else
-                errmsg = _("invalid storage pool pointer in %s");
-            break;
-        case VIR_ERR_INVALID_STORAGE_VOL:
-            if (info == NULL)
-                errmsg = _("invalid storage volume pointer in");
-            else
-                errmsg = _("invalid storage volume pointer in %s");
-            break;
-        case VIR_WAR_NO_STORAGE:
-            if (info == NULL)
-                errmsg = _("Failed to find a storage driver");
-            else
-                errmsg = _("Failed to find a storage driver: %s");
-            break;
-        case VIR_WAR_NO_NODE:
-            if (info == NULL)
-                errmsg = _("Failed to find a node driver");
-            else
-                errmsg = _("Failed to find a node driver: %s");
-            break;
-        case VIR_ERR_INVALID_NODE_DEVICE:
-            if (info == NULL)
-                errmsg = _("invalid node device pointer");
-            else
-                errmsg = _("invalid node device pointer in %s");
-            break;
-        case VIR_ERR_NO_NODE_DEVICE:
-            if (info == NULL)
-                errmsg = _("Node device not found");
-            else
-                errmsg = _("Node device not found: %s");
-            break;
-        case VIR_ERR_NO_SECURITY_MODEL:
-            if (info == NULL)
-                errmsg = _("Security model not found");
-            else
-                errmsg = _("Security model not found: %s");
-            break;
-        case VIR_ERR_OPERATION_INVALID:
-            if (info == NULL)
-                errmsg = _("Requested operation is not valid");
-            else
-                errmsg = _("Requested operation is not valid: %s");
-            break;
-        case VIR_WAR_NO_INTERFACE:
-            if (info == NULL)
-                errmsg = _("Failed to find the interface");
-            else
-                errmsg = _("Failed to find the interface: %s");
-            break;
-        case VIR_ERR_NO_INTERFACE:
-            if (info == NULL)
-                errmsg = _("Interface not found");
-            else
-                errmsg = _("Interface not found: %s");
-            break;
-        case VIR_ERR_INVALID_INTERFACE:
-            if (info == NULL)
-                errmsg = _("invalid interface pointer in");
-            else
-                errmsg = _("invalid interface pointer in %s");
-            break;
-        case VIR_ERR_MULTIPLE_INTERFACES:
-            if (info == NULL)
-                errmsg = _("multiple matching interfaces found");
-            else
-                errmsg = _("multiple matching interfaces found: %s");
-            break;
-        case VIR_WAR_NO_SECRET:
-            if (info == NULL)
-                errmsg = _("Failed to find a secret storage driver");
-            else
-                errmsg = _("Failed to find a secret storage driver: %s");
-            break;
-        case VIR_ERR_INVALID_SECRET:
-            if (info == NULL)
-                errmsg = _("Invalid secret");
-            else
-                errmsg = _("Invalid secret: %s");
-            break;
-        case VIR_ERR_NO_SECRET:
-            if (info == NULL)
-                errmsg = _("Secret not found");
-            else
-                errmsg = _("Secret not found: %s");
-            break;
-        case VIR_WAR_NO_NWFILTER:
-            if (info == NULL)
-                errmsg = _("Failed to start the nwfilter driver");
-            else
-                errmsg = _("Failed to start the nwfilter driver: %s");
-            break;
-        case VIR_ERR_INVALID_NWFILTER:
-            if (info == NULL)
-                errmsg = _("Invalid network filter");
-            else
-                errmsg = _("Invalid network filter: %s");
-            break;
-        case VIR_ERR_NO_NWFILTER:
-            if (info == NULL)
-                errmsg = _("Network filter not found");
-            else
-                errmsg = _("Network filter not found: %s");
-            break;
-        case VIR_ERR_BUILD_FIREWALL:
-            if (info == NULL)
-                errmsg = _("Error while building firewall");
-            else
-                errmsg = _("Error while building firewall: %s");
-            break;
-        case VIR_ERR_CONFIG_UNSUPPORTED:
-            if (info == NULL)
-                errmsg = _("unsupported configuration");
-            else
-                errmsg = _("unsupported configuration: %s");
-            break;
-        case VIR_ERR_OPERATION_TIMEOUT:
-            if (info == NULL)
-                errmsg = _("Timed out during operation");
-            else
-                errmsg = _("Timed out during operation: %s");
-            break;
-        case VIR_ERR_MIGRATE_PERSIST_FAILED:
-            if (info == NULL)
-                errmsg = _("Failed to make domain persistent after migration");
-            else
-                errmsg = _("Failed to make domain persistent after migration: %s");
-            break;
-        case VIR_ERR_HOOK_SCRIPT_FAILED:
-            if (info == NULL)
-                errmsg = _("Hook script execution failed");
-            else
-                errmsg = _("Hook script execution failed: %s");
-            break;
-        case VIR_ERR_INVALID_DOMAIN_SNAPSHOT:
-            if (info == NULL)
-                errmsg = _("Invalid snapshot");
-            else
-                errmsg = _("Invalid snapshot: %s");
-            break;
-        case VIR_ERR_NO_DOMAIN_SNAPSHOT:
-            if (info == NULL)
-                errmsg = _("Domain snapshot not found");
-            else
-                errmsg = _("Domain snapshot not found: %s");
-            break;
-        case VIR_ERR_INVALID_STREAM:
-            if (info == NULL)
-                errmsg = _("invalid stream pointer");
-            else
-                errmsg = _("invalid stream pointer in %s");
-            break;
-        case VIR_ERR_ARGUMENT_UNSUPPORTED:
-            if (info == NULL)
-                errmsg = _("argument unsupported");
-            else
-                errmsg = _("argument unsupported: %s");
-            break;
-        case VIR_ERR_SNAPSHOT_REVERT_RISKY:
-            if (info == NULL)
-                errmsg = _("revert requires force");
-            else
-                errmsg = _("revert requires force: %s");
-            break;
-        case VIR_ERR_OPERATION_ABORTED:
-            if (info == NULL)
-                errmsg = _("operation aborted");
-            else
-                errmsg = _("operation aborted: %s");
-            break;
-        case VIR_ERR_NO_DOMAIN_METADATA:
-            if (info == NULL)
-                errmsg = _("metadata not found");
-            else
-                errmsg = _("metadata not found: %s");
-            break;
-        case VIR_ERR_MIGRATE_UNSAFE:
-            if (!info)
-                errmsg = _("Unsafe migration");
-            else
-                errmsg = _("Unsafe migration: %s");
-            break;
-        case VIR_ERR_OVERFLOW:
-            if (!info)
-                errmsg = _("numerical overflow");
-            else
-                errmsg = _("numerical overflow: %s");
-            break;
-        case VIR_ERR_BLOCK_COPY_ACTIVE:
-            if (!info)
-                errmsg = _("block copy still active");
-            else
-                errmsg = _("block copy still active: %s");
-            break;
-        case VIR_ERR_OPERATION_UNSUPPORTED:
-            if (!info)
-                errmsg = _("Operation not supported");
-            else
-                errmsg = _("Operation not supported: %s");
-            break;
-        case VIR_ERR_SSH:
-            if (info == NULL)
-                errmsg = _("SSH transport error");
-            else
-                errmsg = _("SSH transport error: %s");
-            break;
-        case VIR_ERR_AGENT_UNRESPONSIVE:
-            if (info == NULL)
-                errmsg = _("Guest agent is not responding");
-            else
-                errmsg = _("Guest agent is not responding: %s");
-            break;
-        case VIR_ERR_RESOURCE_BUSY:
-            if (info == NULL)
-                errmsg = _("resource busy");
-            else
-                errmsg = _("resource busy %s");
-            break;
-    }
-    return errmsg;
-}
-
-/**
- * virReportErrorHelper:
- *
- * @domcode: the virErrorDomain indicating where it's coming from
- * @errorcode: the virErrorNumber code for the error
- * @filename: Source file error is dispatched from
- * @funcname: Function error is dispatched from
- * @linenr: Line number error is dispatched from
- * @fmt:  the format string
- * @...:  extra parameters for the message display
- *
- * Helper function to do most of the grunt work for individual driver
- * ReportError
- */
-void virReportErrorHelper(int domcode,
-                          int errorcode,
-                          const char *filename,
-                          const char *funcname,
-                          size_t linenr,
-                          const char *fmt, ...)
-{
-    int save_errno = errno;
-    va_list args;
-    char errorMessage[1024];
-    const char *virerr;
-
-    if (fmt) {
-        va_start(args, fmt);
-        vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args);
-        va_end(args);
-    } else {
-        errorMessage[0] = '\0';
-    }
-
-    virerr = virErrorMsg(errorcode, (errorMessage[0] ? errorMessage : NULL));
-    virRaiseErrorFull(filename, funcname, linenr,
-                      domcode, errorcode, VIR_ERR_ERROR,
-                      virerr, errorMessage, NULL,
-                      -1, -1, virerr, errorMessage);
-    errno = save_errno;
-}
-
-/**
- * virStrerror:
- * @theerrno: the errno value
- * @errBuf: the buffer to save the error to
- * @errBufLen: the buffer length
- *
- * Generate an error string for the given errno
- *
- * Returns a pointer to the error string, possibly indicating that the
- *         error is unknown
- */
-const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen)
-{
-    int save_errno = errno;
-    const char *ret;
-
-    strerror_r(theerrno, errBuf, errBufLen);
-    ret = errBuf;
-    errno = save_errno;
-    return ret;
-}
-
-/**
- * virReportSystemErrorFull:
- * @domcode: the virErrorDomain indicating where it's coming from
- * @theerrno: an errno number
- * @filename: filename where error was raised
- * @funcname: function name where error was raised
- * @linenr: line number where error was raised
- * @fmt:  the message to display/transmit
- * @...:  extra parameters for the message display
- *
- * Convenience internal routine called when a system error is detected.
- */
-void virReportSystemErrorFull(int domcode,
-                              int theerrno,
-                              const char *filename,
-                              const char *funcname,
-                              size_t linenr,
-                              const char *fmt, ...)
-{
-    int save_errno = errno;
-    char strerror_buf[1024];
-    char msgDetailBuf[1024];
-
-    const char *errnoDetail = virStrerror(theerrno, strerror_buf,
-                                          sizeof(strerror_buf));
-    const char *msg = virErrorMsg(VIR_ERR_SYSTEM_ERROR, fmt);
-    const char *msgDetail = NULL;
-
-    if (fmt) {
-        va_list args;
-        int n;
-
-        va_start(args, fmt);
-        n = vsnprintf(msgDetailBuf, sizeof(msgDetailBuf), fmt, args);
-        va_end(args);
-
-        size_t len = strlen(errnoDetail);
-        if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
-          char *p = msgDetailBuf + n;
-          stpcpy(stpcpy(p, ": "), errnoDetail);
-          msgDetail = msgDetailBuf;
-        }
-    }
-
-    if (!msgDetail)
-        msgDetail = errnoDetail;
-
-    virRaiseErrorFull(filename, funcname, linenr,
-                      domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR,
-                      msg, msgDetail, NULL, theerrno, -1, msg, msgDetail);
-    errno = save_errno;
-}
-
-/**
- * virReportOOMErrorFull:
- * @domcode: the virErrorDomain indicating where it's coming from
- * @filename: filename where error was raised
- * @funcname: function name where error was raised
- * @linenr: line number where error was raised
- *
- * Convenience internal routine called when an out of memory error is
- * detected
- */
-void virReportOOMErrorFull(int domcode,
-                           const char *filename,
-                           const char *funcname,
-                           size_t linenr)
-{
-    const char *virerr;
-
-    virerr = virErrorMsg(VIR_ERR_NO_MEMORY, NULL);
-    virRaiseErrorFull(filename, funcname, linenr,
-                      domcode, VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
-                      virerr, NULL, NULL, -1, -1, virerr, NULL);
-}
-
-/**
- * virSetErrorLogPriorityFunc:
- * @func: function to install
- *
- * Install a function used to filter error logging based on error priority.
- */
-void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func)
-{
-    virErrorLogPriorityFilter = func;
-}
diff --git a/src/util/virterror_internal.h b/src/util/virterror_internal.h
deleted file mode 100644
index 961c423..0000000
--- a/src/util/virterror_internal.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * virterror.h: internal error handling
- *
- * Copyright (C) 2006-2009, 2011 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef __VIRT_ERROR_H_
-# define __VIRT_ERROR_H_
-
-# include "internal.h"
-
-extern virErrorFunc virErrorHandler;
-extern void *virUserData;
-
-/************************************************************************
- *									*
- *		API for error handling					*
- *									*
- ************************************************************************/
-int virErrorInitialize(void);
-void virRaiseErrorFull(const char *filename,
-                       const char *funcname,
-                       size_t linenr,
-                       int domain,
-                       int code,
-                       virErrorLevel level,
-                       const char *str1,
-                       const char *str2,
-                       const char *str3,
-                       int int1,
-                       int int2,
-                       const char *fmt, ...)
-    ATTRIBUTE_FMT_PRINTF(12, 13);
-
-void virReportErrorHelper(int domcode, int errcode,
-                          const char *filename,
-                          const char *funcname,
-                          size_t linenr,
-                          const char *fmt, ...)
-  ATTRIBUTE_FMT_PRINTF(6, 7);
-
-void virReportSystemErrorFull(int domcode,
-                              int theerrno,
-                              const char *filename,
-                              const char *funcname,
-                              size_t linenr,
-                              const char *fmt, ...)
-    ATTRIBUTE_FMT_PRINTF(6, 7);
-
-# define virReportSystemError(theerrno, fmt,...)                   \
-    virReportSystemErrorFull(VIR_FROM_THIS,                       \
-                             (theerrno),                          \
-                             __FILE__, __FUNCTION__, __LINE__,    \
-                             (fmt), __VA_ARGS__)
-
-# define virReportInvalidNullArg(argname)                            \
-    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
-                      VIR_FROM_THIS,                                 \
-                      VIR_ERR_INVALID_ARG,                           \
-                      VIR_ERR_ERROR,                                 \
-                      __FUNCTION__,                                  \
-                      #argname,                                      \
-                      NULL,                                          \
-                      0, 0,                                          \
-                      _("%s in %s must be NULL"),                    \
-                      #argname, __FUNCTION__)
-# define virReportInvalidNonNullArg(argname)                         \
-    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
-                      VIR_FROM_THIS,                                 \
-                      VIR_ERR_INVALID_ARG,                           \
-                      VIR_ERR_ERROR,                                 \
-                      __FUNCTION__,                                  \
-                      #argname,                                      \
-                      NULL,                                          \
-                      0, 0,                                          \
-                      _("%s in %s must not be NULL"),                \
-                      #argname, __FUNCTION__)
-# define virReportInvalidPositiveArg(argname)                        \
-    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
-                      VIR_FROM_THIS,                                 \
-                      VIR_ERR_INVALID_ARG,                           \
-                      VIR_ERR_ERROR,                                 \
-                      __FUNCTION__,                                  \
-                      #argname,                                      \
-                      NULL,                                          \
-                      0, 0,                                          \
-                      _("%s in %s must greater than zero"),          \
-                      #argname, __FUNCTION__)
-# define virReportInvalidNonZeroArg(argname)                         \
-    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
-                      VIR_FROM_THIS,                                 \
-                      VIR_ERR_INVALID_ARG,                           \
-                      VIR_ERR_ERROR,                                 \
-                      __FUNCTION__,                                  \
-                      #argname,                                      \
-                      NULL,                                          \
-                      0, 0,                                          \
-                      _("%s in %s must not be zero"),                \
-                      #argname, __FUNCTION__)
-# define virReportInvalidZeroArg(argname)                            \
-    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
-                      VIR_FROM_THIS,                                 \
-                      VIR_ERR_INVALID_ARG,                           \
-                      VIR_ERR_ERROR,                                 \
-                      __FUNCTION__,                                  \
-                      #argname,                                      \
-                      NULL,                                          \
-                      0, 0,                                          \
-                      _("%s in %s must  be zero"),                   \
-                      #argname, __FUNCTION__)
-# define virReportInvalidNonNegativeArg(argname)                     \
-    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
-                      VIR_FROM_THIS,                                 \
-                      VIR_ERR_INVALID_ARG,                           \
-                      VIR_ERR_ERROR,                                 \
-                      __FUNCTION__,                                  \
-                      #argname,                                      \
-                      NULL,                                          \
-                      0, 0,                                          \
-                      _("%s in %s must be zero or greater"),         \
-                      #argname, __FUNCTION__)
-# define virReportInvalidArg(argname, fmt, ...)                      \
-    virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__,              \
-                      VIR_FROM_THIS,                                 \
-                      VIR_ERR_INVALID_ARG,                           \
-                      VIR_ERR_ERROR,                                 \
-                      __FUNCTION__,                                  \
-                      #argname,                                      \
-                      NULL,                                          \
-                      0, 0,                                          \
-                      (fmt), __VA_ARGS__)
-
-void virReportOOMErrorFull(int domcode,
-                           const char *filename,
-                           const char *funcname,
-                           size_t linenr);
-
-# define virReportOOMError() \
-    virReportOOMErrorFull(VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
-
-# define virReportError(code, ...)                                   \
-    virReportErrorHelper(VIR_FROM_THIS, code, __FILE__,              \
-                         __FUNCTION__, __LINE__, __VA_ARGS__)
-
-int virSetError(virErrorPtr newerr);
-void virDispatchError(virConnectPtr conn);
-const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
-
-typedef int (*virErrorLogPriorityFunc)(virErrorPtr, int);
-void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func);
-
-#endif
diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index 307cefb..12a43e1 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -28,7 +28,7 @@
 #include "virthreadpool.h"
 #include "viralloc.h"
 #include "virthread.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virtime.c b/src/util/virtime.c
index c614380..b54a4e8 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -39,7 +39,7 @@
 #include "virtime.h"
 #include "virutil.h"
 #include "viralloc.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index 60fb485..33e6a09 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -26,7 +26,7 @@
 
 #include "viralloc.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/viruri.c b/src/util/viruri.c
index e59cd5a..2888cb0 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -24,7 +24,7 @@
 
 #include "viralloc.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virbuffer.h"
 
 #define VIR_FROM_THIS VIR_FROM_URI
diff --git a/src/util/virusb.c b/src/util/virusb.c
index c053c44..26bd017 100644
--- a/src/util/virusb.c
+++ b/src/util/virusb.c
@@ -35,7 +35,7 @@
 #include "virlog.h"
 #include "viralloc.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define USB_SYSFS "/sys/bus/usb"
 #define USB_DEVFS "/dev/bus/usb/"
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 9fb1c6f..a2ad725 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -75,7 +75,7 @@
 
 #include "c-ctype.h"
 #include "dirname.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virbuffer.h"
 #include "virutil.h"
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index f4eb331..373c362 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -36,7 +36,7 @@
 #include "c-ctype.h"
 #include "internal.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "viralloc.h"
 #include "virfile.h"
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 02f7d1a..8f19054 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -30,7 +30,7 @@
 #include <math.h>               /* for isnan() */
 #include <sys/stat.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virxml.h"
 #include "virbuffer.h"
 #include "virutil.h"
diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index 36539f6..b5fb821 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -33,7 +33,7 @@
 #include "viralloc.h"
 #include "virutil.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "vbox_MSCOMGlue.h"
 
 #define VIR_FROM_THIS VIR_FROM_VBOX
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 1954ddb..2b568e2 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -40,7 +40,7 @@
 #include "viralloc.h"
 #include "virutil.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_VBOX
 
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index f2a0c8f..736c895 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -37,7 +37,7 @@
 #include "virlog.h"
 #include "vbox_driver.h"
 #include "vbox_glue.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_VBOX
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 5cac7bb..abcf90e 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -45,7 +45,7 @@
 #include "domain_conf.h"
 #include "snapshot_conf.h"
 #include "network_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "domain_event.h"
 #include "storage_conf.h"
 #include "virstoragefile.h"
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 22a085d..8187185 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -31,7 +31,7 @@
 #include "nodeinfo.h"
 #include "virfile.h"
 #include "viruuid.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "vmx.h"
 
 #include "vmware_conf.h"
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 67cdc88..3763f40 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -24,7 +24,7 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virfile.h"
 #include "viralloc.h"
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index d57a14f..cc1344c 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -26,7 +26,7 @@
 #include <c-ctype.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virconf.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 3f7c97b..9f5823c 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -38,7 +38,7 @@
 #  include <xs.h>
 # endif
 
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "datatypes.h"
 # include "virutil.h"
 # include "block_stats.h"
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index c35695a..2ef2c57 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -39,7 +39,7 @@
 #include <fcntl.h>
 #include <xen/dom0_ops.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "xen_driver.h"
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index f804620..ba93d2e 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -63,7 +63,7 @@
 /* required for shutdown flags */
 #include <xen/sched.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "driver.h"
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 4cce25a..2043c74 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -27,7 +27,7 @@
 #include <dirent.h>
 #include <sys/inotify.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "driver.h"
 #include "viralloc.h"
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 120e237..84a25e8 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -29,7 +29,7 @@
 #include <netdb.h>
 #include <errno.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
 #include "xend_internal.h"
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 0806e77..003e8f7 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -35,7 +35,7 @@
 #include <stdint.h>
 #include <xen/dom0_ops.h>
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "xm_internal.h"
 #include "xen_driver.h"
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 20332df..9308522 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -41,7 +41,7 @@
 # include <xs.h>
 #endif
 
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "driver.h"
 #include "viralloc.h"
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index df5625e..d7e22d3 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -28,7 +28,7 @@
 #include <xen/api/xen_all.h>
 #include "internal.h"
 #include "domain_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virauth.h"
 #include "virutil.h"
diff --git a/src/xenapi/xenapi_driver_private.h b/src/xenapi/xenapi_driver_private.h
index 42684bd..7e5b6e7 100644
--- a/src/xenapi/xenapi_driver_private.h
+++ b/src/xenapi/xenapi_driver_private.h
@@ -25,7 +25,7 @@
 
 # include <libxml/tree.h>
 # include <xen/api/xen_common.h>
-# include "virterror_internal.h"
+# include "virerror.h"
 
 /*# define PRINT_XML*/
 # define VIR_FROM_THIS VIR_FROM_XENAPI
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 5c53b69..3b8384e 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -27,7 +27,7 @@
 #include <xen/api/xen_all.h>
 #include "internal.h"
 #include "domain_conf.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "datatypes.h"
 #include "virutil.h"
 #include "viruuid.h"
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index b83ac58..83b7c74 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -27,7 +27,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virconf.h"
 #include "viralloc.h"
 #include "verify.h"
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index bbf35d8..df13ac7 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -26,7 +26,7 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virconf.h"
 #include "viralloc.h"
 #include "verify.h"
diff --git a/tests/commandtest.c b/tests/commandtest.c
index d6a285e..fd2b8c0 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -36,7 +36,7 @@
 #include "vircommand.h"
 #include "virfile.h"
 #include "virpidfile.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/tests/libvirtdconftest.c b/tests/libvirtdconftest.c
index c1d94d2..fd033f8 100644
--- a/tests/libvirtdconftest.c
+++ b/tests/libvirtdconftest.c
@@ -26,7 +26,7 @@
 #include "daemon/libvirtd-config.h"
 #include "virutil.h"
 #include "c-ctype.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virconf.h"
 
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index e1b6c56..35f2da6 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -23,7 +23,7 @@
 #include "testutilsqemu.h"
 #include "qemumonitortestutils.h"
 #include "virthread.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index b82eb5d..78eab29 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -32,7 +32,7 @@
 #include "viralloc.h"
 #include "virutil.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index b523c79..8aa4f08 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -33,7 +33,7 @@
 #include "viralloc.h"
 #include "virutil.h"
 #include "virlog.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "security/security_manager.h"
 
 
diff --git a/tests/testutils.c b/tests/testutils.c
index d88af21..9c8f365 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -42,7 +42,7 @@
 #include "viralloc.h"
 #include "virutil.h"
 #include "virthread.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virbuffer.h"
 #include "virlog.h"
 #include "vircommand.h"
diff --git a/tests/virauthconfigtest.c b/tests/virauthconfigtest.c
index 2ad237d..67c5de8 100644
--- a/tests/virauthconfigtest.c
+++ b/tests/virauthconfigtest.c
@@ -25,7 +25,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c
index cab47d3..de8cf70 100644
--- a/tests/virdrivermoduletest.c
+++ b/tests/virdrivermoduletest.c
@@ -22,7 +22,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "driver.h"
diff --git a/tests/virkeyfiletest.c b/tests/virkeyfiletest.c
index 33f64c1..fb41840 100644
--- a/tests/virkeyfiletest.c
+++ b/tests/virkeyfiletest.c
@@ -25,7 +25,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/tests/virlockspacetest.c b/tests/virlockspacetest.c
index c434f47..8673700 100644
--- a/tests/virlockspacetest.c
+++ b/tests/virlockspacetest.c
@@ -26,7 +26,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/tests/virnetmessagetest.c b/tests/virnetmessagetest.c
index 4e7a1fd..e58fd1f 100644
--- a/tests/virnetmessagetest.c
+++ b/tests/virnetmessagetest.c
@@ -25,7 +25,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 819257b..b968973 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -29,7 +29,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "virfile.h"
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index d945181..a1e71dc 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -28,7 +28,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "virfile.h"
diff --git a/tests/virstringtest.c b/tests/virstringtest.c
index 58ab843..86d8986 100644
--- a/tests/virstringtest.c
+++ b/tests/virstringtest.c
@@ -24,7 +24,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/tests/virtimetest.c b/tests/virtimetest.c
index 1c22d07..18f621a 100644
--- a/tests/virtimetest.c
+++ b/tests/virtimetest.c
@@ -25,7 +25,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/tests/viruritest.c b/tests/viruritest.c
index ad59270..3cb88da 100644
--- a/tests/viruritest.c
+++ b/tests/viruritest.c
@@ -25,7 +25,7 @@
 
 #include "testutils.h"
 #include "virutil.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/tools/console.c b/tools/console.c
index d024d38..29873ea 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -43,7 +43,7 @@
 # include "virfile.h"
 # include "viralloc.h"
 # include "virthread.h"
-# include "virterror_internal.h"
+# include "virerror.h"
 
 /*
  * Convert given character to control character.
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 3a9cebe..f3da1d5 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -49,7 +49,7 @@
 #include "virmacaddr.h"
 #include "virstring.h"
 #include "virsh-domain-monitor.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "virtypedparam.h"
 #include "virxml.h"
 
diff --git a/tools/virsh.c b/tools/virsh.c
index 790cf56..283194a 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -54,7 +54,7 @@
 #endif
 
 #include "internal.h"
-#include "virterror_internal.h"
+#include "virerror.h"
 #include "base64.h"
 #include "virbuffer.h"
 #include "console.h"
diff --git a/tools/virsh.h b/tools/virsh.h
index 6e6d3ee..ab7161f 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -34,7 +34,7 @@
 # include <inttypes.h>
 
 # include "internal.h"
-# include "virterror_internal.h"
+# include "virerror.h"
 # include "virthread.h"
 # include "virnetdevbandwidth.h"
 
-- 
1.7.11.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]