#endif /* VBOX_API_VERSION >= 3001 */
-#define vboxError(code, ...) \
- virReportErrorHelper(VIR_FROM_VBOX, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
#define DEBUGPRUnichar(msg, strUtf16) \
if (strUtf16) {\
char *strUtf8 = NULL;\
data->pFuncs->pfnGetEventQueue(&data->vboxQueue);
if (data->vboxQueue == NULL) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("nsIEventQueue object is null"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("nsIEventQueue object is null"));
goto cleanup;
}
#endif /* !(VBOX_XPCOMC_VERSION == 0x00010000U) */
if (data->vboxObj == NULL) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("IVirtualBox object is null"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("IVirtualBox object is null"));
goto cleanup;
}
if (data->vboxSession == NULL) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("ISession object is null"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("ISession object is null"));
goto cleanup;
}
}
if (ret != 0)
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not extract VirtualBox version"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not extract VirtualBox version"));
return ret;
}
return VIR_DRV_OPEN_DECLINED;
if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("no VirtualBox driver path specified (try vbox:///session)"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("no VirtualBox driver path specified (try vbox:///session)"));
return VIR_DRV_OPEN_ERROR;
}
if (uid != 0) {
if (STRNEQ (conn->uri->path, "/session")) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
} else { /* root */
if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of Domains, rc=%08x"),(unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of Domains, rc=%08x"),(unsigned)rc);
goto cleanup;
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get number of Domains, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get number of Domains, rc=%08x"), (unsigned)rc);
goto cleanup;
}
/* Internal vbox IDs start from 0, the public libvirt ID
* starts from 1, so refuse id==0, and adjust the rest*/
if (id == 0) {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), id);
return NULL;
}
id = id - 1;
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of machines, rc=%08x"), (unsigned)rc);
return NULL;
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of machines, rc=%08x"), (unsigned)rc);
return NULL;
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of machines, rc=%08x"), (unsigned)rc);
return NULL;
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of machines, rc=%08x"), (unsigned)rc);
return ret;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
VBOX_RELEASE(console);
ret = 0;
} else {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("error while suspending the domain"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("error while suspending the domain"));
goto cleanup;
}
VBOX_SESSION_CLOSE();
} else {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("machine not in running state to suspend it"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("machine not in running state to suspend it"));
goto cleanup;
}
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
VBOX_RELEASE(console);
ret = 0;
} else {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("error while resuming the domain"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("error while resuming the domain"));
goto cleanup;
}
VBOX_SESSION_CLOSE();
} else {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("machine not paused, so can't resume it"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("machine not paused, so can't resume it"));
goto cleanup;
}
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
machine->vtbl->GetState(machine, &state);
if (state == MachineState_Paused) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("machine paused, so can't power it down"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("machine paused, so can't power it down"));
goto cleanup;
} else if (state == MachineState_PoweredOff) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("machine already powered down"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("machine already powered down"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
}
VBOX_SESSION_CLOSE();
} else {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("machine not running, so can't reboot it"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("machine not running, so can't reboot it"));
goto cleanup;
}
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
machine->vtbl->GetState(machine, &state);
if (state == MachineState_PoweredOff) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("machine already powered down"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("machine already powered down"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
machine->vtbl->GetState(machine, &state);
if (state != MachineState_PoweredOff) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("memory size can't be changed unless domain is powered down"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("memory size can't be changed unless domain is powered down"));
goto cleanup;
}
machine->vtbl->SaveSettings(machine);
ret = 0;
} else {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not set the memory size of the "
- "domain to: %lu Kb, rc=%08x"),
- memory, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not set the memory size of the "
+ "domain to: %lu Kb, rc=%08x"),
+ memory, (unsigned)rc);
}
}
VBOX_SESSION_CLOSE();
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of machines, rc=%08x"), (unsigned)rc);
goto cleanup;
}
vboxIIDFromUUID(&domiid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
/* Get machine for the call to VBOX_SESSION_OPEN_EXISTING */
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
return -1;
}
#endif
nsresult rc;
if (flags != VIR_DOMAIN_AFFECT_LIVE) {
- vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
return -1;
}
/* Get machine for the call to VBOX_SESSION_OPEN */
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
return -1;
}
#endif
machine->vtbl->SaveSettings(machine);
ret = 0;
} else {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not set the number of cpus of the domain "
- "to: %u, rc=%08x"),
- CPUCount, (unsigned)rc);
+ virReportError(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 {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
}
} else {
- vboxError(VIR_ERR_NO_DOMAIN,
- _("can't open session to the domain with id %d"), dom->id);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("can't open session to the domain with id %d"), dom->id);
}
VBOX_SESSION_CLOSE();
PRUint32 maxCPUCount = 0;
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
- vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
return -1;
}
maxPortPerInst,
maxSlotPerPort);
if (!def->disks[diskCount]->dst) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not generate medium name for the disk "
- "at: controller instance:%u, port:%d, slot:%d"),
- deviceInst, devicePort, deviceSlot);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not generate medium name for the disk "
+ "at: controller instance:%u, port:%d, slot:%d"),
+ deviceInst, devicePort, deviceSlot);
VBOX_RELEASE(medium);
VBOX_RELEASE(storageController);
error = true;
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of Defined Domains, rc=%08x"),
- (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of Defined Domains, rc=%08x"),
+ (unsigned)rc);
goto cleanup;
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get number of Defined Domains, rc=%08x"),
- (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get number of Defined Domains, rc=%08x"),
+ (unsigned)rc);
goto cleanup;
}
#endif /* VBOX_API_VERSION >= 4000 */
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("OpenRemoteSession/LaunchVMProcess failed, domain can't be started"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("OpenRemoteSession/LaunchVMProcess failed, domain can't be started"));
ret = -1;
} else {
PRBool completed = 0;
virCheckFlags(0, -1);
if (!dom->name) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Error while reading the domain name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Error while reading the domain name"));
goto cleanup;
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of machines, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of machines, rc=%08x"), (unsigned)rc);
goto cleanup;
}
(state == MachineState_Aborted) ) {
ret = vboxStartMachine(dom, i, machine, &iid);
} else {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("machine is not in poweroff|saved|"
- "aborted state, so couldn't start it"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("machine is not in poweroff|saved|"
+ "aborted state, so couldn't start it"));
ret = -1;
}
}
rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage,
&dvduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("can't get the uuid of the file to "
- "be attached to cdrom: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("can't get the uuid of the file to "
+ "be attached to cdrom: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
} else {
rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach the file to cdrom: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach the file to cdrom: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
} else {
DEBUGIID("CD/DVDImage UUID:", dvduuid.value);
}
rc = hardDisk->vtbl->imedium.GetId((IMedium *)hardDisk,
&hdduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("can't get the uuid of the file to be "
- "attached as harddisk: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("can't get the uuid of the file to be "
+ "attached as harddisk: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
} else {
if (def->disks[i]->readonly) {
hardDisk->vtbl->SetType(hardDisk,
VBOX_UTF16_FREE(hddcnameUtf16);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach the file as "
- "harddisk: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach the file as "
+ "harddisk: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
} else {
DEBUGIID("Attached HDD with UUID", hdduuid.value);
}
rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage,
&fduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("can't get the uuid of the file to "
- "be attached to floppy drive: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("can't get the uuid of the file to "
+ "be attached to floppy drive: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
} else {
rc = floppyDrive->vtbl->MountImage(floppyDrive,
fduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach the file to "
- "floppy drive: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach the file to "
+ "floppy drive: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
} else {
DEBUGIID("floppyImage UUID", fduuid.value);
}
}
if (!medium) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to attach the following disk/dvd/floppy "
- "to the machine: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to attach the following disk/dvd/floppy "
+ "to the machine: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
VBOX_UTF16_FREE(mediumFileUtf16);
continue;
}
rc = medium->vtbl->GetId(medium, &mediumUUID);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("can't get the uuid of the file to be attached "
- "as harddisk/dvd/floppy: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("can't get the uuid of the file to be attached "
+ "as harddisk/dvd/floppy: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
VBOX_RELEASE(medium);
VBOX_UTF16_FREE(mediumFileUtf16);
continue;
&deviceInst,
&devicePort,
&deviceSlot)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("can't get the port/slot number of harddisk/"
- "dvd/floppy to be attached: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("can't get the port/slot number of harddisk/"
+ "dvd/floppy to be attached: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
VBOX_RELEASE(medium);
VBOX_UTF16_FREE(mediumUUID);
VBOX_UTF16_FREE(mediumFileUtf16);
# endif /* VBOX_API_VERSION >= 4000 */
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach the file as harddisk/"
- "dvd/floppy: %s, rc=%08x"),
- def->disks[i]->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach the file as harddisk/"
+ "dvd/floppy: %s, rc=%08x"),
+ def->disks[i]->src, (unsigned)rc);
} else {
DEBUGIID("Attached HDD/DVD/Floppy with UUID", mediumUUID);
}
VBOX_UTF16_FREE(machineNameUtf16);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not define a domain, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not define a domain, rc=%08x"), (unsigned)rc);
goto cleanup;
}
rc = machine->vtbl->SetMemorySize(machine,
VIR_DIV_UP(def->mem.cur_balloon, 1024));
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not set the memory size of the domain to: %llu Kb, "
- "rc=%08x"),
- def->mem.cur_balloon, (unsigned)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);
}
if (def->vcpus != def->maxvcpus) {
- vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("current vcpu count must equal maximum"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("current vcpu count must equal maximum"));
}
rc = machine->vtbl->SetCPUCount(machine, def->maxvcpus);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not set the number of virtual CPUs to: %u, rc=%08x"),
- def->maxvcpus, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not set the number of virtual CPUs to: %u, rc=%08x"),
+ def->maxvcpus, (unsigned)rc);
}
#if VBOX_API_VERSION < 3001
(1 << VIR_DOMAIN_FEATURE_PAE));
#endif
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not change PAE status to: %s, rc=%08x"),
- ((def->features) & (1 << VIR_DOMAIN_FEATURE_PAE))
- ? _("Enabled") : _("Disabled"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not change PAE status to: %s, rc=%08x"),
+ ((def->features) & (1 << VIR_DOMAIN_FEATURE_PAE))
+ ? _("Enabled") : _("Disabled"), (unsigned)rc);
}
machine->vtbl->GetBIOSSettings(machine, &bios);
rc = bios->vtbl->SetACPIEnabled(bios, (def->features) &
(1 << VIR_DOMAIN_FEATURE_ACPI));
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not change ACPI status to: %s, rc=%08x"),
- ((def->features) & (1 << VIR_DOMAIN_FEATURE_ACPI))
- ? _("Enabled") : _("Disabled"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not change ACPI status to: %s, rc=%08x"),
+ ((def->features) & (1 << VIR_DOMAIN_FEATURE_ACPI))
+ ? _("Enabled") : _("Disabled"), (unsigned)rc);
}
rc = bios->vtbl->SetIOAPICEnabled(bios, (def->features) &
(1 << VIR_DOMAIN_FEATURE_APIC));
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not change APIC status to: %s, rc=%08x"),
- ((def->features) & (1 << VIR_DOMAIN_FEATURE_APIC))
- ? _("Enabled") : _("Disabled"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not change APIC status to: %s, rc=%08x"),
+ ((def->features) & (1 << VIR_DOMAIN_FEATURE_APIC))
+ ? _("Enabled") : _("Disabled"), (unsigned)rc);
}
VBOX_RELEASE(bios);
}
/* Register the machine before attaching other devices to it */
rc = data->vboxObj->vtbl->RegisterMachine(data->vboxObj, machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not define a domain, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not define a domain, rc=%08x"), (unsigned)rc);
goto cleanup;
}
#else /* VBOX_API_VERSION >= 4000 */
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
return -1;
}
#endif /* VBOX_API_VERSION >= 4000 */
ret = 0;
} else {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not delete the domain, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not delete the domain, rc=%08x"), (unsigned)rc);
}
#if VBOX_API_VERSION >= 4000
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (dvdImage) {
rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage, &dvduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("can't get the uuid of the file to "
- "be attached to cdrom: %s, rc=%08x"),
- dev->data.disk->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("can't get the uuid of the file to "
+ "be attached to cdrom: %s, rc=%08x"),
+ dev->data.disk->src, (unsigned)rc);
} else {
/* unmount the previous mounted image */
dvdDrive->vtbl->Unmount(dvdDrive);
rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach the file to cdrom: %s, rc=%08x"),
- dev->data.disk->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach the file to cdrom: %s, rc=%08x"),
+ dev->data.disk->src, (unsigned)rc);
} else {
ret = 0;
DEBUGIID("CD/DVD Image UUID:", dvduuid.value);
if (floppyImage) {
rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage, &fduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("can't get the uuid of the file to be "
- "attached to floppy drive: %s, rc=%08x"),
- dev->data.disk->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("can't get the uuid of the file to be "
+ "attached to floppy drive: %s, rc=%08x"),
+ dev->data.disk->src, (unsigned)rc);
} else {
rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach the file to floppy drive: %s, rc=%08x"),
- dev->data.disk->src, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach the file to floppy drive: %s, rc=%08x"),
+ dev->data.disk->src, (unsigned)rc);
} else {
ret = 0;
DEBUGIID("attached floppy, UUID:", fduuid.value);
#endif /* VBOX_API_VERSION >= 4000 */
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach shared folder '%s', rc=%08x"),
- dev->data.fs->dst, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach shared folder '%s', rc=%08x"),
+ dev->data.fs->dst, (unsigned)rc);
} else {
ret = 0;
}
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot modify the persistent configuration of a domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot modify the persistent configuration of a domain"));
return -1;
}
VIR_DOMAIN_AFFECT_CONFIG, -1);
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot modify the persistent configuration of a domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot modify the persistent configuration of a domain"));
return -1;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (dvdDrive) {
rc = dvdDrive->vtbl->Unmount(dvdDrive);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not de-attach the mounted ISO, rc=%08x"),
- (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not de-attach the mounted ISO, rc=%08x"),
+ (unsigned)rc);
} else {
ret = 0;
}
if (enabled) {
rc = floppyDrive->vtbl->Unmount(floppyDrive);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not attach the file "
- "to floppy drive, rc=%08x"),
- (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not attach the file "
+ "to floppy drive, rc=%08x"),
+ (unsigned)rc);
} else {
ret = 0;
}
rc = machine->vtbl->RemoveSharedFolder(machine, nameUtf16);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not detach shared folder '%s', rc=%08x"),
- dev->data.fs->dst, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not detach shared folder '%s', rc=%08x"),
+ dev->data.fs->dst, (unsigned)rc);
} else {
ret = 0;
}
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot modify the persistent configuration of a domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot modify the persistent configuration of a domain"));
return -1;
}
rc = machine->vtbl->GetSnapshotCount(machine, &count);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get snapshot count for domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get snapshot count for domain %s"),
+ dom->name);
goto error;
}
rc = machine->vtbl->FindSnapshot(machine, empty.value, list);
#endif /* VBOX_API_VERSION >= 4000 */
if (NS_FAILED(rc) || !list[0]) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get root snapshot for domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get root snapshot for domain %s"),
+ dom->name);
goto error;
}
unsigned int i;
if (!list[next]) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected number of snapshots < %u"), count);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected number of snapshots < %u"), count);
goto error;
}
rc = vboxArrayGet(&children, list[next],
list[next]->vtbl->GetChildren);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("could not get children snapshots"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("could not get children snapshots"));
goto error;
}
for (i = 0; i < children.count; i++) {
if (!child)
continue;
if (top == count) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected number of snapshots > %u"), count);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected number of snapshots > %u"), count);
vboxArrayRelease(&children);
goto error;
}
rc = snapshots[i]->vtbl->GetName(snapshots[i], &nameUtf16);
if (NS_FAILED(rc) || !nameUtf16) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("could not get snapshot name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("could not get snapshot name"));
goto cleanup;
}
VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
}
if (!snapshot) {
- vboxError(VIR_ERR_OPERATION_INVALID,
- _("domain %s has no snapshots with name %s"),
- dom->name, name);
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain %s has no snapshots with name %s"),
+ dom->name, name);
goto cleanup;
}
goto cleanup;
if (def->ndisks) {
- vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("disk snapshots not supported yet"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("disk snapshots not supported yet"));
goto cleanup;
}
vboxIIDFromUUID(&domiid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = machine->vtbl->GetState(machine, &state);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get domain state"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get domain state"));
goto cleanup;
}
if (NS_SUCCEEDED(rc))
rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not open VirtualBox session with domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not open VirtualBox session with domain %s"),
+ dom->name);
goto cleanup;
}
rc = console->vtbl->TakeSnapshot(console, name, description, &progress);
if (NS_FAILED(rc) || !progress) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not take snapshot of domain %s"), dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not take snapshot of domain %s"), dom->name);
goto cleanup;
}
progress->vtbl->WaitForCompletion(progress, -1);
progress->vtbl->GetResultCode(progress, &result);
if (NS_FAILED(result)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not take snapshot of domain %s"), dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not take snapshot of domain %s"), dom->name);
goto cleanup;
}
rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get current snapshot of domain %s"),
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get current snapshot of domain %s"),
dom->name);
goto cleanup;
}
vboxIIDFromUUID(&domiid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = snap->vtbl->GetDescription(snap, &str16);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get description of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get description of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
if (str16) {
rc = snap->vtbl->GetTimeStamp(snap, ×tamp);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get creation time of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get creation time of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
/* timestamp is in milliseconds while creationTime in seconds */
rc = snap->vtbl->GetParent(snap, &parent);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get parent of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get parent of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
if (parent) {
rc = parent->vtbl->GetName(parent, &str16);
if (NS_FAILED(rc) || !str16) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get name of parent of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get name of parent of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
VBOX_UTF16_TO_UTF8(str16, &str8);
rc = snap->vtbl->GetOnline(snap, &online);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get online state of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get online state of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
if (online)
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get snapshot count for domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get snapshot count for domain %s"),
+ dom->name);
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = machine->vtbl->FindSnapshot(machine, empty.value, snapshots);
#endif /* VBOX_API_VERSION >= 4000 */
if (NS_FAILED(rc) || !snapshots[0]) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get root snapshot for domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get root snapshot for domain %s"),
+ dom->name);
goto cleanup;
}
count = 1;
rc = snapshots[i]->vtbl->GetName(snapshots[i], &nameUtf16);
if (NS_FAILED(rc) || !nameUtf16) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("could not get snapshot name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("could not get snapshot name"));
goto cleanup;
}
VBOX_UTF16_TO_UTF8(nameUtf16, &name);
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get current snapshot"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get current snapshot"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = snap->vtbl->GetParent(snap, &parent);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get parent of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get parent of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
if (!parent) {
- vboxError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("snapshot '%s' does not have a parent"),
- snapshot->name);
+ virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+ _("snapshot '%s' does not have a parent"),
+ snapshot->name);
goto cleanup;
}
rc = parent->vtbl->GetName(parent, &nameUtf16);
if (NS_FAILED(rc) || !nameUtf16) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get name of parent of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get name of parent of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
VBOX_UTF16_TO_UTF8(nameUtf16, &name);
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get current snapshot"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get current snapshot"));
goto cleanup;
}
if (!snapshot) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("domain has no snapshots"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain has no snapshots"));
goto cleanup;
}
rc = snapshot->vtbl->GetName(snapshot, &nameUtf16);
if (NS_FAILED(rc) || !nameUtf16) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get current snapshot name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get current snapshot name"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = machine->vtbl->GetCurrentSnapshot(machine, ¤t);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get current snapshot"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get current snapshot"));
goto cleanup;
}
if (!current) {
rc = current->vtbl->GetName(current, &nameUtf16);
if (NS_FAILED(rc) || !nameUtf16) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get current snapshot name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get current snapshot name"));
goto cleanup;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = snapshot->vtbl->GetId(snapshot, &iid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get snapshot UUID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get snapshot UUID"));
goto cleanup;
}
rc = machine->vtbl->SetCurrentSnapshot(machine, iid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not restore snapshot for domain %s"), dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not restore snapshot for domain %s"), dom->name);
goto cleanup;
}
rc = machine->vtbl->GetId(machine, &domiid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get domain UUID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get domain UUID"));
goto cleanup;
}
rc = machine->vtbl->GetState(machine, &state);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get domain state"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get domain state"));
goto cleanup;
}
if (state >= MachineState_FirstOnline
&& state <= MachineState_LastOnline) {
- vboxError(VIR_ERR_OPERATION_INVALID,
- _("domain %s is already running"), dom->name);
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain %s is already running"), dom->name);
goto cleanup;
}
if (NS_SUCCEEDED(rc))
rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not open VirtualBox session with domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not open VirtualBox session with domain %s"),
+ dom->name);
goto cleanup;
}
rc = console->vtbl->RestoreSnapshot(console, snapshot, &progress);
if (NS_FAILED(rc) || !progress) {
if (rc == VBOX_E_INVALID_VM_STATE) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot restore domain snapshot for running domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot restore domain snapshot for running domain"));
} else {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not restore snapshot for domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not restore snapshot for domain %s"),
+ dom->name);
}
goto cleanup;
}
progress->vtbl->WaitForCompletion(progress, -1);
progress->vtbl->GetResultCode(progress, &result);
if (NS_FAILED(result)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not restore snapshot for domain %s"), dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not restore snapshot for domain %s"), dom->name);
goto cleanup;
}
vboxIIDFromUUID(&domiid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = newSnapshot->vtbl->GetOnline(newSnapshot, &online);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get online state of snapshot %s"),
- snapshot->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get online state of snapshot %s"),
+ snapshot->name);
goto cleanup;
}
rc = machine->vtbl->GetCurrentSnapshot(machine, &prevSnapshot);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get current snapshot of domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get current snapshot of domain %s"),
+ dom->name);
goto cleanup;
}
rc = machine->vtbl->GetState(machine, &state);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get domain state"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get domain state"));
goto cleanup;
}
if (state >= MachineState_FirstOnline
&& state <= MachineState_LastOnline) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot revert snapshot of running domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot revert snapshot of running domain"));
goto cleanup;
}
rc = snapshot->vtbl->GetId(snapshot, &iid.value);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get snapshot UUID"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get snapshot UUID"));
goto cleanup;
}
#endif
if (NS_FAILED(rc) || !progress) {
if (rc == VBOX_E_INVALID_VM_STATE) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot delete domain snapshot for running domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot delete domain snapshot for running domain"));
} else {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not delete snapshot"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not delete snapshot"));
}
goto cleanup;
}
progress->vtbl->WaitForCompletion(progress, -1);
progress->vtbl->GetResultCode(progress, &result);
if (NS_FAILED(result)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not delete snapshot"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not delete snapshot"));
goto cleanup;
}
rc = vboxArrayGet(&children, snapshot, snapshot->vtbl->GetChildren);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get children snapshots"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get children snapshots"));
goto cleanup;
}
vboxIIDFromUUID(&domiid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching UUID"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching UUID"));
goto cleanup;
}
rc = machine->vtbl->GetState(machine, &state);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not get domain state"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not get domain state"));
goto cleanup;
}
if (state >= MachineState_FirstOnline
&& state <= MachineState_LastOnline) {
- vboxError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot delete snapshots of running domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot delete snapshots of running domain"));
goto cleanup;
}
if (NS_SUCCEEDED(rc))
rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not open VirtualBox session with domain %s"),
- dom->name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not open VirtualBox session with domain %s"),
+ dom->name);
goto cleanup;
}
ret = hardDiskAccessible;
} else {
ret = -1;
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get number of volumes in the pool: %s, rc=%08x"),
- pool->name, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get number of volumes in the pool: %s, rc=%08x"),
+ pool->name, (unsigned)rc);
}
return ret;
ret = numActive;
} else {
ret = -1;
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get the volume list in the pool: %s, rc=%08x"),
- pool->name, (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get the volume list in the pool: %s, rc=%08x"),
+ pool->name, (unsigned)rc);
}
return ret;
return ret;
if (virUUIDParse(key, uuid) < 0) {
- vboxError(VIR_ERR_INVALID_ARG,
- _("Could not parse UUID from '%s'"), key);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not parse UUID from '%s'"), key);
return NULL;
}
virCheckFlags(0, -1);
if (virUUIDParse(vol->key, uuid) < 0) {
- vboxError(VIR_ERR_INVALID_ARG,
- _("Could not parse UUID from '%s'"), vol->key);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not parse UUID from '%s'"), vol->key);
return -1;
}
#if VBOX_API_VERSION >= 4000
rc = VBOX_OBJECT_GET_MACHINE(machineId.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
break;
}
#endif
return ret;
if (virUUIDParse(vol->key, uuid) < 0) {
- vboxError(VIR_ERR_INVALID_ARG,
- _("Could not parse UUID from '%s'"), vol->key);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not parse UUID from '%s'"), vol->key);
return ret;
}
memset(&def, 0, sizeof(def));
if (virUUIDParse(vol->key, uuid) < 0) {
- vboxError(VIR_ERR_INVALID_ARG,
- _("Could not parse UUID from '%s'"), vol->key);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not parse UUID from '%s'"), vol->key);
return ret;
}
nsresult rc;
if (virUUIDParse(vol->key, uuid) < 0) {
- vboxError(VIR_ERR_INVALID_ARG,
- _("Could not parse UUID from '%s'"), vol->key);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Could not parse UUID from '%s'"), vol->key);
return ret;
}
vboxIIDFromUUID(&iid, dom->uuid);
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
return NULL;
}
rc = machine->vtbl->GetMonitorCount(machine, &max_screen);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("unable to get monitor count"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("unable to get monitor count"));
VBOX_RELEASE(machine);
return NULL;
}
if (screen >= max_screen) {
- vboxError(VIR_ERR_INVALID_ARG, _("screen ID higher than monitor "
- "count (%d)"), max_screen);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("screen ID higher than monitor "
+ "count (%d)"), max_screen);
VBOX_RELEASE(machine);
return NULL;
}
&bitsPerPixel);
if (NS_FAILED(rc) || !width || !height) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("unable to get screen resolution"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("unable to get screen resolution"));
goto endjob;
}
&screenDataSize,
&screenData);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("failed to take screenshot"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to take screenshot"));
goto endjob;
}
}
if (virFDStreamOpenFile(st, tmp, 0, 0, O_RDONLY) < 0) {
- vboxError(VIR_ERR_OPERATION_FAILED, "%s",
- _("unable to open stream"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("unable to open stream"));
goto endjob;
}
rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get list of domains, rc=%08x"), (unsigned)rc);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get list of domains, rc=%08x"), (unsigned)rc);
goto cleanup;
}
if (MATCH(VIR_CONNECT_LIST_FILTERS_SNAPSHOT)) {
rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount);
if (NS_FAILED(rc)) {
- vboxError(VIR_ERR_INTERNAL_ERROR,
- _("could not get snapshot count for listed domains"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not get snapshot count for listed domains"));
goto cleanup;
}
if (!((MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) &&