msg_gen_function += VMX_ERROR
msg_gen_function += XENXS_ERROR
msg_gen_function += eventReportError
-msg_gen_function += ifaceError
msg_gen_function += interfaceReportError
-msg_gen_function += iptablesError
msg_gen_function += lxcError
msg_gen_function += libxlError
-msg_gen_function += macvtapError
msg_gen_function += networkReportError
msg_gen_function += nodeReportError
msg_gen_function += openvzError
-msg_gen_function += pciReportError
msg_gen_function += qemuReportError
-msg_gen_function += qemudDispatchClientFailure
msg_gen_function += regerror
msg_gen_function += remoteError
-msg_gen_function += remoteDispatchFormatError
msg_gen_function += statsError
msg_gen_function += streamsReportError
-msg_gen_function += usbReportError
msg_gen_function += umlReportError
msg_gen_function += vah_error
msg_gen_function += vah_warning
msg_gen_function += vboxError
-msg_gen_function += virCommandError
msg_gen_function += virConfError
msg_gen_function += virCPUReportError
-msg_gen_function += virEventError
msg_gen_function += virDomainReportError
msg_gen_function += virGenericReportError
-msg_gen_function += virHashError
-msg_gen_function += virHookReportError
msg_gen_function += virInterfaceReportError
-msg_gen_function += virJSONError
msg_gen_function += virLibConnError
msg_gen_function += virLibDomainError
msg_gen_function += virLibDomainSnapshotError
msg_gen_function += virReportSystemError
msg_gen_function += virSecretReportError
msg_gen_function += virSecurityReportError
-msg_gen_function += virSexprError
-msg_gen_function += virSmbiosReportError
-msg_gen_function += virSocketError
-msg_gen_function += virStatsError
msg_gen_function += virStorageReportError
-msg_gen_function += virUtilError
-msg_gen_function += virXMLError
msg_gen_function += virXenInotifyError
msg_gen_function += virXenStoreError
msg_gen_function += virXendError
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virCommandError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
/* Flags for virExecWithHook */
enum {
VIR_EXEC_NONE = 0,
capng_clear(CAPNG_SELECT_BOTH);
if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- _("cannot clear process capabilities %d"), ret);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot clear process capabilities %d"), ret);
return -1;
}
}
if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- _("cannot apply process capabilities %d"), ret);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot apply process capabilities %d"), ret);
return -1;
}
if (binary != argv[0])
VIR_FREE(binary);
- /* NB we don't virCommandError() on any failures here
- because the code which jumped hre already raised
+ /* NB we don't virReportError() on any failures here
+ because the code which jumped here already raised
an error condition which we must not overwrite */
VIR_FORCE_CLOSE(pipeerr[0]);
VIR_FORCE_CLOSE(pipeerr[1]);
if (status)
*status = ENOTSUP;
else
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virRun is not implemented for WIN32"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virRun is not implemented for WIN32"));
return -1;
}
* top of _spawn() or CreateProcess(), but we can't implement
* everything, since mingw completely lacks fork(), so we cannot
* run hook code in the child. */
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virExec is not implemented for WIN32"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virExec is not implemented for WIN32"));
return -1;
}
return NULL;
}
if (cmd->has_error) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use of command API"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
return NULL;
}
return -1;
}
if (cmd->has_error) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use of command API"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
return -1;
}
return -1;
}
if (cmd->has_error) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use of command API"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
return -1;
}
async_io = true;
if (async_io) {
if (!(cmd->flags & VIR_EXEC_DAEMON) || string_io) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot mix caller fds with blocking execution"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot mix caller fds with blocking execution"));
return -1;
}
} else {
if ((cmd->flags & VIR_EXEC_DAEMON) && string_io) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot mix string I/O with daemon"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot mix string I/O with daemon"));
return -1;
}
}
return -1;
}
if (cmd->has_error) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use of command API"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
return -1;
}
if ((cmd->inbuf && cmd->infd == -1) ||
(cmd->outbuf && cmd->outfdptr != &cmd->outfd) ||
(cmd->errbuf && cmd->errfdptr != &cmd->errfd)) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot mix string I/O with asynchronous command"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot mix string I/O with asynchronous command"));
return -1;
}
if (cmd->pid != -1) {
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- _("command is already running as pid %lld"),
- (long long) cmd->pid);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("command is already running as pid %lld"),
+ (long long) cmd->pid);
return -1;
}
if (!synchronous && (cmd->flags & VIR_EXEC_DAEMON)) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("daemonized command cannot use virCommandRunAsync"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("daemonized command cannot use virCommandRunAsync"));
return -1;
}
if (cmd->pwd && (cmd->flags & VIR_EXEC_DAEMON)) {
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- _("daemonized command cannot set working directory %s"),
- cmd->pwd);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("daemonized command cannot set working directory %s"),
+ cmd->pwd);
return -1;
}
if (cmd->pidfile && !(cmd->flags & VIR_EXEC_DAEMON)) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("creation of pid file requires daemonized command"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("creation of pid file requires daemonized command"));
return -1;
}
if (exitstatus == NULL) {
if (status != 0) {
char *st = virCommandTranslateStatus(status);
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- _("Child process (%lld) status unexpected: %s"),
- (long long) pid, NULLSTR(st));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Child process (%lld) status unexpected: %s"),
+ (long long) pid, NULLSTR(st));
VIR_FREE(st);
return -1;
}
return -1;
}
if (cmd->has_error) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use of command API"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
return -1;
}
if (cmd->pid == -1) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("command is not yet running"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("command is not yet running"));
return -1;
}
if (status) {
char *str = virCommandToString(cmd);
char *st = virCommandTranslateStatus(status);
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- _("Child process (%s) status unexpected: %s"),
- str ? str : cmd->args[0], NULLSTR(st));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Child process (%s) status unexpected: %s"),
+ str ? str : cmd->args[0], NULLSTR(st));
VIR_FREE(str);
VIR_FREE(st);
return -1;
return -1;
}
if (cmd->has_error || !cmd->handshake) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use of command API"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
return -1;
}
if (cmd->handshakeWait[0] == -1) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Handshake is already complete"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Handshake is already complete"));
return -1;
}
}
VIR_FORCE_CLOSE(cmd->handshakeWait[0]);
msg[len-1] = '\0';
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s", msg);
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", msg);
VIR_FREE(msg);
return -1;
}
return -1;
}
if (cmd->has_error || !cmd->handshake) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use of command API"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use of command API"));
return -1;
}
if (cmd->handshakeNotify[1] == -1) {
- virCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Handshake is already complete"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Handshake is already complete"));
return -1;
}
#define VIR_FROM_THIS VIR_FROM_EVENT
-#define virEventError(code, ...) \
- virReportErrorHelper(VIR_FROM_EVENT, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
static int virEventPollInterruptLocked(void);
/* State for a single file handle being monitored */
if (virEventPollAddHandle(eventLoop.wakeupfd[0],
VIR_EVENT_HANDLE_READABLE,
virEventPollHandleWakeup, NULL, NULL) < 0) {
- virEventError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to add handle %d to event loop"),
- eventLoop.wakeupfd[0]);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to add handle %d to event loop"),
+ eventLoop.wakeupfd[0]);
VIR_FORCE_CLOSE(eventLoop.wakeupfd[0]);
VIR_FORCE_CLOSE(eventLoop.wakeupfd[1]);
return -1;
#define VIR_FROM_THIS VIR_FROM_HOOK
-#define virHookReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_HOOK, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
#define LIBVIRT_HOOK_DIR SYSCONFDIR "/libvirt/hooks"
VIR_ENUM_DECL(virHookDriver)
int ret;
if (driver == NULL) {
- virHookReportError(VIR_ERR_INTERNAL_ERROR,
- _("Invalid hook name for #%d"), no);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid hook name for #%d"), no);
return -1;
}
ret = virBuildPath(&path, LIBVIRT_HOOK_DIR, driver);
if ((ret < 0) || (path == NULL)) {
- virHookReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to build path for %s hook"),
- driver);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to build path for %s hook"),
+ driver);
return -1;
}
break;
}
if (opstr == NULL) {
- virHookReportError(VIR_ERR_INTERNAL_ERROR,
- _("Hook for %s, failed to find operation #%d"),
- drvstr, op);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Hook for %s, failed to find operation #%d"),
+ drvstr, op);
return 1;
}
subopstr = virHookSubopTypeToString(sub_op);
ret = virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
if ((ret < 0) || (path == NULL)) {
- virHookReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to build path for %s hook"),
- drvstr);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to build path for %s hook"),
+ drvstr);
return -1;
}
ret = virCommandRun(cmd, &exitstatus);
if (ret == 0 && exitstatus != 0) {
- virHookReportError(VIR_ERR_HOOK_SCRIPT_FAILED,
- _("Hook script %s %s failed with error code %d"),
- path, drvstr, exitstatus);
+ virReportError(VIR_ERR_HOOK_SCRIPT_FAILED,
+ _("Hook script %s %s failed with error code %d"),
+ path, drvstr, exitstatus);
ret = -1;
}
/* For virReportOOMError() and virReportSystemError() */
#define VIR_FROM_THIS VIR_FROM_NONE
-#define usbReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
struct _usbDevice {
unsigned int bus;
unsigned int dev;
goto cleanup;
if (virStrToLong_ui(buf, &ignore, base, value) < 0) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not parse usb file %s"), filename);
goto cleanup;
}
tmpstr += 3;
if (virStrToLong_ui(tmpstr, &ignore, 10, &found_bus) < 0) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to parse dir name '%s'"),
de->d_name);
goto cleanup;
return NULL;
if (list->count == 0) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Did not find USB device %x:%x"), vendor, product);
usbDeviceListFree(list);
return NULL;
return NULL;
if (list->count == 0) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Did not find USB device bus:%u device:%u"),
bus, devno);
usbDeviceListFree(list);
return NULL;
if (list->count == 0) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Did not find USB device %x:%x bus:%u device:%u"),
vendor, product, bus, devno);
usbDeviceListFree(list);
if (snprintf(dev->name, sizeof(dev->name), "%.3o:%.3o",
dev->bus, dev->dev) >= sizeof(dev->name)) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("dev->name buffer overflow: %.3o:%.3o"),
dev->bus, dev->dev);
usbFreeDevice(dev);
/* XXX fixme. this should be product/vendor */
if (snprintf(dev->id, sizeof(dev->id), "%d %d", dev->bus,
dev->dev) >= sizeof(dev->id)) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("dev->id buffer overflow: %d %d"),
dev->bus, dev->dev);
usbFreeDevice(dev);
usbDevice *dev)
{
if (usbDeviceListFind(list, dev)) {
- usbReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Device %s is already in use"),
dev->name);
return -1;
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_NONE
-#define iptablesError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
enum {
ADD = 0,
if (!(VIR_SOCKET_ADDR_IS_FAMILY(netaddr, AF_INET) ||
VIR_SOCKET_ADDR_IS_FAMILY(netaddr, AF_INET6))) {
- iptablesError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Only IPv4 or IPv6 addresses can be used with iptables"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only IPv4 or IPv6 addresses can be used with iptables"));
return NULL;
}
if (virSocketAddrMaskByPrefix(netaddr, prefix, &network) < 0) {
- iptablesError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failure to mask address"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failure to mask address"));
return NULL;
}
if (!VIR_SOCKET_ADDR_IS_FAMILY(netaddr, AF_INET)) {
/* Higher level code *should* guaranteee it's impossible to get here. */
- iptablesError(VIR_ERR_INTERNAL_ERROR,
- _("Attempted to NAT '%s'. NAT is only supported for IPv4."),
- networkstr);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Attempted to NAT '%s'. NAT is only supported for IPv4."),
+ networkstr);
VIR_FREE(networkstr);
return -1;
}
/* XXX fixme */
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virJSONError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
typedef struct _virJSONParserState virJSONParserState;
hand = yajl_alloc(&parserCallbacks, &cfg, NULL, &parser);
# endif
if (!hand) {
- virJSONError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to create JSON parser"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to create JSON parser"));
goto cleanup;
}
(const unsigned char*)jsonstring,
strlen(jsonstring));
- virJSONError(VIR_ERR_INTERNAL_ERROR,
- _("cannot parse json %s: %s"),
- jsonstring, (const char*) errstr);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse json %s: %s"),
+ jsonstring, (const char*) errstr);
VIR_FREE(errstr);
virJSONValueFree(parser.head);
goto cleanup;
g = yajl_gen_alloc(&conf, NULL);
# endif
if (!g) {
- virJSONError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to create JSON formatter"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to create JSON formatter"));
goto cleanup;
}
#else
virJSONValuePtr virJSONValueFromString(const char *jsonstring ATTRIBUTE_UNUSED)
{
- virJSONError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No JSON parser implementation is available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No JSON parser implementation is available"));
return NULL;
}
char *virJSONValueToString(virJSONValuePtr object ATTRIBUTE_UNUSED)
{
- virJSONError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No JSON parser implementation is available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No JSON parser implementation is available"));
return NULL;
}
#endif
/* For virReportOOMError() and virReportSystemError() */
#define VIR_FROM_THIS VIR_FROM_NONE
-#define pciReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
/* Specifications referenced in comments:
* PCI30 - PCI Local Bus Specification 3.0
* PCIe20 - PCI Express Base Specification 2.0
* are not in use by the host or other guests.
*/
if ((conflict = pciBusContainsActiveDevices(dev, inactiveDevs))) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Active %s devices on bus with %s, not doing bus reset"),
conflict->name, dev->name);
return -1;
if (pciGetParentDevice(dev, &parent) < 0)
return -1;
if (!parent) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to find parent device for %s"),
dev->name);
return -1;
* are multiple devices/functions
*/
if (pciRead(dev, 0, config_space, PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read PCI config space for %s"),
dev->name);
goto out;
usleep(200 * 1000); /* sleep 200ms */
if (pciWrite(dev, 0, config_space, PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to restore PCI config space for %s"),
dev->name);
goto out;
/* Save and restore the device's config space. */
if (pciRead(dev, 0, &config_space[0], PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read PCI config space for %s"),
dev->name);
return -1;
usleep(10 * 1000); /* sleep 10ms */
if (pciWrite(dev, 0, &config_space[0], PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to restore PCI config space for %s"),
dev->name);
return -1;
int ret = -1;
if (activeDevs && pciDeviceListFind(activeDevs, dev)) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Not resetting active device %s"), dev->name);
return -1;
}
if (ret < 0) {
virErrorPtr err = virGetLastError();
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to reset PCI device %s: %s"),
dev->name,
err ? err->message : _("no FLR, PM reset or bus reset available"));
{
const char *driver = pciFindStubDriver();
if (!driver) {
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot find any PCI stub module"));
return -1;
}
if (activeDevs && pciDeviceListFind(activeDevs, dev)) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Not detaching active device %s"), dev->name);
return -1;
}
{
const char *driver = pciFindStubDriver();
if (!driver) {
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot find any PCI stub module"));
return -1;
}
if (activeDevs && pciDeviceListFind(activeDevs, dev)) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Not reattaching active device %s"), dev->name);
return -1;
}
if (snprintf(dev->name, sizeof(dev->name), "%.4x:%.2x:%.2x.%.1x",
dev->domain, dev->bus, dev->slot,
dev->function) >= sizeof(dev->name)) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("dev->name buffer overflow: %.4x:%.2x:%.2x.%.1x"),
dev->domain, dev->bus, dev->slot, dev->function);
goto error;
product = pciReadDeviceID(dev, "device");
if (!vendor || !product) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read product/vendor ID for %s"),
dev->name);
goto error;
/* strings contain '0x' prefix */
if (snprintf(dev->id, sizeof(dev->id), "%s %s", &vendor[2],
&product[2]) >= sizeof(dev->id)) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("dev->id buffer overflow: %s %s"),
&vendor[2], &product[2]);
goto error;
pciDevice *dev)
{
if (pciDeviceListFind(list, dev)) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Device %s is already in use"), dev->name);
return -1;
}
if (dev->bus == 0)
return 0;
else {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to find parent device for %s"),
dev->name);
return -1;
VIR_DEBUG("%s %s: strict ACS check disabled; device assignment allowed",
dev->id, dev->name);
} else {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Device %s is behind a switch lacking ACS and "
"cannot be assigned"),
dev->name);
device_path = canonicalize_file_name (device_link);
if (device_path == NULL) {
memset(errbuf, '\0', sizeof(errbuf));
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to resolve device link '%s': '%s'"),
device_link, virStrerror(errno, errbuf,
sizeof(errbuf)));
}
if (pciParsePciConfigAddress(config_address, *bdf) != 0) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to parse PCI config address '%s'"),
config_address);
VIR_FREE(*bdf);
dir = opendir(sysfs_path);
if (dir == NULL) {
memset(errbuf, '\0', sizeof(errbuf));
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to open dir '%s': '%s'"),
sysfs_path, virStrerror(errno, errbuf,
sizeof(errbuf)));
SRIOV_FOUND) {
/* We should not get back SRIOV_NOT_FOUND in this
* case, so if we do, it's an error. */
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to get SR IOV function from device "
"link '%s'"), device_link);
VIR_FREE(device_link);
if (pciGetVirtualFunctions(pf_sysfs_device_link, &virt_fns,
&num_virt_fns) < 0) {
- pciReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Error getting physical function's '%s' "
"virtual_functions"), pf_sysfs_device_link);
goto out;
pciGetPhysicalFunction(const char *vf_sysfs_path ATTRIBUTE_UNUSED,
struct pci_config_address **physical_function ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
struct pci_config_address ***virtual_functions ATTRIBUTE_UNUSED,
unsigned int *num_virtual_functions ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
int
pciDeviceIsVirtualFunction(const char *vf_sysfs_device_link ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
const char *vf_sysfs_device_link ATTRIBUTE_UNUSED,
int *vf_index ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
pciConfigAddressToSysfsFile(struct pci_config_address *dev ATTRIBUTE_UNUSED,
char **pci_sysfs_device_link ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
pciDeviceNetName(char *device_link_sysfs_path ATTRIBUTE_UNUSED,
char **netname ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
char **pfname ATTRIBUTE_UNUSED,
int *vf_index ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
#endif /* __linux__ */
#define VIR_FROM_THIS VIR_FROM_SEXPR
-#define virSexprError(code, ...) \
- virReportErrorHelper(VIR_FROM_SEXPR, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
/**
* sexpr_new:
virBufferAddLit(buffer, "()");
break;
default:
- virSexprError(VIR_ERR_SEXPR_SERIAL,
- _("unknown s-expression kind %d"), sexpr->kind);
+ virReportError(VIR_ERR_SEXPR_SERIAL,
+ _("unknown s-expression kind %d"), sexpr->kind);
return -1;
}
# define VIR_FROM_THIS VIR_FROM_STATS_LINUX
-# define virStatsError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
/*-------------------- interface stats --------------------*/
/* Just reads the named interface, so not Xen or QEMU-specific.
}
VIR_FORCE_FCLOSE(fp);
- virStatsError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("/proc/net/dev: Interface not found"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("/proc/net/dev: Interface not found"));
return -1;
}
#define VIR_FROM_THIS VIR_FROM_SYSINFO
-#define virSmbiosReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_SYSINFO, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
#define SYSINFO_SMBIOS_DECODER "dmidecode"
#define SYSINFO "/proc/sysinfo"
#define CPUINFO "/proc/cpuinfo"
goto no_memory;
if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
- virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to open %s"), CPUINFO);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to open %s"), CPUINFO);
return NULL;
}
/* Gather info from /proc/cpuinfo */
if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
- virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to open %s"), CPUINFO);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to open %s"), CPUINFO);
return NULL;
}
/* Gather info from /proc/sysinfo */
if (virFileReadAll(SYSINFO, 4096, &outbuf) < 0) {
- virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to open %s"), SYSINFO);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to open %s"), SYSINFO);
return NULL;
}
* http://www.microsoft.com/whdc/system/platform/firmware/SMBIOS.mspx
*/
virReportSystemError(ENOSYS, "%s",
- _("Host sysinfo extraction not supported on this platform"));
+ _("Host sysinfo extraction not supported on this platform"));
return NULL;
}
path = virFindFileInPath(SYSINFO_SMBIOS_DECODER);
if (path == NULL) {
- virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to find path for %s binary"),
- SYSINFO_SMBIOS_DECODER);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to find path for %s binary"),
+ SYSINFO_SMBIOS_DECODER);
return NULL;
}
VIR_FREE(path);
virCommandSetOutputBuffer(cmd, &outbuf);
if (virCommandRun(cmd, NULL) < 0) {
- virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to execute command %s"),
- path);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to execute command %s"),
+ path);
goto cleanup;
}
const char *type = virSysinfoTypeToString(def->type);
if (!type) {
- virSmbiosReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected sysinfo type model %d"),
- def->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected sysinfo type model %d"),
+ def->type);
virBufferFreeAndReset(buf);
return -1;
}
return true;
if ((src && !dst) || (!src && dst)) {
- virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Target sysinfo does not match source"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Target sysinfo does not match source"));
goto cleanup;
}
if (src->type != dst->type) {
- virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Target sysinfo %s does not match source %s"),
- virSysinfoTypeToString(dst->type),
- virSysinfoTypeToString(src->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target sysinfo %s does not match source %s"),
+ virSysinfoTypeToString(dst->type),
+ virSysinfoTypeToString(src->type));
goto cleanup;
}
#define CHECK_FIELD(name, desc) \
do { \
if (STRNEQ_NULLABLE(src->name, dst->name)) { \
- virSmbiosReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
- _("Target sysinfo %s %s does not match source %s"), \
- desc, NULLSTR(src->name), NULLSTR(dst->name)); \
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
+ _("Target sysinfo %s %s does not match source %s"), \
+ desc, NULLSTR(src->name), NULLSTR(dst->name)); \
} \
} while (0)
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virUtilError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
/* Like read(), but restarts after EINTR */
ssize_t
saferead(int fd, void *buf, size_t count)
if (fds[i].revents & POLLHUP)
continue;
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Unknown poll response."));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Unknown poll response."));
goto error;
}
gid_t gid ATTRIBUTE_UNUSED,
unsigned int flags_unused ATTRIBUTE_UNUSED)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virFileOpenAs is not implemented for WIN32"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virFileOpenAs is not implemented for WIN32"));
return -ENOSYS;
}
gid_t gid ATTRIBUTE_UNUSED,
unsigned int flags_unused ATTRIBUTE_UNUSED)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virDirCreate is not implemented for WIN32"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virDirCreate is not implemented for WIN32"));
return -ENOSYS;
}
{
if (!suffix || !*suffix) {
if (!scale) {
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- _("invalid scale %llu"), scale);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid scale %llu"), scale);
return -1;
}
suffix = "";
} else if (c_tolower(suffix[1]) == 'b' && !suffix[2]) {
base = 1000;
} else {
- virUtilError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG,
_("unknown suffix '%s'"), suffix);
return -1;
}
scale *= base;
break;
default:
- virUtilError(VIR_ERR_INVALID_ARG,
- _("unknown suffix '%s'"), suffix);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unknown suffix '%s'"), suffix);
return -1;
}
}
if (*value && *value >= (limit / scale)) {
- virUtilError(VIR_ERR_OVERFLOW, _("value too large: %llu%s"),
- *value, suffix);
+ virReportError(VIR_ERR_OVERFLOW, _("value too large: %llu%s"),
+ *value, suffix);
return -1;
}
*value *= scale;
int i, k, offset;
if (idx < 0) {
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- _("Disk index %d is negative"), idx);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Disk index %d is negative"), idx);
return NULL;
}
return NULL;
if (!ret) {
- virUtilError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to determine home directory"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to determine home directory"));
return NULL;
}
return NULL;
if (!ret) {
- virUtilError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to determine config directory"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to determine config directory"));
return NULL;
}
return ret;
return NULL;
if (!ret) {
- virUtilError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to determine config directory"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to determine config directory"));
return NULL;
}
return ret;
char *
virGetUserDirectory(void)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetUserDirectory is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetUserDirectory is not available"));
return NULL;
}
char *
virGetUserConfigDirectory(void)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetUserConfigDirectory is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetUserConfigDirectory is not available"));
return NULL;
}
char *
virGetUserCacheDirectory(void)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetUserCacheDirectory is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetUserCacheDirectory is not available"));
return NULL;
}
char *
virGetUserRuntimeDirectory(void)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetUserRuntimeDirectory is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetUserRuntimeDirectory is not available"));
return NULL;
}
char *
virGetUserName(uid_t uid ATTRIBUTE_UNUSED)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetUserName is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetUserName is not available"));
return NULL;
}
int virGetUserID(const char *name ATTRIBUTE_UNUSED,
uid_t *uid ATTRIBUTE_UNUSED)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetUserID is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetUserID is not available"));
return 0;
}
int virGetGroupID(const char *name ATTRIBUTE_UNUSED,
gid_t *gid ATTRIBUTE_UNUSED)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetGroupID is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetGroupID is not available"));
return 0;
}
virSetUIDGID(uid_t uid ATTRIBUTE_UNUSED,
gid_t gid ATTRIBUTE_UNUSED)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virSetUIDGID is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virSetUIDGID is not available"));
return -1;
}
char *
virGetGroupName(gid_t gid ATTRIBUTE_UNUSED)
{
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("virGetGroupName is not available"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("virGetGroupName is not available"));
return NULL;
}
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virAuthReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
virAuthConfigPtr virAuthConfigNew(const char *path)
{
}
if (!(authcred = virKeyFileGetValueString(auth->keyfile, authgroup, "credentials"))) {
- virAuthReportError(VIR_ERR_CONF_SYNTAX,
- _("Missing item 'credentials' in group '%s' in '%s'"),
- authgroup, auth->path);
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("Missing item 'credentials' in group '%s' in '%s'"),
+ authgroup, auth->path);
goto cleanup;
}
}
if (!virKeyFileHasGroup(auth->keyfile, credgroup)) {
- virAuthReportError(VIR_ERR_CONF_SYNTAX,
- _("Missing group 'credentials-%s' referenced from group '%s' in '%s'"),
- authcred, authgroup, auth->path);
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("Missing group 'credentials-%s' referenced from group '%s' in '%s'"),
+ authcred, authgroup, auth->path);
goto cleanup;
}
#define VIR_FROM_THIS VIR_FROM_DBUS
-#define virDBusReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
#ifdef HAVE_DBUS
static DBusConnection *systembus = NULL;
DBusConnection *virDBusGetSystemBus(void)
{
if (virOnce(&once, virDBusSystemBusInit) < 0) {
- virDBusReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to run one time DBus initializer"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to run one time DBus initializer"));
return NULL;
}
if (!systembus) {
- virDBusReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to get DBus system bus connection: %s"),
- dbuserr.message ? dbuserr.message : "watch setup failed");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to get DBus system bus connection: %s"),
+ dbuserr.message ? dbuserr.message : "watch setup failed");
return NULL;
}
#else /* ! HAVE_DBUS */
DBusConnection *virDBusGetSystemBus(void)
{
- virDBusReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("DBus support not compiled into this binary"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("DBus support not compiled into this binary"));
return NULL;
}
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virFileError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
int virFileClose(int *fdptr, virFileCloseFlags flags)
{
int mode = -1;
if (!flags) {
- virFileError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("invalid use with no flags"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("invalid use with no flags"));
return NULL;
}
*/
if ((flags & VIR_FILE_WRAPPER_BYPASS_CACHE) && !O_DIRECT) {
- virFileError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("O_DIRECT unsupported on this platform"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("O_DIRECT unsupported on this platform"));
return NULL;
}
mode = fcntl(*fd, F_GETFL);
if (mode < 0) {
- virFileError(VIR_ERR_INTERNAL_ERROR, _("invalid fd %d for %s"),
- *fd, name);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid fd %d for %s"),
+ *fd, name);
goto error;
} else if ((mode & O_ACCMODE) == O_WRONLY) {
output = true;
} else if ((mode & O_ACCMODE) != O_RDONLY) {
- virFileError(VIR_ERR_INTERNAL_ERROR, _("unexpected mode %x for %s"),
- mode & O_ACCMODE, name);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected mode %x for %s"),
+ mode & O_ACCMODE, name);
goto error;
}
if (pipe2(pipefd, O_CLOEXEC) < 0) {
- virFileError(VIR_ERR_INTERNAL_ERROR,
- _("unable to create pipe for %s"), name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to create pipe for %s"), name);
goto error;
}
goto error;
if (VIR_CLOSE(pipefd[!output]) < 0) {
- virFileError(VIR_ERR_INTERNAL_ERROR, "%s", _("unable to close pipe"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unable to close pipe"));
goto error;
}
const char *name ATTRIBUTE_UNUSED,
unsigned int fdflags ATTRIBUTE_UNUSED)
{
- virFileError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("virFileWrapperFd unsupported on this platform"));
return NULL;
}
mode_t mode;
if (mode_remove & ~MODE_BITS || mode_add & ~MODE_BITS) {
- virFileError(VIR_ERR_INVALID_ARG, "%s", _("invalid mode"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid mode"));
return -1;
}
VIR_FREE(looppath);
}
- virFileError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to find a free loop device in /dev"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to find a free loop device in /dev"));
cleanup:
if (fd != -1) {
#endif
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virNetDevError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
#if defined(HAVE_STRUCT_IFREQ)
static int virNetDevSetupControlFull(const char *ifname,
return -1;
if (virMacAddrParse(macstr, &oldmac) != 0) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Cannot parse MAC address from '%s'"),
oldmacname);
VIR_FREE(macstr);
return rc;
malformed_resp:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed netlink response message"));
goto cleanup;
buffer_too_small:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small"));
goto cleanup;
}
return rc;
malformed_resp:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed netlink response message"));
goto cleanup;
buffer_too_small:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small"));
goto cleanup;
}
cleanup:
if (msg)
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s", msg);
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", msg);
return rc;
}
}
if (virMacAddrParse(macstr, &oldmac) != 0) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("Cannot parse MAC address from '%s'"),
macstr);
goto cleanup;
#define VIR_FROM_THIS VIR_FROM_NET
-#define virNetDevError(code, ...) \
- virReportErrorHelper(VIR_FROM_NET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
-
VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST,
"vepa",
"private",
return rc;
malformed_resp:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed netlink response message"));
goto cleanup;
buffer_too_small:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small"));
goto cleanup;
}
return rc;
malformed_resp:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed netlink response message"));
goto cleanup;
buffer_too_small:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small"));
goto cleanup;
}
}
if (virNetDevBandwidthSet(cr_ifname, bandwidth) < 0) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot set bandwidth limits on %s"),
cr_ifname);
if (withTap)
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virNetDevTapError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
/**
* virNetDevProbeVnetHdr:
* @tapfd: a tun/tap file descriptor
* in "received packet on vnetX with own address as source
* address" error logs from the kernel.
*/
- virNetDevTapError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unable to use MAC address starting with "
- "reserved value 0xFE - '%02X:%02X:%02X:%02X:%02X:%02X' - "),
- macaddr->addr[0], macaddr->addr[1],
- macaddr->addr[2], macaddr->addr[3],
- macaddr->addr[4], macaddr->addr[5]);
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unable to use MAC address starting with "
+ "reserved value 0xFE - '%02X:%02X:%02X:%02X:%02X:%02X' - "),
+ macaddr->addr[0], macaddr->addr[1],
+ macaddr->addr[2], macaddr->addr[3],
+ macaddr->addr[4], macaddr->addr[5]);
goto error;
}
tapmac.addr[0] = 0xFE; /* Discourage bridge from using TAP dev MAC */
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virNetDevvError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
/* Functions */
/**
* virNetDevVethGetFreeName:
#define VIR_FROM_THIS VIR_FROM_NET
-#define virNetDevError(code, ...) \
- virReportErrorHelper(VIR_FROM_NET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
-
VIR_ENUM_IMPL(virNetDevVPortProfileOp, VIR_NETDEV_VPORT_PROFILE_OP_LAST,
"create",
"save",
&& res != 0) {
pid = res;
} else {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("error parsing pid of lldpad"));
}
}
if (tb[IFLA_PORT_SELF]) {
if (nla_parse_nested(tb_port, IFLA_PORT_MAX, tb[IFLA_PORT_SELF],
ifla_port_policy)) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("error parsing IFLA_PORT_SELF part"));
goto cleanup;
}
} else {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IFLA_PORT_SELF is missing"));
goto cleanup;
}
nla_for_each_nested(tb_vf_ports, tb[IFLA_VF_PORTS], rem) {
if (nla_type(tb_vf_ports) != IFLA_VF_PORT) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("error while iterating over "
"IFLA_VF_PORTS part"));
goto cleanup;
if (nla_parse_nested(tb_port, IFLA_PORT_MAX, tb_vf_ports,
ifla_port_policy)) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("error parsing IFLA_VF_PORT part"));
goto cleanup;
}
}
if (!found) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not find netlink response with "
"expected parameters"));
goto cleanup;
}
} else {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IFLA_VF_PORTS is missing"));
goto cleanup;
}
*status = PORT_PROFILE_RESPONSE_INPROGRESS;
rc = 0;
} else {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("no IFLA_PORT_RESPONSE found in netlink message"));
goto cleanup;
}
return rc;
malformed_resp:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed netlink response message"));
goto cleanup;
buffer_too_small:
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small"));
goto cleanup;
}
if (tb[IFLA_IFNAME]) {
if (!virStrcpy(parent_ifname, (char*)RTA_DATA(tb[IFLA_IFNAME]),
IFNAMSIZ)) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("buffer for root interface name is too small"));
VIR_FREE(recvbuf);
return -1;
vf,
op);
if (rc < 0) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("sending of PortProfileRequest failed."));
return rc;
}
}
if (status == PORT_PROFILE_RESPONSE_INPROGRESS) {
- virNetDevError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("port-profile setlink timed out"));
rc = -2;
}
op = PORT_REQUEST_DISASSOCIATE;
break;
default:
- virNetDevError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("operation type %d not supported"), virtPortOp);
goto cleanup;
}
break;
default:
- virNetDevError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR,
_("operation type %d not supported"), virtPortOp);
rc = -1;
}
#define VIR_FROM_THIS VIR_FROM_NET
-#define netlinkError(code, ...) \
- virReportErrorHelper(VIR_FROM_NET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
#define NETLINK_ACK_TIMEOUT_S 2
#if defined(__linux__) && defined(HAVE_LIBNL)
int virNetlinkEventServiceLocalPid(void)
{
if (!(server && server->netlinknh)) {
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("netlink event service not running"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("netlink event service not running"));
return -1;
}
return (int)nl_socket_get_local_port(server->netlinknh);
VIR_EVENT_HANDLE_READABLE,
virNetlinkEventCallback,
srv, NULL)) < 0) {
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to add netlink event handle watch"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to add netlink event handle watch"));
goto error_server;
}
virNetlinkEventSrvPrivatePtr srv = server;
if (handleCB == NULL) {
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Invalid NULL callback provided"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Invalid NULL callback provided"));
return -1;
}
uint32_t src_pid ATTRIBUTE_UNUSED,
uint32_t dst_pid ATTRIBUTE_UNUSED)
{
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
*/
bool virNetlinkEventServiceIsRunning(void)
{
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return 0;
}
int virNetlinkEventServiceLocalPid(void)
{
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
void *opaque ATTRIBUTE_UNUSED,
const unsigned char *macaddr ATTRIBUTE_UNUSED)
{
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
int virNetlinkEventRemoveClient(int watch ATTRIBUTE_UNUSED,
const unsigned char *macaddr ATTRIBUTE_UNUSED)
{
- netlinkError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virNodeSuspendError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
-
#define SUSPEND_DELAY 10 /* in seconds */
/* Give sufficient time for performing the suspend operation on the host */
int ret = -1;
if (alarmTime <= MIN_TIME_REQ_FOR_SUSPEND) {
- virNodeSuspendError(VIR_ERR_INVALID_ARG, "%s", _("Suspend duration is too short"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Suspend duration is too short"));
return -1;
}
if (aboutToSuspend) {
/* A suspend operation is already in progress */
- virNodeSuspendError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Suspend operation already in progress"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Suspend operation already in progress"));
goto cleanup;
}
switch (target) {
case VIR_NODE_SUSPEND_TARGET_MEM:
if (!(supported & (1 << VIR_NODE_SUSPEND_TARGET_MEM))) {
- virNodeSuspendError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Suspend-to-RAM"));
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Suspend-to-RAM"));
goto cleanup;
}
cmdString = "pm-suspend";
case VIR_NODE_SUSPEND_TARGET_DISK:
if (!(supported & (1 << VIR_NODE_SUSPEND_TARGET_DISK))) {
- virNodeSuspendError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Suspend-to-Disk"));
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Suspend-to-Disk"));
goto cleanup;
}
cmdString = "pm-hibernate";
case VIR_NODE_SUSPEND_TARGET_HYBRID:
if (!(supported & (1 << VIR_NODE_SUSPEND_TARGET_HYBRID))) {
- virNodeSuspendError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Hybrid-Suspend"));
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("Hybrid-Suspend"));
goto cleanup;
}
cmdString = "pm-suspend-hybrid";
break;
default:
- virNodeSuspendError(VIR_ERR_INVALID_ARG, "%s", _("Invalid suspend target"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid suspend target"));
goto cleanup;
}
goto cleanup;
if (virThreadCreate(&thread, false, virNodeSuspend, (void *)cmdString) < 0) {
- virNodeSuspendError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to create thread to suspend the host"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to create thread to suspend the host"));
goto cleanup;
}
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virRandomError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
static char randomState[128];
static struct random_data randomData;
static virMutex randomLock;
const char *oui = NULL;
if (!virt_type) {
- virRandomError(VIR_ERR_INVALID_ARG, "%s",
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("argument virt_type must not be NULL"));
return -1;
}
} else if (STREQ(virt_type, "HYPER-V")) {
oui = MICROSOFT_OUI;
} else {
- virRandomError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unsupported virt type"));
return -1;
}
#include <netdb.h>
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virSocketError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
/*
* Helpers to extract the IP arrays from the virSocketAddrPtr
int err;
if (val == NULL) {
- virSocketError(VIR_ERR_INVALID_ARG, "%s", _("Missing address"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Missing address"));
return -1;
}
hints.ai_family = family;
hints.ai_flags = AI_NUMERICHOST;
if ((err = getaddrinfo(val, NULL, &hints, &res)) != 0) {
- virSocketError(VIR_ERR_SYSTEM_ERROR,
+ virReportError(VIR_ERR_SYSTEM_ERROR,
_("Cannot parse socket address '%s': %s"),
val, gai_strerror(err));
return -1;
}
if (res == NULL) {
- virSocketError(VIR_ERR_SYSTEM_ERROR,
+ virReportError(VIR_ERR_SYSTEM_ERROR,
_("No socket addresses found for '%s'"),
val);
return -1;
int err;
if (addr == NULL) {
- virSocketError(VIR_ERR_INVALID_ARG, "%s", _("Missing address"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Missing address"));
return NULL;
}
host, sizeof(host),
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
- virSocketError(VIR_ERR_SYSTEM_ERROR,
+ virReportError(VIR_ERR_SYSTEM_ERROR,
_("Cannot convert socket address to string: %s"),
gai_strerror(err));
return NULL;
#define VIR_FROM_THIS VIR_FROM_NONE
-#define virUtilError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
VIR_ENUM_DECL(virTypedParameter)
VIR_ENUM_IMPL(virTypedParameter, VIR_TYPED_PARAM_LAST,
"unknown",
badtype = virTypedParameterTypeToString(params[i].type);
if (!badtype)
badtype = virTypedParameterTypeToString(0);
- virUtilError(VIR_ERR_INVALID_ARG,
- _("invalid type '%s' for parameter '%s', "
- "expected '%s'"),
- badtype, params[i].field,
- virTypedParameterTypeToString(type));
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("invalid type '%s' for parameter '%s', "
+ "expected '%s'"),
+ badtype, params[i].field,
+ virTypedParameterTypeToString(type));
}
break;
}
name = va_arg(ap, const char *);
}
if (!name) {
- virUtilError(VIR_ERR_INVALID_ARG,
- _("parameter '%s' not supported"),
- params[i].field);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("parameter '%s' not supported"),
+ params[i].field);
goto cleanup;
}
for (j = 0; j < i; j++) {
if (STREQ(params[i].field, params[j].field)) {
- virUtilError(VIR_ERR_INVALID_ARG,
- _("parameter '%s' occurs multiple times"),
- params[i].field);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("parameter '%s' occurs multiple times"),
+ params[i].field);
goto cleanup;
}
}
va_start(ap, type);
if (virStrcpyStatic(param->field, name) == NULL) {
- virUtilError(VIR_ERR_INTERNAL_ERROR, _("Field name '%s' too long"),
- name);
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Field name '%s' too long"),
+ name);
goto cleanup;
}
param->type = type;
}
break;
default:
- virUtilError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected type %d for field %s"), type, name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected type %d for field %s"), type, name);
goto cleanup;
}
#define VIR_FROM_THIS VIR_FROM_URI
-#define virURIReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
-
static int
virURIParamAppend(virURIPtr uri,
const char *name,
if (!xmluri) {
/* libxml2 does not tell us what failed. Grr :-( */
- virURIReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to parse URI %s"), uri);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to parse URI %s"), uri);
return NULL;
}
virReportErrorHelper(from, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
-#define virXMLError(code, ...) \
- virGenericReportError(VIR_FROM_XML, code, __VA_ARGS__)
-
-
/* Internal data to be passed to SAX parser and used by error handler. */
struct virParserData {
int domcode;
char *ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathString()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathString()"));
return NULL;
}
relnode = ctxt->node;
char *tmp = virXPathString(xpath, ctxt);
if (tmp != NULL && strlen(tmp) >= maxlen) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- _("\'%s\' value longer than %zu bytes"),
- xpath, maxlen);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("\'%s\' value longer than %zu bytes"),
+ xpath, maxlen);
VIR_FREE(tmp);
return NULL;
}
xmlNodePtr relnode;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathNumber()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathNumber()"));
return -1;
}
relnode = ctxt->node;
int ret = 0;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathLong()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathLong()"));
return -1;
}
relnode = ctxt->node;
int ret = 0;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathULong()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathULong()"));
return -1;
}
relnode = ctxt->node;
int ret = 0;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathULong()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathULong()"));
return -1;
}
relnode = ctxt->node;
int ret = 0;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathLongLong()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathLongLong()"));
return -1;
}
relnode = ctxt->node;
int ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathBoolean()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathBoolean()"));
return -1;
}
relnode = ctxt->node;
xmlNodePtr ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathNode()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathNode()"));
return NULL;
}
relnode = ctxt->node;
int ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid parameter to virXPathNodeSet()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid parameter to virXPathNodeSet()"));
return -1;
}
return 0;
if (obj->type != XPATH_NODESET) {
- virXMLError(VIR_ERR_INTERNAL_ERROR,
- _("Incorrect xpath '%s'"), xpath);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Incorrect xpath '%s'"), xpath);
xmlXPathFreeObject(obj);
return -1;
}