[PATCH 6/8] vbox: Replace virReportError() with vboxReportError()

Michal Privoznik mprivozn at redhat.com
Mon Jan 23 09:35:53 UTC 2023


Now that we have vboxReportError() which reports VirtualBox
errors too, we can switch the code to use the former. And since
the vboxReportError() is designed to behave exactly like
virReportError() we can do that almost everywhere, regardless of
the source of the error.

There are a few exceptions though, for instance, when
initializing VirtualBox SDK (we don't have all the objects needed
for querying exceptions yet), or when invalid combination of
arguments was passed to an API of ours, or when a function from
other module (e.g. src/conf/) failed.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/vbox/vbox_common.c | 1157 ++++++++++++++++++++--------------------
 1 file changed, 579 insertions(+), 578 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 2a913e5975..b7b61df080 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -391,8 +391,8 @@ static int openSessionForMachine(struct _vboxDriver *data, const unsigned char *
 
     /* Get machine for the call to VBOX_SESSION_OPEN_EXISTING */
     if (NS_FAILED(gVBoxAPI.UIVirtualBox.GetMachine(data->vboxObj, iid, machine))) {
-        virReportError(VIR_ERR_NO_DOMAIN, "%s",
-                       _("no domain with matching uuid"));
+        vboxReportError(VIR_ERR_NO_DOMAIN, "%s",
+                        _("no domain with matching uuid"));
         return -1;
     }
 
@@ -492,9 +492,9 @@ vboxSetStorageController(virDomainControllerDef *controller,
     case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS:
     case VIR_DOMAIN_CONTROLLER_TYPE_ISA:
     case VIR_DOMAIN_CONTROLLER_TYPE_LAST:
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("The vbox driver does not support %s controller type"),
-                       virDomainControllerTypeToString(controller->type));
+        vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        _("The vbox driver does not support %s controller type"),
+                        virDomainControllerTypeToString(controller->type));
         return -1;
     }
 
@@ -526,16 +526,16 @@ vboxSetStorageController(virDomainControllerDef *controller,
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_NCR53C90:
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DC390:
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AM53C974:
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("The vbox driver does not support %s SCSI "
-                             "controller model"),
-                           virDomainControllerModelSCSITypeToString(controller->model));
+            vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                            _("The vbox driver does not support %s SCSI "
+                              "controller model"),
+                            virDomainControllerModelSCSITypeToString(controller->model));
             goto cleanup;
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT:
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST:
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unexpected SCSI controller model %d"),
-                           controller->model);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unexpected SCSI controller model %d"),
+                            controller->model);
             goto cleanup;
         }
     /* libvirt ide model => vbox ide model */
@@ -555,9 +555,9 @@ vboxSetStorageController(virDomainControllerDef *controller,
             break;
         case VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST:
         case VIR_DOMAIN_CONTROLLER_MODEL_IDE_DEFAULT:
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Unexpected IDE controller model %d"),
-                           controller->model);
+            vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                            _("Unexpected IDE controller model %d"),
+                            controller->model);
             goto cleanup;
         }
     }
@@ -570,10 +570,10 @@ vboxSetStorageController(virDomainControllerDef *controller,
                                                  vboxBusType, &vboxController);
 
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to add storage controller "
-                         "(name: %s, busType: %d), rc=%08x"),
-                       debugName, vboxBusType, rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Failed to add storage controller "
+                          "(name: %s, busType: %d), rc=%08x"),
+                        debugName, vboxBusType, rc);
         goto cleanup;
     }
 
@@ -582,7 +582,7 @@ vboxSetStorageController(virDomainControllerDef *controller,
         rc = gVBoxAPI.UIStorageController.SetControllerType(vboxController,
                                                             vboxModel);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
                             _("Failed to change storage controller model, "
                               "rc=%08x"), rc);
             goto cleanup;
@@ -798,9 +798,9 @@ static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids)
 
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of Domains, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of Domains, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
@@ -840,8 +840,8 @@ static int vboxConnectNumOfDomains(virConnectPtr conn)
 
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get number of Domains, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get number of Domains, rc=%08x"), (unsigned)rc);
         goto cleanup;
     }
 
@@ -886,16 +886,16 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id)
     /* Internal vbox IDs start from 0, the public libvirt ID
      * starts from 1, so refuse id == 0, and adjust the rest */
     if (id == 0) {
-        virReportError(VIR_ERR_NO_DOMAIN,
-                       _("no domain with matching id %d"), id);
+        vboxReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching id %d"), id);
         return NULL;
     }
     id = id - 1;
 
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of machines, rc=%08x"), (unsigned)rc);
         return NULL;
     }
 
@@ -960,8 +960,8 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
     VBOX_IID_INITIALIZE(&iid);
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of machines, rc=%08x"), (unsigned)rc);
         return NULL;
     }
 
@@ -1032,8 +1032,8 @@ vboxDomainLookupByName(virConnectPtr conn, const char *name)
     VBOX_IID_INITIALIZE(&iid);
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of machines, rc=%08x"), (unsigned)rc);
         return NULL;
     }
 
@@ -1166,11 +1166,11 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
         deviceSlot = disk->info.addr.drive.bus;
 
         if (type != VIR_STORAGE_TYPE_FILE) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Unsupported storage type %s, the only supported "
-                             "type is %s"),
-                           virStorageTypeToString(type),
-                           virStorageTypeToString(VIR_STORAGE_TYPE_FILE));
+            vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                            _("Unsupported storage type %s, the only supported "
+                              "type is %s"),
+                            virStorageTypeToString(type),
+                            virStorageTypeToString(VIR_STORAGE_TYPE_FILE));
             ret = -1;
             goto cleanup;
         }
@@ -1178,8 +1178,8 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
         switch ((virDomainDiskDevice) disk->device) {
         case VIR_DOMAIN_DISK_DEVICE_DISK:
             if (!src) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("Missing disk source file path"));
+                vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                _("Missing disk source file path"));
                 ret = -1;
                 goto cleanup;
             }
@@ -1201,9 +1201,9 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
             break;
         case VIR_DOMAIN_DISK_DEVICE_LUN:
         case VIR_DOMAIN_DISK_DEVICE_LAST:
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("The vbox driver does not support %s disk device"),
-                           virDomainDiskDeviceTypeToString(disk->device));
+            vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                            _("The vbox driver does not support %s disk device"),
+                            virDomainDiskDeviceTypeToString(disk->device));
             ret = -1;
             goto cleanup;
         }
@@ -1242,9 +1242,9 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
         case VIR_DOMAIN_DISK_BUS_SD:
         case VIR_DOMAIN_DISK_BUS_NONE:
         case VIR_DOMAIN_DISK_BUS_LAST:
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("The vbox driver does not support %s bus type"),
-                           virDomainDiskBusTypeToString(disk->bus));
+            vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                            _("The vbox driver does not support %s bus type"),
+                            virDomainDiskBusTypeToString(disk->bus));
             ret = -1;
             goto cleanup;
         }
@@ -1273,19 +1273,19 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
             }
 
             if (!medium) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Failed to open the following disk/dvd/floppy "
-                                 "to the machine: %s, rc=%08x"), src, rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Failed to open the following disk/dvd/floppy "
+                                  "to the machine: %s, rc=%08x"), src, rc);
                 ret = -1;
                 goto cleanup;
             }
 
             rc = gVBoxAPI.UIMedium.GetId(medium, &mediumUUID);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Can't get the UUID of the file to be attached "
-                                 "as harddisk/dvd/floppy: %s, rc=%08x"),
-                               src, rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Can't get the UUID of the file to be attached "
+                                  "as harddisk/dvd/floppy: %s, rc=%08x"),
+                                src, rc);
                 ret = -1;
                 goto cleanup;
             }
@@ -1318,9 +1318,9 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
                                              medium);
 
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not attach the file as "
-                             "harddisk/dvd/floppy: %s, rc=%08x"), src, rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not attach the file as "
+                              "harddisk/dvd/floppy: %s, rc=%08x"), src, rc);
             ret = -1;
             goto cleanup;
         } else {
@@ -1429,8 +1429,8 @@ vboxAttachNetwork(virDomainDef *def, struct _vboxDriver *data, IMachine *machine
                 VIR_DEBUG("NIC(%zu): ipaddr: %s", i, ipStr);
                 VIR_FREE(ipStr);
             } else if (def->nets[i]->guestIP.nips > 1) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("Driver does not support setting multiple IP addresses"));
+                vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                _("Driver does not support setting multiple IP addresses"));
                 return -1;
             }
         }
@@ -1981,39 +1981,39 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags
     rc = gVBoxAPI.UIVirtualBox.CreateMachine(data, def, &machine, uuidstr);
 
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not define a domain, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not define a domain, rc=%08x"), (unsigned)rc);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIMachine.SetMemorySize(machine,
                                           VIR_DIV_UP(def->mem.cur_balloon, 1024));
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not set the memory size of the domain to: %llu Kb, "
-                         "rc=%08x"),
-                       def->mem.cur_balloon, (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not set the memory size of the domain to: %llu Kb, "
+                          "rc=%08x"),
+                        def->mem.cur_balloon, (unsigned)rc);
     }
 
     if (virDomainDefHasVcpusOffline(def)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("current vcpu count must equal maximum"));
+        vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                        _("current vcpu count must equal maximum"));
     }
     rc = gVBoxAPI.UIMachine.SetCPUCount(machine, virDomainDefGetVcpusMax(def));
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not set the number of virtual CPUs to: %u, rc=%08x"),
-                       virDomainDefGetVcpusMax(def), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not set the number of virtual CPUs to: %u, rc=%08x"),
+                        virDomainDefGetVcpusMax(def), (unsigned)rc);
     }
 
     rc = gVBoxAPI.UIMachine.SetCPUProperty(machine, CPUPropertyType_PAE,
                                            def->features[VIR_DOMAIN_FEATURE_PAE] ==
                                            VIR_TRISTATE_SWITCH_ON);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not change PAE status to: %s, rc=%08x"),
-                       (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_TRISTATE_SWITCH_ON)
-                       ? _("Enabled") : _("Disabled"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not change PAE status to: %s, rc=%08x"),
+                        (def->features[VIR_DOMAIN_FEATURE_PAE] == VIR_TRISTATE_SWITCH_ON)
+                        ? _("Enabled") : _("Disabled"), (unsigned)rc);
     }
 
     gVBoxAPI.UIMachine.GetBIOSSettings(machine, &bios);
@@ -2022,19 +2022,19 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags
                                                     def->features[VIR_DOMAIN_FEATURE_ACPI] ==
                                                     VIR_TRISTATE_SWITCH_ON);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("could not change ACPI status to: %s, rc=%08x"),
-                           (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON)
-                           ? _("Enabled") : _("Disabled"), (unsigned)rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("could not change ACPI status to: %s, rc=%08x"),
+                            (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON)
+                            ? _("Enabled") : _("Disabled"), (unsigned)rc);
         }
         rc = gVBoxAPI.UIBIOSSettings.SetIOAPICEnabled(bios,
                                                       def->features[VIR_DOMAIN_FEATURE_APIC] ==
                                                       VIR_TRISTATE_SWITCH_ON);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("could not change APIC status to: %s, rc=%08x"),
-                           (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_TRISTATE_SWITCH_ON)
-                           ? _("Enabled") : _("Disabled"), (unsigned)rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("could not change APIC status to: %s, rc=%08x"),
+                            (def->features[VIR_DOMAIN_FEATURE_APIC] == VIR_TRISTATE_SWITCH_ON)
+                            ? _("Enabled") : _("Disabled"), (unsigned)rc);
         }
         VBOX_RELEASE(bios);
     }
@@ -2042,8 +2042,8 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags
     /* Register the machine before attaching other devices to it */
     rc = gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not define a domain, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not define a domain, rc=%08x"), (unsigned)rc);
         goto cleanup;
     }
 
@@ -2086,8 +2086,8 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags
      */
     rc = gVBoxAPI.UIMachine.SaveSettings(machine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to save VM settings, rc=%08x"), rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Failed to save VM settings, rc=%08x"), rc);
         machineReady = false;
     }
 
@@ -2143,8 +2143,8 @@ static int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
         gVBoxAPI.deleteConfig(machine);
         ret = 0;
     } else {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not delete the domain, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not delete the domain, rc=%08x"), (unsigned)rc);
     }
 
     vboxIIDUnalloc(&iid);
@@ -2265,8 +2265,8 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine, vboxIID *iid
                                             &progress);
 
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("OpenRemoteSession/LaunchVMProcess failed, domain can't be started"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("OpenRemoteSession/LaunchVMProcess failed, domain can't be started"));
         goto cleanup;
     } else {
         PRBool completed = 0;
@@ -2316,15 +2316,15 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
     virCheckFlags(0, -1);
 
     if (!dom->name) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Error while reading the domain name"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Error while reading the domain name"));
         return -1;
     }
 
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of machines, rc=%08x"), (unsigned)rc);
         return -1;
     }
 
@@ -2353,10 +2353,10 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
                 if (gVBoxAPI.machineStateChecker.NotStart(state)) {
                     ret = vboxStartMachine(dom, i, machine, &iid);
                 } else {
-                    virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                                   _("machine is not in "
-                                     "poweroff|saved|aborted state, so "
-                                     "couldn't start it"));
+                    vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                                    _("machine is not in "
+                                      "poweroff|saved|aborted state, so "
+                                      "couldn't start it"));
                     ret = -1;
                 }
             }
@@ -2424,8 +2424,8 @@ static int vboxDomainIsActive(virDomainPtr dom)
     VBOX_IID_INITIALIZE(&iid);
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of machines, rc=%08x"), (unsigned)rc);
         return ret;
     }
 
@@ -2555,14 +2555,14 @@ static int vboxDomainSuspend(virDomainPtr dom)
             VBOX_RELEASE(console);
             ret = 0;
         } else {
-            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                           _("error while suspending the domain"));
+            vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                            _("error while suspending the domain"));
             goto cleanup;
         }
         gVBoxAPI.UISession.Close(data->vboxSession);
     } else {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("machine not in running state to suspend it"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("machine not in running state to suspend it"));
         goto cleanup;
     }
 
@@ -2606,14 +2606,14 @@ static int vboxDomainResume(virDomainPtr dom)
             VBOX_RELEASE(console);
             ret = 0;
         } else {
-            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                           _("error while resuming the domain"));
+            vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                            _("error while resuming the domain"));
             goto cleanup;
         }
         gVBoxAPI.UISession.Close(data->vboxSession);
     } else {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("machine not paused, so can't resume it"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("machine not paused, so can't resume it"));
         goto cleanup;
     }
 
@@ -2651,12 +2651,12 @@ static int vboxDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
     gVBoxAPI.UIMachine.GetState(machine, &state);
 
     if (gVBoxAPI.machineStateChecker.Paused(state)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("machine paused, so can't power it down"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("machine paused, so can't power it down"));
         goto cleanup;
     } else if (gVBoxAPI.machineStateChecker.PoweredOff(state)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("machine already powered down"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("machine already powered down"));
         goto cleanup;
     }
 
@@ -2717,8 +2717,8 @@ static int vboxDomainReboot(virDomainPtr dom, unsigned int flags)
         }
         gVBoxAPI.UISession.Close(data->vboxSession);
     } else {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("machine not running, so can't reboot it"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("machine not running, so can't reboot it"));
         goto cleanup;
     }
 
@@ -2756,8 +2756,8 @@ static int vboxDomainDestroyFlags(virDomainPtr dom, unsigned int flags)
     gVBoxAPI.UIMachine.GetState(machine, &state);
 
     if (gVBoxAPI.machineStateChecker.PoweredOff(state)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("machine already powered down"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("machine already powered down"));
         goto cleanup;
     }
 
@@ -2819,8 +2819,8 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory)
     gVBoxAPI.UIMachine.GetState(machine, &state);
 
     if (!gVBoxAPI.machineStateChecker.PoweredOff(state)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("memory size can't be changed unless domain is powered down"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("memory size can't be changed unless domain is powered down"));
         goto cleanup;
     }
 
@@ -2837,10 +2837,10 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory)
             gVBoxAPI.UIMachine.SaveSettings(machine);
             ret = 0;
         } else {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("could not set the memory size of the "
-                             "domain to: %lu Kb, rc=%08x"),
-                           memory, (unsigned)rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("could not set the memory size of the "
+                              "domain to: %lu Kb, rc=%08x"),
+                            memory, (unsigned)rc);
         }
     }
     gVBoxAPI.UISession.Close(data->vboxSession);
@@ -2866,8 +2866,8 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
 
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of machines, rc=%08x"), (unsigned)rc);
         return -1;
     }
 
@@ -2977,7 +2977,7 @@ static int vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
         return ret;
 
     if (flags != VIR_DOMAIN_AFFECT_LIVE) {
-        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+        vboxReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
         return -1;
     }
 
@@ -2993,19 +2993,19 @@ static int vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
                 gVBoxAPI.UIMachine.SaveSettings(machine);
                 ret = 0;
             } else {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("could not set the number of cpus of the domain "
-                                 "to: %u, rc=%08x"),
-                               CPUCount, (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("could not set the number of cpus of the domain "
+                                  "to: %u, rc=%08x"),
+                                CPUCount, (unsigned)rc);
             }
             VBOX_RELEASE(machine);
         } else {
-            virReportError(VIR_ERR_NO_DOMAIN,
-                           _("no domain with matching id %d"), dom->id);
+            vboxReportError(VIR_ERR_NO_DOMAIN,
+                            _("no domain with matching id %d"), dom->id);
         }
     } else {
-        virReportError(VIR_ERR_NO_DOMAIN,
-                       _("can't open session to the domain with id %d"), dom->id);
+        vboxReportError(VIR_ERR_NO_DOMAIN,
+                        _("can't open session to the domain with id %d"), dom->id);
     }
     gVBoxAPI.UISession.Close(data->vboxSession);
 
@@ -3029,7 +3029,7 @@ static int vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
         return ret;
 
     if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
-        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+        vboxReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
         return -1;
     }
 
@@ -3296,8 +3296,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
 
         rc = gVBoxAPI.UIMediumAttachment.GetMedium(mediumAttachment, &medium);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not get IMedium, rc=%08x"), rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not get IMedium, rc=%08x"), rc);
             goto cleanup;
         }
 
@@ -3336,17 +3336,17 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
 
         rc = gVBoxAPI.UIMediumAttachment.GetMedium(mediumAttachment, &medium);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not get IMedium, rc=%08x"), rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not get IMedium, rc=%08x"), rc);
             goto cleanup;
         }
 
         rc = gVBoxAPI.UIMediumAttachment.GetController(mediumAttachment,
                                                        &controllerName);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to get storage controller name, rc=%08x"),
-                           rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Failed to get storage controller name, rc=%08x"),
+                            rc);
             goto cleanup;
         }
 
@@ -3354,44 +3354,44 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
                                                            controllerName,
                                                            &controller);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not get storage controller by name, rc=%08x"),
-                           rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not get storage controller by name, rc=%08x"),
+                            rc);
             goto cleanup;
         }
 
         rc = gVBoxAPI.UIMediumAttachment.GetType(mediumAttachment, &deviceType);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not get device type, rc=%08x"), rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not get device type, rc=%08x"), rc);
             goto cleanup;
         }
         rc = gVBoxAPI.UIMediumAttachment.GetPort(mediumAttachment, &devicePort);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not get device port, rc=%08x"), rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not get device port, rc=%08x"), rc);
             goto cleanup;
         }
         rc = gVBoxAPI.UIMediumAttachment.GetDevice(mediumAttachment, &deviceSlot);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not get device slot, rc=%08x"), rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not get device slot, rc=%08x"), rc);
             goto cleanup;
         }
         rc = gVBoxAPI.UIStorageController.GetBus(controller, &storageBus);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not get storage controller bus, rc=%08x"),
-                           rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not get storage controller bus, rc=%08x"),
+                            rc);
             goto cleanup;
         }
 
         if (medium) {
             rc = gVBoxAPI.UIMedium.GetLocation(medium, &mediumLocUtf16);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Could not get medium storage location, rc=%08x"),
-                               rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Could not get medium storage location, rc=%08x"),
+                                rc);
                 goto cleanup;
             }
 
@@ -3401,8 +3401,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
 
             rc = gVBoxAPI.UIMedium.GetReadOnly(medium, &readOnly);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Could not get read only state, rc=%08x"), rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Could not get read only state, rc=%08x"), rc);
                 goto cleanup;
             }
         }
@@ -3411,9 +3411,9 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
                                            sdCount);
 
         if (!disk->dst) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not generate medium name for the disk "
-                             "at: port:%d, slot:%d"), devicePort, deviceSlot);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not generate medium name for the disk "
+                              "at: port:%d, slot:%d"), devicePort, deviceSlot);
             goto cleanup;
         }
 
@@ -3467,8 +3467,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
 
             break;
         case StorageBus_Null:
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unsupported null storage bus"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unsupported null storage bus"));
             goto cleanup;
         }
 
@@ -3489,8 +3489,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *data, IMachine *machine)
         case DeviceType_USB:
         case DeviceType_SharedFolder:
         case DeviceType_Null:
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unsupported vbox device type: %d"), deviceType);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unsupported vbox device type: %d"), deviceType);
             goto cleanup;
         }
 
@@ -4228,9 +4228,9 @@ static int vboxConnectListDefinedDomains(virConnectPtr conn,
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj,
                                       ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of Defined Domains, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of Defined Domains, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
@@ -4281,9 +4281,9 @@ static int vboxConnectNumOfDefinedDomains(virConnectPtr conn)
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj,
                                       ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get number of Defined Domains, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get number of Defined Domains, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
@@ -4373,9 +4373,9 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
                                                        writable, PR_FALSE);
 
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("could not attach shared folder '%s', rc=%08x"),
-                               dev->data.fs->dst, (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("could not attach shared folder '%s', rc=%08x"),
+                                dev->data.fs->dst, (unsigned)rc);
                 ret = -1;
             } else {
                 ret = 0;
@@ -4388,7 +4388,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
         VBOX_RELEASE(machine);
 
         if (ret == -VIR_ERR_ARGUMENT_UNSUPPORTED) {
-            virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported device type %d"), dev->type);
+            vboxReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported device type %d"), dev->type);
             ret = -1;
         }
     }
@@ -4491,9 +4491,9 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml)
             rc = gVBoxAPI.UIMachine.RemoveSharedFolder(machine, nameUtf16);
 
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("could not detach shared folder '%s', rc=%08x"),
-                               dev->data.fs->dst, (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("could not detach shared folder '%s', rc=%08x"),
+                                dev->data.fs->dst, (unsigned)rc);
             } else {
                 ret = 0;
             }
@@ -4504,7 +4504,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml)
         VBOX_RELEASE(machine);
 
         if (ret == -VIR_ERR_ARGUMENT_UNSUPPORTED) {
-            virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported device type %d"), dev->type);
+            vboxReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported device type %d"), dev->type);
             ret = -1;
         }
     }
@@ -4548,15 +4548,15 @@ static int vboxCloseDisksRecursively(virDomainPtr dom, char *location)
                                           AccessMode_ReadWrite,
                                           &medium);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to open HardDisk, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to open HardDisk, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
     rc = gVBoxAPI.UIMedium.GetChildren(medium, &childrenSize, &children);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to get disk children"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to get disk children"));
         goto cleanup;
     }
     for (i = 0; i < childrenSize; i++) {
@@ -4566,15 +4566,15 @@ static int vboxCloseDisksRecursively(virDomainPtr dom, char *location)
             char *childLocation = NULL;
             rc = gVBoxAPI.UIMedium.GetLocation(childMedium, &childLocationUtf);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get childMedium location"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get childMedium location"));
                 goto cleanup;
             }
             VBOX_UTF16_TO_UTF8(childLocationUtf, &childLocation);
             VBOX_UTF16_FREE(childLocationUtf);
             if (vboxCloseDisksRecursively(dom, childLocation) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to close disk children"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to close disk children"));
                 goto cleanup;
             }
             VIR_FREE(childLocation);
@@ -4582,9 +4582,9 @@ static int vboxCloseDisksRecursively(virDomainPtr dom, char *location)
     }
     rc = gVBoxAPI.UIMedium.Close(medium);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to close HardDisk, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to close HardDisk, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
@@ -4672,8 +4672,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
     /* It may failed when the machine is not mutable. */
     rc = gVBoxAPI.UIMachine.GetSettingsFilePath(machine, &settingsFilePath);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot get settings file path"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot get settings file path"));
         goto cleanup;
     }
     VBOX_UTF16_TO_UTF8(settingsFilePath, &settingsFilePath_Utf8);
@@ -4681,8 +4681,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
     /* Getting the machine name to retrieve the machine location path. */
     rc = gVBoxAPI.UIMachine.GetName(machine, &machineNameUtf16);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot get machine name"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot get machine name"));
         goto cleanup;
     }
     VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
@@ -4690,16 +4690,16 @@ vboxSnapshotRedefine(virDomainPtr dom,
     nameTmpUse = g_strdup_printf("%s.vbox", machineName);
     machineLocationPath = virStringReplace(settingsFilePath_Utf8, nameTmpUse, "");
     if (machineLocationPath == NULL) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to get the machine location path"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to get the machine location path"));
         goto cleanup;
     }
 
     /* We create the xml struct with the settings file path. */
     snapshotMachineDesc = virVBoxSnapshotConfLoadVboxFile(settingsFilePath_Utf8, machineLocationPath);
     if (snapshotMachineDesc == NULL) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot create a vboxSnapshotXmlPtr"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot create a vboxSnapshotXmlPtr"));
         goto cleanup;
     }
     if (snapshotMachineDesc->currentSnapshot != NULL) {
@@ -4715,8 +4715,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
          * the machine unregistration.
          */
         if (virVBoxSnapshotConfRemoveFakeDisks(snapshotMachineDesc) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to remove Fake Disks"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to remove Fake Disks"));
             goto cleanup;
         }
         realReadWriteDisksPathSize = virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(currentSnapshotXmlFilePath,
@@ -4726,9 +4726,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
         /* The read-only disk number is necessarily greater or equal to the
          * read-write disk number */
         if (realReadOnlyDisksPathSize < realReadWriteDisksPathSize) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("The read only disk number must be greater or equal to the "
-                           " read write disk number"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("The read only disk number must be greater or equal to the "
+                              " read write disk number"));
             goto cleanup;
         }
         for (it = 0; it < realReadWriteDisksPathSize; it++) {
@@ -4749,9 +4749,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                                   AccessMode_ReadWrite,
                                                   &readWriteMedium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to open HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to open HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 VBOX_UTF16_FREE(locationUtf);
                 goto cleanup;
             }
@@ -4759,8 +4759,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
             rc = gVBoxAPI.UIMedium.GetId(readWriteMedium, &iid);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get the read write medium id"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get the read write medium id"));
                 goto cleanup;
             }
             gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid);
@@ -4768,8 +4768,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
             rc = gVBoxAPI.UIMedium.GetFormat(readWriteMedium, &formatUtf);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get the read write medium format"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get the read write medium format"));
                 goto cleanup;
             }
             VBOX_UTF16_TO_UTF8(formatUtf, &format);
@@ -4795,16 +4795,16 @@ vboxSnapshotRedefine(virDomainPtr dom,
             if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(readWriteDisk,
                                            snapshotMachineDesc->mediaRegistry,
                                            parentUuid) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to add hard disk to media Registry"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to add hard disk to media Registry"));
                 VIR_FREE(readWriteDisk);
                 goto cleanup;
             }
             rc = gVBoxAPI.UIMedium.Close(readWriteMedium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to close HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to close HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
         }
@@ -4840,8 +4840,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
         diskInMediaRegistry = virVBoxSnapshotConfDiskIsInMediaRegistry(snapshotMachineDesc,
                                                         def->parent.dom->disks[it]->src->path);
         if (diskInMediaRegistry == -1) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to know if disk is in media registry"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to know if disk is in media registry"));
             goto cleanup;
         }
         if (diskInMediaRegistry == 1) /* Nothing to do. */
@@ -4855,9 +4855,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                               AccessMode_ReadWrite,
                                               &readOnlyMedium);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unable to open HardDisk, rc=%08x"),
-                           (unsigned)rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unable to open HardDisk, rc=%08x"),
+                            (unsigned)rc);
             VBOX_UTF16_FREE(locationUtf);
             goto cleanup;
         }
@@ -4865,8 +4865,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
         rc = gVBoxAPI.UIMedium.GetId(readOnlyMedium, &iid);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to get hard disk id"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to get hard disk id"));
             goto cleanup;
         }
         gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid);
@@ -4874,8 +4874,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
         rc = gVBoxAPI.UIMedium.GetFormat(readOnlyMedium, &formatUtf);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to get hard disk format"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to get hard disk format"));
             VIR_FREE(uuid);
             goto cleanup;
         }
@@ -4885,17 +4885,17 @@ vboxSnapshotRedefine(virDomainPtr dom,
         /* This disk is already in the media registry */
         rc = gVBoxAPI.UIMedium.GetParent(readOnlyMedium, &parentReadOnlyMedium);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to get parent hard disk"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to get parent hard disk"));
             VIR_FREE(uuid);
             goto cleanup;
         }
 
         rc = gVBoxAPI.UIMedium.GetId(parentReadOnlyMedium, &parentiid);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unable to get hard disk id, rc=%08x"),
-                           (unsigned)rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unable to get hard disk id, rc=%08x"),
+                            (unsigned)rc);
             VIR_FREE(uuid);
             goto cleanup;
         }
@@ -4904,9 +4904,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
         rc = gVBoxAPI.UIMedium.Close(readOnlyMedium);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unable to close HardDisk, rc=%08x"),
-                           (unsigned)rc);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unable to close HardDisk, rc=%08x"),
+                            (unsigned)rc);
             VIR_FREE(uuid);
             VIR_FREE(parentUuid);
             goto cleanup;
@@ -4919,9 +4919,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
         readOnlyDisk->location = g_strdup(def->parent.dom->disks[it]->src->path);
 
         if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(readOnlyDisk, snapshotMachineDesc->mediaRegistry,
-                                       parentUuid) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to add hard disk to media registry"));
+                                                          parentUuid) < 0) {
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to add hard disk to media registry"));
             VIR_FREE(readOnlyDisk);
             goto cleanup;
         }
@@ -4933,9 +4933,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                        &aMediaSize,
                                        &aMedia);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to unregister machine, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to unregister machine, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
     VBOX_RELEASE(machine);
@@ -4953,8 +4953,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
             char *locationUtf8 = NULL;
             rc = gVBoxAPI.UIMedium.GetLocation(medium, &locationUtf16);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get medium location"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get medium location"));
                 goto cleanup;
             }
             VBOX_UTF16_TO_UTF8(locationUtf16, &locationUtf8);
@@ -4965,18 +4965,18 @@ vboxSnapshotRedefine(virDomainPtr dom,
                 resultCodeUnion resultCode;
                 rc = gVBoxAPI.UIMedium.DeleteStorage(medium, &progress);
                 if (NS_FAILED(rc)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to delete medium, rc=%08x"),
-                                   (unsigned)rc);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to delete medium, rc=%08x"),
+                                    (unsigned)rc);
                     VIR_FREE(locationUtf8);
                     goto cleanup;
                 }
                 gVBoxAPI.UIProgress.WaitForCompletion(progress, -1);
                 gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode);
                 if (RC_FAILED(resultCode)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Error while closing medium, rc=%08x"),
-                                   resultCode.uResultCode);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Error while closing medium, rc=%08x"),
+                                    resultCode.uResultCode);
                     VIR_FREE(locationUtf8);
                     goto cleanup;
                 }
@@ -4998,8 +4998,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
     /* Close all disks that failed to close normally. */
     for (it = 0; it < snapshotMachineDesc->mediaRegistry->ndisks; it++) {
         if (vboxCloseDisksRecursively(dom, snapshotMachineDesc->mediaRegistry->disks[it]->location) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to close recursively all disks"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to close recursively all disks"));
             goto cleanup;
         }
     }
@@ -5059,8 +5059,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
         VIR_FREE(tmp);
     }
     if (virVBoxSnapshotConfAddSnapshotToXmlMachine(newSnapshotPtr, snapshotMachineDesc, def->parent.parent_name) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to add the snapshot to the machine description"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to add the snapshot to the machine description"));
         goto cleanup;
     }
     /*
@@ -5099,9 +5099,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                                   &medium);
             VBOX_UTF16_FREE(locationUtf16);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to open HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to open HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
         }
@@ -5132,9 +5132,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                                  AccessMode_ReadWrite,
                                                  &medium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to open HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to open HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
             VBOX_UTF16_FREE(locationUtf16);
@@ -5143,8 +5143,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
             rc = gVBoxAPI.UIMedium.GetFormat(medium, &formatUtf16);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get disk format"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get disk format"));
                 VIR_FREE(disk);
                 goto cleanup;
             }
@@ -5157,8 +5157,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
             rc = gVBoxAPI.UIMedium.GetId(medium, &iid);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get disk uuid"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get disk uuid"));
                 VIR_FREE(disk);
                 goto cleanup;
             }
@@ -5168,8 +5168,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
             rc = gVBoxAPI.UIMedium.GetParent(medium, &parentDisk);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get disk parent"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get disk parent"));
                 VIR_FREE(disk);
                 goto cleanup;
             }
@@ -5180,8 +5180,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
             if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(disk,
                                            snapshotMachineDesc->mediaRegistry,
                                            parentUuid) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to add hard disk to the media registry"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to add hard disk to the media registry"));
                 VIR_FREE(disk);
                 goto cleanup;
             }
@@ -5194,8 +5194,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                              it + 1,
                                              &searchResultTab);
                 if (resultSize != it + 1) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to find UUID %s"), searchResultTab[it]);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to find UUID %s"), searchResultTab[it]);
                     goto cleanup;
                 }
 
@@ -5212,9 +5212,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
             /* Close disk */
             rc = gVBoxAPI.UIMedium.Close(medium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to close HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to close HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
         }
@@ -5246,9 +5246,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                                   AccessMode_ReadWrite,
                                                   &medium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to open HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to open HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 VBOX_UTF16_FREE(locationUtf16);
                 goto cleanup;
             }
@@ -5256,9 +5256,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
             rc = gVBoxAPI.UIMedium.GetId(medium, &parentiid);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to get hardDisk Id, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to get hardDisk Id, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
             gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid);
@@ -5275,9 +5275,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
             VBOX_UTF16_FREE(newLocation);
             VBOX_UTF16_FREE(formatUtf16);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to create HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to create HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
 
@@ -5287,9 +5287,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
             gVBoxAPI.UIProgress.WaitForCompletion(progress, -1);
             gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode);
             if (RC_FAILED(resultCode)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Error while creating diff storage, rc=%08x"),
-                               resultCode.uResultCode);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Error while creating diff storage, rc=%08x"),
+                                resultCode.uResultCode);
                 goto cleanup;
             }
             VBOX_RELEASE(progress);
@@ -5302,9 +5302,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
             rc = gVBoxAPI.UIMedium.GetId(newMedium, &iid);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to get medium uuid, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to get medium uuid, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
             gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid);
@@ -5321,8 +5321,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
             if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(newHardDisk,
                                            snapshotMachineDesc->mediaRegistry,
                                            parentUuid) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to add hard disk to the media registry"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to add hard disk to the media registry"));
                 goto cleanup;
             }
             newHardDisk = NULL;  /* Consumed by above */
@@ -5333,8 +5333,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                          it + 1,
                                          &searchResultTab);
             if (resultSize != it + 1) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to find UUID %s"), searchResultTab[it]);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to find UUID %s"), searchResultTab[it]);
                 goto cleanup;
             }
 
@@ -5350,9 +5350,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
             /* Closing the "fake" disk */
             rc = gVBoxAPI.UIMedium.Close(newMedium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to close the new medium, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to close the new medium, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
         }
@@ -5367,8 +5367,8 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                                      data->xmlopt,
                                                      VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE);
         if (snapshotContent == NULL) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Unable to get snapshot content"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Unable to get snapshot content"));
             goto cleanup;
         }
         if (virFileWriteStr(currentSnapshotXmlFilePath, snapshotContent, 0644) < 0) {
@@ -5399,16 +5399,16 @@ vboxSnapshotRedefine(virDomainPtr dom,
                                                   AccessMode_ReadWrite,
                                                   &medium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to open HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to open HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
             rc = gVBoxAPI.UIMedium.Close(medium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to close HardDisk, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to close HardDisk, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
             VBOX_UTF16_FREE(locationUtf16);
@@ -5417,25 +5417,25 @@ vboxSnapshotRedefine(virDomainPtr dom,
 
     /* Now, we rewrite the 'machineName'.vbox file to redefine the machine. */
     if (virVBoxSnapshotConfSaveVboxFile(snapshotMachineDesc, settingsFilePath_Utf8) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to serialize the machine description"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to serialize the machine description"));
         goto cleanup;
     }
     rc = gVBoxAPI.UIVirtualBox.OpenMachine(data->vboxObj,
                                            settingsFilePath,
                                            &machine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to open Machine, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to open Machine, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to register Machine, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to register Machine, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
@@ -5510,8 +5510,8 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
 
     rc = gVBoxAPI.UIMachine.GetState(machine, &state);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get domain state"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get domain state"));
         goto cleanup;
     }
 
@@ -5524,9 +5524,9 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
     if (NS_SUCCEEDED(rc))
         rc = gVBoxAPI.UISession.GetConsole(data->vboxSession, &console);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not open VirtualBox session with domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not open VirtualBox session with domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
@@ -5538,24 +5538,24 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
 
     rc = gVBoxAPI.UIConsole.TakeSnapshot(console, name, description, &progress);
     if (NS_FAILED(rc) || !progress) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not take snapshot of domain %s"), dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not take snapshot of domain %s"), dom->name);
         goto cleanup;
     }
 
     gVBoxAPI.UIProgress.WaitForCompletion(progress, -1);
     gVBoxAPI.UIProgress.GetResultCode(progress, &result);
     if (RC_FAILED(result)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not take snapshot of domain %s"), dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not take snapshot of domain %s"), dom->name);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &snapshot);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get current snapshot of domain %s"),
-                  dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get current snapshot of domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
@@ -5577,6 +5577,7 @@ vboxDomainSnapshotGetAll(virDomainPtr dom,
                          IMachine *machine,
                          ISnapshot ***snapshots)
 {
+    struct _vboxDriver *data = dom->conn->privateData;
     vboxIID empty;
     ISnapshot **list = NULL;
     PRUint32 count;
@@ -5587,9 +5588,9 @@ vboxDomainSnapshotGetAll(virDomainPtr dom,
     VBOX_IID_INITIALIZE(&empty);
     rc = gVBoxAPI.UIMachine.GetSnapshotCount(machine, &count);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get snapshot count for domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get snapshot count for domain %s"),
+                        dom->name);
         goto error;
     }
 
@@ -5600,9 +5601,9 @@ vboxDomainSnapshotGetAll(virDomainPtr dom,
 
     rc = gVBoxAPI.UIMachine.FindSnapshot(machine, &empty, list);
     if (NS_FAILED(rc) || !list[0]) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get root snapshot for domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get root snapshot for domain %s"),
+                        dom->name);
         goto error;
     }
 
@@ -5613,16 +5614,16 @@ vboxDomainSnapshotGetAll(virDomainPtr dom,
         size_t i;
 
         if (!list[next]) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unexpected number of snapshots < %u"), count);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("unexpected number of snapshots < %u"), count);
             goto error;
         }
 
         rc = gVBoxAPI.UArray.vboxArrayGet(&children, list[next],
                                           gVBoxAPI.UArray.handleSnapshotGetChildren(list[next]));
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("could not get children snapshots"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("could not get children snapshots"));
             goto error;
         }
         for (i = 0; i < children.count; i++) {
@@ -5630,8 +5631,8 @@ vboxDomainSnapshotGetAll(virDomainPtr dom,
             if (!child)
                 continue;
             if (top == count) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("unexpected number of snapshots > %u"), count);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("unexpected number of snapshots > %u"), count);
                 gVBoxAPI.UArray.vboxArrayRelease(&children);
                 goto error;
             }
@@ -5675,8 +5676,8 @@ vboxDomainSnapshotGet(struct _vboxDriver *data,
 
         rc = gVBoxAPI.UISnapshot.GetName(snapshots[i], &nameUtf16);
         if (NS_FAILED(rc) || !nameUtf16) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("could not get snapshot name"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("could not get snapshot name"));
             goto cleanup;
         }
         VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
@@ -5690,9 +5691,9 @@ vboxDomainSnapshotGet(struct _vboxDriver *data,
     }
 
     if (!snapshot) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
-                       _("domain %s has no snapshots with name %s"),
-                       dom->name, name);
+        vboxReportError(VIR_ERR_OPERATION_INVALID,
+                        _("domain %s has no snapshots with name %s"),
+                        dom->name, name);
         goto cleanup;
     }
 
@@ -5738,8 +5739,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def,
 
     rc = gVBoxAPI.UISnapshot.GetId(snap, &snapIid);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Could not get snapshot id"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Could not get snapshot id"));
         goto cleanup;
     }
 
@@ -5747,16 +5748,16 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def,
     vboxIIDUnalloc(&snapIid);
     rc = gVBoxAPI.UISnapshot.GetMachine(snap, &snapMachine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get machine"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get machine"));
         goto cleanup;
     }
     def->ndisks = 0;
     rc = gVBoxAPI.UArray.vboxArrayGet(&mediumAttachments, snapMachine,
                                       gVBoxAPI.UArray.handleMachineGetMediumAttachments(snapMachine));
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("no medium attachments"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("no medium attachments"));
         goto cleanup;
     }
     /* get the number of attachments */
@@ -5767,8 +5768,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def,
 
             rc = gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &medium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("cannot get medium"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("cannot get medium"));
                 goto cleanup;
             }
             if (medium) {
@@ -5807,8 +5808,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def,
         rc = gVBoxAPI.UIMediumAttachment.GetController(imediumattach,
                                                        &storageControllerName);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get storage controller name"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get storage controller name"));
             goto cleanup;
         }
 
@@ -5817,45 +5818,45 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def,
                                                            &storageController);
         VBOX_UTF16_FREE(storageControllerName);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get storage controller by name"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get storage controller by name"));
             goto cleanup;
         }
 
         rc = gVBoxAPI.UIStorageController.GetBus(storageController, &storageBus);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get storage controller bus"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get storage controller bus"));
             VBOX_RELEASE(storageController);
             goto cleanup;
         }
 
         rc = gVBoxAPI.UIMediumAttachment.GetType(imediumattach, &deviceType);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get medium attachment type"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get medium attachment type"));
             VBOX_RELEASE(storageController);
             goto cleanup;
         }
         rc = gVBoxAPI.UIMediumAttachment.GetPort(imediumattach, &devicePort);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get medium attachment port"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get medium attachment port"));
             VBOX_RELEASE(storageController);
             goto cleanup;
         }
         rc = gVBoxAPI.UIMediumAttachment.GetDevice(imediumattach, &deviceSlot);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get medium attachment slot"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get medium attachment slot"));
             VBOX_RELEASE(storageController);
             goto cleanup;
         }
 
         rc = gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &disk);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get medium"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get medium"));
             VBOX_RELEASE(storageController);
             goto cleanup;
         }
@@ -5877,16 +5878,16 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def,
         handle = gVBoxAPI.UArray.handleMediumGetChildren(disk);
         rc = gVBoxAPI.UArray.vboxArrayGet(&children, disk, handle);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("cannot get children disk"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("cannot get children disk"));
             goto cleanup;
         }
         handle = gVBoxAPI.UArray.handleMediumGetSnapshotIds(disk);
         rc = gVBoxAPI.UArray.vboxArrayGetWithIIDArg(&snapshotIids, disk,
                                                     handle, &domiid);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("cannot get snapshot ids"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("cannot get snapshot ids"));
             goto cleanup;
         }
         for (j = 0; j < children.count; ++j) {
@@ -5898,8 +5899,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *def,
                 if (STREQ(diskSnapIdStr, snapshotUuidStr)) {
                     rc = gVBoxAPI.UIMedium.GetLocation(child, &childLocUtf16);
                     if (NS_FAILED(rc)) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                                       _("cannot get disk location"));
+                        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                        _("cannot get disk location"));
                         VBOX_RELEASE(storageController);
                         VBOX_RELEASE(disk);
                         VBOX_RELEASE(child);
@@ -5970,8 +5971,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
 
     rc = gVBoxAPI.UISnapshot.GetMachine(snap, &snapMachine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot get machine"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot get machine"));
         goto cleanup;
     }
     /*
@@ -5981,8 +5982,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
     rc = gVBoxAPI.UArray.vboxArrayGet(&mediumAttachments, snapMachine,
                                       gVBoxAPI.UArray.handleMachineGetMediumAttachments(snapMachine));
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot get medium attachments"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot get medium attachments"));
         goto cleanup;
     }
     /* get the number of attachments */
@@ -5993,8 +5994,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
 
             rc = gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &medium);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("cannot get medium"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("cannot get medium"));
                 goto cleanup;
             }
             if (medium) {
@@ -6029,8 +6030,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
             continue;
         rc = gVBoxAPI.UIMediumAttachment.GetController(imediumattach, &storageControllerName);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get storage controller name"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get storage controller name"));
             goto cleanup;
         }
         if (!storageControllerName)
@@ -6040,35 +6041,35 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
                                                            &storageController);
         VBOX_UTF16_FREE(storageControllerName);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get storage controller"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get storage controller"));
             goto cleanup;
         }
         if (!storageController)
             continue;
         rc = gVBoxAPI.UIStorageController.GetBus(storageController, &storageBus);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get storage controller bus"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get storage controller bus"));
             goto cleanup;
         }
         rc = gVBoxAPI.UIMediumAttachment.GetPort(imediumattach, &devicePort);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get medium attachment port"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get medium attachment port"));
             goto cleanup;
         }
         rc = gVBoxAPI.UIMediumAttachment.GetDevice(imediumattach, &deviceSlot);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get device slot"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get device slot"));
             goto cleanup;
         }
 
         rc = gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &disk);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get medium"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get medium"));
             goto cleanup;
         }
 
@@ -6088,8 +6089,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
 
         rc = gVBoxAPI.UIMedium.GetLocation(disk, &mediumLocUtf16);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get disk location"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get disk location"));
             goto cleanup;
         }
         VBOX_UTF16_TO_UTF8(mediumLocUtf16, &mediumLocUtf8);
@@ -6099,8 +6100,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
         VBOX_UTF8_FREE(mediumLocUtf8);
         rc = gVBoxAPI.UIMedium.GetReadOnly(disk, &readOnly);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot get read only attribute"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Cannot get read only attribute"));
             goto cleanup;
         }
 
@@ -6109,9 +6110,9 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
                                                                deviceSlot,
                                                                sdCount);
         if (!defdom->disks[diskCount]->dst) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not generate medium name for the disk "
-                             "at: port:%d, slot:%d"), devicePort, deviceSlot);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Could not generate medium name for the disk "
+                              "at: port:%d, slot:%d"), devicePort, deviceSlot);
             ret = -1;
             goto cleanup;
         }
@@ -6131,8 +6132,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *def,
 
         rc = gVBoxAPI.UIMediumAttachment.GetType(imediumattach, &deviceType);
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("cannot get medium attachment type"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("cannot get medium attachment type"));
             goto cleanup;
         }
         if (deviceType == DeviceType_HardDisk)
@@ -6232,9 +6233,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UISnapshot.GetDescription(snap, &str16);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get description of snapshot %s"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get description of snapshot %s"),
+                        snapshot->name);
         goto cleanup;
     }
     if (str16) {
@@ -6246,9 +6247,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UISnapshot.GetTimeStamp(snap, &timestamp);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get creation time of snapshot %s"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get creation time of snapshot %s"),
+                        snapshot->name);
         goto cleanup;
     }
     /* timestamp is in milliseconds while creationTime in seconds */
@@ -6256,17 +6257,17 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UISnapshot.GetParent(snap, &parent);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get parent of snapshot %s"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get parent of snapshot %s"),
+                        snapshot->name);
         goto cleanup;
     }
     if (parent) {
         rc = gVBoxAPI.UISnapshot.GetName(parent, &str16);
         if (NS_FAILED(rc) || !str16) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("could not get name of parent of snapshot %s"),
-                           snapshot->name);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("could not get name of parent of snapshot %s"),
+                            snapshot->name);
             goto cleanup;
         }
         VBOX_UTF16_TO_UTF8(str16, &str8);
@@ -6277,9 +6278,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UISnapshot.GetOnline(snap, &online);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get online state of snapshot %s"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get online state of snapshot %s"),
+                        snapshot->name);
         goto cleanup;
     }
     if (online)
@@ -6325,9 +6326,9 @@ static int vboxDomainSnapshotNum(virDomainPtr dom, unsigned int flags)
 
     rc = gVBoxAPI.UIMachine.GetSnapshotCount(machine, &snapshotCount);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get snapshot count for domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get snapshot count for domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
@@ -6375,9 +6376,9 @@ static int vboxDomainSnapshotListNames(virDomainPtr dom, char **names,
         snapshots = g_new0(ISnapshot *, 1);
         rc = gVBoxAPI.UIMachine.FindSnapshot(machine, &empty, snapshots);
         if (NS_FAILED(rc) || !snapshots[0]) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("could not get root snapshot for domain %s"),
-                           dom->name);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("could not get root snapshot for domain %s"),
+                            dom->name);
             goto cleanup;
         }
         count = 1;
@@ -6395,8 +6396,8 @@ static int vboxDomainSnapshotListNames(virDomainPtr dom, char **names,
 
         rc = gVBoxAPI.UISnapshot.GetName(snapshots[i], &nameUtf16);
         if (NS_FAILED(rc) || !nameUtf16) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("could not get snapshot name"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("could not get snapshot name"));
             goto cleanup;
         }
         VBOX_UTF16_TO_UTF8(nameUtf16, &name);
@@ -6469,8 +6470,8 @@ static int vboxDomainHasCurrentSnapshot(virDomainPtr dom,
 
     rc = gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &snapshot);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get current snapshot"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get current snapshot"));
         goto cleanup;
     }
 
@@ -6513,23 +6514,23 @@ vboxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UISnapshot.GetParent(snap, &parent);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get parent of snapshot %s"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get parent of snapshot %s"),
+                        snapshot->name);
         goto cleanup;
     }
     if (!parent) {
-        virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
-                       _("snapshot '%s' does not have a parent"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+                        _("snapshot '%s' does not have a parent"),
+                        snapshot->name);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UISnapshot.GetName(parent, &nameUtf16);
     if (NS_FAILED(rc) || !nameUtf16) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get name of parent of snapshot %s"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get name of parent of snapshot %s"),
+                        snapshot->name);
         goto cleanup;
     }
     VBOX_UTF16_TO_UTF8(nameUtf16, &name);
@@ -6568,21 +6569,21 @@ vboxDomainSnapshotCurrent(virDomainPtr dom, unsigned int flags)
 
     rc = gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &snapshot);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get current snapshot"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get current snapshot"));
         goto cleanup;
     }
 
     if (!snapshot) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("domain has no snapshots"));
+        vboxReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                        _("domain has no snapshots"));
         goto cleanup;
     }
 
     rc = gVBoxAPI.UISnapshot.GetName(snapshot, &nameUtf16);
     if (NS_FAILED(rc) || !nameUtf16) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get current snapshot name"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get current snapshot name"));
         goto cleanup;
     }
 
@@ -6626,8 +6627,8 @@ static int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &current);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get current snapshot"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get current snapshot"));
         goto cleanup;
     }
     if (!current) {
@@ -6637,8 +6638,8 @@ static int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UISnapshot.GetName(current, &nameUtf16);
     if (NS_FAILED(rc) || !nameUtf16) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get current snapshot name"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get current snapshot name"));
         goto cleanup;
     }
 
@@ -6715,30 +6716,30 @@ static int vboxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UISnapshot.GetOnline(newSnapshot, &online);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get online state of snapshot %s"),
-                       snapshot->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get online state of snapshot %s"),
+                        snapshot->name);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &prevSnapshot);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not get current snapshot of domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not get current snapshot of domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIMachine.GetState(machine, &state);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get domain state"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get domain state"));
         goto cleanup;
     }
 
     if (gVBoxAPI.machineStateChecker.Online(state)) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("cannot revert snapshot of running domain"));
+        vboxReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                        _("cannot revert snapshot of running domain"));
         goto cleanup;
     }
 
@@ -6774,19 +6775,19 @@ vboxDomainSnapshotDeleteSingle(struct _vboxDriver *data,
     VBOX_IID_INITIALIZE(&iid);
     rc = gVBoxAPI.UISnapshot.GetId(snapshot, &iid);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get snapshot UUID"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get snapshot UUID"));
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIConsole.DeleteSnapshot(console, &iid, &progress);
     if (NS_FAILED(rc) || !progress) {
         if (rc == VBOX_E_INVALID_VM_STATE) {
-            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                           _("cannot delete domain snapshot for running domain"));
+            vboxReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                            _("cannot delete domain snapshot for running domain"));
         } else {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("could not delete snapshot"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("could not delete snapshot"));
         }
         goto cleanup;
     }
@@ -6794,8 +6795,8 @@ vboxDomainSnapshotDeleteSingle(struct _vboxDriver *data,
     gVBoxAPI.UIProgress.WaitForCompletion(progress, -1);
     gVBoxAPI.UIProgress.GetResultCode(progress, &result);
     if (RC_FAILED(result)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not delete snapshot"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not delete snapshot"));
         goto cleanup;
     }
 
@@ -6820,8 +6821,8 @@ vboxDomainSnapshotDeleteTree(struct _vboxDriver *data,
     rc = gVBoxAPI.UArray.vboxArrayGet(&children, snapshot,
                   gVBoxAPI.UArray.handleSnapshotGetChildren(snapshot));
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get children snapshots"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get children snapshots"));
         goto cleanup;
     }
 
@@ -6885,16 +6886,16 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
 
     defXml = vboxDomainSnapshotGetXMLDesc(snapshot, 0);
     if (!defXml) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to get XML Desc of snapshot"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to get XML Desc of snapshot"));
         goto cleanup;
     }
     def = virDomainSnapshotDefParseString(defXml,
                                           data->xmlopt, NULL, NULL,
                                           VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE);
     if (!def) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to get a virDomainSnapshotDef *"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to get a virDomainSnapshotDef *"));
         goto cleanup;
     }
 
@@ -6902,8 +6903,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
         goto cleanup;
     rc = gVBoxAPI.UIMachine.GetSettingsFilePath(machine, &settingsFilePathUtf16);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot get settings file path"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot get settings file path"));
         goto cleanup;
     }
     VBOX_UTF16_TO_UTF8(settingsFilePathUtf16, &settingsFilepath);
@@ -6911,29 +6912,29 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
     /* Getting the machine name to retrieve the machine location path. */
     rc = gVBoxAPI.UIMachine.GetName(machine, &machineNameUtf16);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot get machine name"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot get machine name"));
         goto cleanup;
     }
     VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
     nameTmpUse = g_strdup_printf("%s.vbox", machineName);
     machineLocationPath = virStringReplace(settingsFilepath, nameTmpUse, "");
     if (machineLocationPath == NULL) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to get the machine location path"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to get the machine location path"));
         goto cleanup;
     }
     snapshotMachineDesc = virVBoxSnapshotConfLoadVboxFile(settingsFilepath, machineLocationPath);
     if (!snapshotMachineDesc) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("cannot create a vboxSnapshotXmlPtr"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot create a vboxSnapshotXmlPtr"));
         goto cleanup;
     }
 
     isCurrent = virVBoxSnapshotConfIsCurrentSnapshot(snapshotMachineDesc, def->parent.name);
     if (isCurrent < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to know if the snapshot is the current snapshot"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to know if the snapshot is the current snapshot"));
         goto cleanup;
     }
     if (isCurrent) {
@@ -6966,13 +6967,13 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                 readOnly = virVBoxSnapshotConfHardDiskPtrByLocation(snapshotMachineDesc,
                                                  def->parent.dom->disks[it]->src->path);
                 if (!readOnly) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                                   _("Cannot get hard disk by location"));
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("Cannot get hard disk by location"));
                     goto cleanup;
                 }
                 if (readOnly->parent == NULL) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                                   _("The read only disk has no parent"));
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("The read only disk has no parent"));
                     goto cleanup;
                 }
 
@@ -6983,17 +6984,17 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                                                       AccessMode_ReadWrite,
                                                       &medium);
                 if (NS_FAILED(rc)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to open HardDisk, rc=%08x"),
-                                   (unsigned)rc);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to open HardDisk, rc=%08x"),
+                                    (unsigned)rc);
                     goto cleanup;
                 }
 
                 rc = gVBoxAPI.UIMedium.GetId(medium, &parentiid);
                 if (NS_FAILED(rc)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to get hardDisk Id, rc=%08x"),
-                                   (unsigned)rc);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to get hardDisk Id, rc=%08x"),
+                                    (unsigned)rc);
                     goto cleanup;
                 }
                 gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid);
@@ -7009,9 +7010,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                                                           newLocation,
                                                           &newMedium);
                 if (NS_FAILED(rc)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to create HardDisk, rc=%08x"),
-                                   (unsigned)rc);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to create HardDisk, rc=%08x"),
+                                    (unsigned)rc);
                     goto cleanup;
                 }
                 VBOX_UTF16_FREE(formatUtf16);
@@ -7023,9 +7024,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                 gVBoxAPI.UIProgress.WaitForCompletion(progress, -1);
                 gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode);
                 if (RC_FAILED(resultCode)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Error while creating diff storage, rc=%08x"),
-                                   resultCode.uResultCode);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Error while creating diff storage, rc=%08x"),
+                                    resultCode.uResultCode);
                     goto cleanup;
                 }
                 VBOX_RELEASE(progress);
@@ -7038,9 +7039,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
 
                 rc = gVBoxAPI.UIMedium.GetId(newMedium, &iid);
                 if (NS_FAILED(rc)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to get medium uuid, rc=%08x"),
-                                   (unsigned)rc);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to get medium uuid, rc=%08x"),
+                                    (unsigned)rc);
                     VIR_FREE(disk);
                     goto cleanup;
                 }
@@ -7058,8 +7059,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                 if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(disk,
                                                snapshotMachineDesc->mediaRegistry,
                                                parentUuid) < 0) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                                   _("Unable to add hard disk to the media registry"));
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("Unable to add hard disk to the media registry"));
                     goto cleanup;
                 }
                 /* Adding fake disks to the machine storage controllers */
@@ -7069,8 +7070,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                                              it + 1,
                                              &searchResultTab);
                 if (resultSize != it + 1) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to find UUID %s"), searchResultTab[it]);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to find UUID %s"), searchResultTab[it]);
                     goto cleanup;
                 }
 
@@ -7086,9 +7087,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                 /* Closing the "fake" disk */
                 rc = gVBoxAPI.UIMedium.Close(newMedium);
                 if (NS_FAILED(rc)) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to close the new medium, rc=%08x"),
-                                   (unsigned)rc);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to close the new medium, rc=%08x"),
+                                    (unsigned)rc);
                     goto cleanup;
                 }
             }
@@ -7099,9 +7100,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                 uuidRO = virVBoxSnapshotConfHardDiskUuidByLocation(snapshotMachineDesc,
                                                       def->parent.dom->disks[it]->src->path);
                 if (!uuidRO) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("No such disk in media registry %s"),
-                                   def->parent.dom->disks[it]->src->path);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("No such disk in media registry %s"),
+                                    def->parent.dom->disks[it]->src->path);
                     goto cleanup;
                 }
 
@@ -7110,9 +7111,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                                              it + 1,
                                              &searchResultTab);
                 if (resultSize != it + 1) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
-                                   _("Unable to find UUID %s"),
-                                   searchResultTab[it]);
+                    vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("Unable to find UUID %s"),
+                                    searchResultTab[it]);
                     goto cleanup;
                 }
 
@@ -7134,13 +7135,13 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
             virVBoxSnapshotConfHardDiskUuidByLocation(snapshotMachineDesc,
                                                       def->disks[it].src->path);
         if (!uuidRW) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unable to find UUID for location %s"), def->disks[it].src->path);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unable to find UUID for location %s"), def->disks[it].src->path);
             goto cleanup;
         }
         if (virVBoxSnapshotConfRemoveHardDisk(snapshotMachineDesc->mediaRegistry, uuidRW) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unable to remove disk from media registry. uuid = %s"), uuidRW);
+            vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unable to remove disk from media registry. uuid = %s"), uuidRW);
             goto cleanup;
         }
     }
@@ -7151,13 +7152,13 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                 virVBoxSnapshotConfHardDiskUuidByLocation(snapshotMachineDesc,
                                                           def->parent.dom->disks[it]->src->path);
             if (!uuidRO) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to find UUID for location %s"), def->parent.dom->disks[it]->src->path);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to find UUID for location %s"), def->parent.dom->disks[it]->src->path);
                 goto cleanup;
             }
             if (virVBoxSnapshotConfRemoveHardDisk(snapshotMachineDesc->mediaRegistry, uuidRO) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to remove disk from media registry. uuid = %s"), uuidRO);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to remove disk from media registry. uuid = %s"), uuidRO);
                 goto cleanup;
             }
         }
@@ -7167,9 +7168,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
                                        &aMediaSize,
                                        &aMedia);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to unregister machine, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to unregister machine, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
     VBOX_RELEASE(machine);
@@ -7189,17 +7190,17 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
             resultCodeUnion resultCode;
             rc = gVBoxAPI.UIMedium.DeleteStorage(medium, &progress);
             if (NS_FAILED(rc)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unable to delete medium, rc=%08x"),
-                               (unsigned)rc);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to delete medium, rc=%08x"),
+                                (unsigned)rc);
                 goto cleanup;
             }
             gVBoxAPI.UIProgress.WaitForCompletion(progress, -1);
             gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode);
             if (RC_FAILED(resultCode)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Error while closing medium, rc=%08x"),
-                               resultCode.uResultCode);
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Error while closing medium, rc=%08x"),
+                                resultCode.uResultCode);
                 goto cleanup;
             }
             VBOX_RELEASE(progress);
@@ -7218,8 +7219,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
 
     /* removing the snapshot */
     if (virVBoxSnapshotConfRemoveSnapshot(snapshotMachineDesc, def->parent.name) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to remove snapshot %s"), def->parent.name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to remove snapshot %s"), def->parent.name);
         goto cleanup;
     }
 
@@ -7228,8 +7229,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
         if (def->parent.parent_name != NULL) {
             virVBoxSnapshotConfSnapshot *snap = virVBoxSnapshotConfSnapshotByName(snapshotMachineDesc->snapshot, def->parent.parent_name);
             if (!snap) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to get the snapshot to remove"));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to get the snapshot to remove"));
                 goto cleanup;
             }
             snapshotMachineDesc->currentSnapshot = g_strdup(snap->uuid);
@@ -7238,25 +7239,25 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
 
     /* Registering the machine */
     if (virVBoxSnapshotConfSaveVboxFile(snapshotMachineDesc, settingsFilepath) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to serialize the machine description"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Unable to serialize the machine description"));
         goto cleanup;
     }
     rc = gVBoxAPI.UIVirtualBox.OpenMachine(data->vboxObj,
                                            settingsFilePathUtf16,
                                            &machine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to open Machine, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to open Machine, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unable to register Machine, rc=%08x"),
-                       (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to register Machine, rc=%08x"),
+                        (unsigned)rc);
         goto cleanup;
     }
 
@@ -7305,8 +7306,8 @@ static int vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
 
     rc = gVBoxAPI.UIMachine.GetState(machine, &state);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("could not get domain state"));
+        vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not get domain state"));
         goto cleanup;
     }
 
@@ -7317,13 +7318,13 @@ static int vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
         rc = gVBoxAPI.UArray.vboxArrayGet(&snapChildren, snap,
                              gVBoxAPI.UArray.handleSnapshotGetChildren(snap));
         if (NS_FAILED(rc)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("could not get snapshot children"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("could not get snapshot children"));
             goto cleanup;
         }
         if (snapChildren.count != 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("cannot delete metadata of a snapshot with children"));
+            vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("cannot delete metadata of a snapshot with children"));
             goto cleanup;
         } else if (gVBoxAPI.vboxSnapshotRedefine) {
             ret = vboxDomainSnapshotDeleteMetadataOnly(snapshot);
@@ -7332,8 +7333,8 @@ static int vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
     }
 
     if (gVBoxAPI.machineStateChecker.Online(state)) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("cannot delete snapshots of running domain"));
+        vboxReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                        _("cannot delete snapshots of running domain"));
         goto cleanup;
     }
 
@@ -7341,9 +7342,9 @@ static int vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
     if (NS_SUCCEEDED(rc))
         rc = gVBoxAPI.UISession.GetConsole(data->vboxSession, &console);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("could not open VirtualBox session with domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("could not open VirtualBox session with domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
@@ -7388,16 +7389,16 @@ vboxDomainScreenshot(virDomainPtr dom,
 
     rc = gVBoxAPI.UIMachine.GetMonitorCount(machine, &max_screen);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("unable to get monitor count"));
+        vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("unable to get monitor count"));
         VBOX_RELEASE(machine);
         return NULL;
     }
 
     if (screen >= max_screen) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("screen ID higher than monitor "
-                         "count (%d)"), max_screen);
+        vboxReportError(VIR_ERR_INVALID_ARG,
+                        _("screen ID higher than monitor "
+                          "count (%d)"), max_screen);
         VBOX_RELEASE(machine);
         return NULL;
     }
@@ -7437,8 +7438,8 @@ vboxDomainScreenshot(virDomainPtr dom,
                                                             &xOrigin, &yOrigin);
 
                 if (NS_FAILED(rc) || !width || !height) {
-                    virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                                   _("unable to get screen resolution"));
+                    vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                                    _("unable to get screen resolution"));
                     goto endjob;
                 }
 
@@ -7447,8 +7448,8 @@ vboxDomainScreenshot(virDomainPtr dom,
                                                                  &screenDataSize,
                                                                  &screenData);
                 if (NS_FAILED(rc)) {
-                    virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                                   _("failed to take screenshot"));
+                    vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                                    _("failed to take screenshot"));
                     goto endjob;
                 }
 
@@ -7467,8 +7468,8 @@ vboxDomainScreenshot(virDomainPtr dom,
                 ret = g_strdup("image/png");
 
                 if (virFDStreamOpenFile(st, tmp, 0, 0, O_RDONLY) < 0) {
-                    virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                                   _("unable to open stream"));
+                    vboxReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                                    _("unable to open stream"));
                     VIR_FREE(ret);
                 }
  endjob:
@@ -7534,8 +7535,8 @@ vboxConnectListAllDomains(virConnectPtr conn,
 
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of domains, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of domains, rc=%08x"), (unsigned)rc);
         goto cleanup;
     }
 
@@ -7572,8 +7573,8 @@ vboxConnectListAllDomains(virConnectPtr conn,
       if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT)) {
           rc = gVBoxAPI.UIMachine.GetSnapshotCount(machine, &snapshotCount);
           if (NS_FAILED(rc)) {
-              virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("could not get snapshot count for listed domains"));
+              vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                              _("could not get snapshot count for listed domains"));
               goto cleanup;
           }
           if (!((MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) &&
@@ -7734,8 +7735,8 @@ vboxDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
     VBOX_IID_INITIALIZE(&iid);
     rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES);
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+        vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not get list of machines, rc=%08x"), (unsigned)rc);
         return ret;
     }
 
@@ -7818,11 +7819,11 @@ vboxDomainSendKey(virDomainPtr dom,
             keycode = virKeycodeValueTranslate(codeset, VIR_KEYCODE_SET_XT,
                                                keyDownCodes[i]);
             if (keycode < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("cannot translate keycode %u of %s codeset to"
-                                 " xt keycode"),
-                                 keyDownCodes[i],
-                                 virKeycodeSetTypeToString(codeset));
+                vboxReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot translate keycode %u of %s codeset to"
+                                  " xt keycode"),
+                                keyDownCodes[i],
+                                virKeycodeSetTypeToString(codeset));
                 goto cleanup;
             }
             keyDownCodes[i] = keycode;
@@ -7837,27 +7838,27 @@ vboxDomainSendKey(virDomainPtr dom,
     rc = gVBoxAPI.UISession.OpenExisting(data, &iid, machine);
 
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Unable to open VirtualBox session with domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_OPERATION_FAILED,
+                        _("Unable to open VirtualBox session with domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UISession.GetConsole(data->vboxSession, &console);
 
     if (NS_FAILED(rc) || !console) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Unable to get Console object for domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_OPERATION_FAILED,
+                        _("Unable to get Console object for domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
     rc = gVBoxAPI.UIConsole.GetKeyboard(console, &keyboard);
 
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Unable to get Keyboard object for domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_OPERATION_FAILED,
+                        _("Unable to get Keyboard object for domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
@@ -7865,9 +7866,9 @@ vboxDomainSendKey(virDomainPtr dom,
                                           &codesStored);
 
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Unable to send keyboard scancodes for domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_OPERATION_FAILED,
+                        _("Unable to send keyboard scancodes for domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
@@ -7880,9 +7881,9 @@ vboxDomainSendKey(virDomainPtr dom,
                                           &codesStored);
 
     if (NS_FAILED(rc)) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Unable to send keyboard scan codes to domain %s"),
-                       dom->name);
+        vboxReportError(VIR_ERR_OPERATION_FAILED,
+                        _("Unable to send keyboard scan codes to domain %s"),
+                        dom->name);
         goto cleanup;
     }
 
-- 
2.39.1



More information about the libvir-list mailing list