diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 2d78252775..8220289527 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -67,7 +67,7 @@ static __thread bool vboxDriverDisposed; vboxReportErrorHelper(data, errcode, __FILE__, \ __FUNCTION__, __LINE__, __VA_ARGS__) -static void G_GNUC_PRINTF(6, 7) G_GNUC_UNUSED +static void G_GNUC_PRINTF(6, 7) vboxReportErrorHelper(struct _vboxDriver *data, int errcode, const char *filename, @@ -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; } } @@ -1980,39 +1980,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); @@ -2021,19 +2021,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); } @@ -2041,8 +2041,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; } @@ -2085,8 +2085,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; } @@ -2142,8 +2142,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) &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); } 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; } @@ -3290,8 +3290,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; } @@ -3330,17 +3330,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; } @@ -3348,44 +3348,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; } @@ -3395,8 +3395,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; } } @@ -3405,9 +3405,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; } @@ -3461,8 +3461,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; } @@ -3483,8 +3483,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; } @@ -4222,9 +4222,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; } @@ -4275,9 +4275,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; } @@ -4367,9 +4367,9 @@ 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; @@ -4382,7 +4382,7 @@ 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; } } @@ -4485,9 +4485,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; } @@ -4498,7 +4498,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; } } @@ -4542,15 +4542,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++) { @@ -4560,15 +4560,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); @@ -4576,9 +4576,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; } @@ -4666,8 +4666,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); @@ -4675,8 +4675,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); @@ -4684,16 +4684,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) { @@ -4709,8 +4709,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, @@ -4720,9 +4720,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++) { @@ -4743,9 +4743,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; } @@ -4753,8 +4753,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); @@ -4762,8 +4762,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); @@ -4789,16 +4789,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; } } @@ -4834,8 +4834,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. */ @@ -4849,9 +4849,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; } @@ -4859,8 +4859,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); @@ -4868,8 +4868,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; } @@ -4879,17 +4879,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; } @@ -4898,9 +4898,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; @@ -4913,9 +4913,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; } @@ -4927,9 +4927,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); @@ -4947,8 +4947,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); @@ -4959,18 +4959,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; } @@ -4992,8 +4992,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; } } @@ -5053,8 +5053,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; } /* @@ -5093,9 +5093,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; } } @@ -5126,9 +5126,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); @@ -5137,8 +5137,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; } @@ -5151,8 +5151,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; } @@ -5162,8 +5162,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; } @@ -5174,8 +5174,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; } @@ -5188,8 +5188,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; } @@ -5206,9 +5206,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; } } @@ -5240,9 +5240,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; } @@ -5250,9 +5250,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); @@ -5269,9 +5269,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; } @@ -5281,9 +5281,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); @@ -5296,9 +5296,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); @@ -5315,8 +5315,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 */ @@ -5327,8 +5327,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; } @@ -5344,9 +5344,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; } } @@ -5361,8 +5361,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) { @@ -5393,16 +5393,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); @@ -5411,25 +5411,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; } @@ -5504,8 +5504,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; } @@ -5518,9 +5518,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; } @@ -5532,24 +5532,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; } @@ -5571,6 +5571,7 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, IMachine *machine, ISnapshot ***snapshots) { + struct _vboxDriver *data = dom->conn->privateData; vboxIID empty; ISnapshot **list = NULL; PRUint32 count; @@ -5581,9 +5582,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; } @@ -5594,9 +5595,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; } @@ -5607,16 +5608,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++) { @@ -5624,8 +5625,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; } @@ -5669,8 +5670,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); @@ -5684,9 +5685,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; } @@ -5732,8 +5733,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; } @@ -5741,16 +5742,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 */ @@ -5761,8 +5762,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) { @@ -5801,8 +5802,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; } @@ -5811,45 +5812,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; } @@ -5871,16 +5872,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) { @@ -5892,8 +5893,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); @@ -5964,8 +5965,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; } /* @@ -5975,8 +5976,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 */ @@ -5987,8 +5988,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) { @@ -6023,8 +6024,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) @@ -6034,35 +6035,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; } @@ -6082,8 +6083,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); @@ -6093,8 +6094,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; } @@ -6103,9 +6104,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; } @@ -6125,8 +6126,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) @@ -6226,9 +6227,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) { @@ -6240,9 +6241,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, rc = gVBoxAPI.UISnapshot.GetTimeStamp(snap, ×tamp); 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 */ @@ -6250,17 +6251,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); @@ -6271,9 +6272,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) @@ -6319,9 +6320,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; } @@ -6369,9 +6370,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; @@ -6389,8 +6390,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); @@ -6463,8 +6464,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; } @@ -6507,23 +6508,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); @@ -6562,21 +6563,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; } @@ -6620,8 +6621,8 @@ static int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, rc = gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, ¤t); 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) { @@ -6631,8 +6632,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; } @@ -6709,30 +6710,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; } @@ -6768,19 +6769,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; } @@ -6788,8 +6789,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; } @@ -6814,8 +6815,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; } @@ -6879,16 +6880,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; } @@ -6896,8 +6897,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); @@ -6905,29 +6906,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) { @@ -6960,13 +6961,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; } @@ -6977,17 +6978,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); @@ -7003,9 +7004,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); @@ -7017,9 +7018,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); @@ -7032,9 +7033,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; } @@ -7052,8 +7053,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 */ @@ -7063,8 +7064,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; } @@ -7080,9 +7081,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; } } @@ -7093,9 +7094,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; } @@ -7104,9 +7105,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; } @@ -7128,13 +7129,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; } } @@ -7145,13 +7146,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; } } @@ -7161,9 +7162,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); @@ -7183,17 +7184,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); @@ -7212,8 +7213,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; } @@ -7222,8 +7223,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); @@ -7232,25 +7233,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; } @@ -7299,8 +7300,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; } @@ -7311,13 +7312,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); @@ -7326,8 +7327,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; } @@ -7335,9 +7336,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; } @@ -7382,16 +7383,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; } @@ -7431,8 +7432,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; } @@ -7441,8 +7442,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; } @@ -7461,8 +7462,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: @@ -7528,8 +7529,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; } @@ -7566,8 +7567,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) && @@ -7728,8 +7729,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; } @@ -7812,11 +7813,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; @@ -7831,27 +7832,27 @@ vboxDomainSendKey(virDomainPtr dom, rc = gVBoxAPI.UISession.OpenExisting(data, 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; } @@ -7859,9 +7860,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; } @@ -7874,9 +7875,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; }