Replace use of XENXS_ERROR with virReportError

Update the XenXS shared code to use virReportError instead
of the XENXS_ERROR custom macro

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-07-18 14:17:20 +01:00
parent 29bf82593c
commit 76a0ecd2cd
4 changed files with 238 additions and 243 deletions

1
cfg.mk
View File

@ -512,7 +512,6 @@ msg_gen_function += HYPERV_ERROR
msg_gen_function += PHYP_ERROR msg_gen_function += PHYP_ERROR
msg_gen_function += VIR_ERROR msg_gen_function += VIR_ERROR
msg_gen_function += VMX_ERROR msg_gen_function += VMX_ERROR
msg_gen_function += XENXS_ERROR
msg_gen_function += lxcError msg_gen_function += lxcError
msg_gen_function += libxlError msg_gen_function += libxlError
msg_gen_function += nodeReportError msg_gen_function += nodeReportError

View File

@ -56,7 +56,7 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion)
int id = -1; int id = -1;
const char * tmp = sexpr_node(root, "domain/domid"); const char * tmp = sexpr_node(root, "domain/domid");
if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */ if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing id")); "%s", _("domain information incomplete, missing id"));
} else { } else {
id = tmp ? sexpr_int(root, "domain/domid") : -1; id = tmp ? sexpr_int(root, "domain/domid") : -1;
@ -93,7 +93,7 @@ xenParseSxprOS(const struct sexpr *node,
goto no_memory; goto no_memory;
if (def->os.loader == NULL) { if (def->os.loader == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing HVM loader")); "%s", _("domain information incomplete, missing HVM loader"));
return -1; return -1;
} }
@ -153,7 +153,7 @@ xenParseSxprOS(const struct sexpr *node,
if (!hvm && if (!hvm &&
!def->os.kernel && !def->os.kernel &&
!def->os.bootloader) { !def->os.bootloader) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing kernel & bootloader")); "%s", _("domain information incomplete, missing kernel & bootloader"));
return -1; return -1;
} }
@ -204,7 +204,7 @@ xenParseSxprChar(const char *value,
def->source.data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET; def->source.data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
} else { } else {
if ((def->source.type = virDomainChrTypeFromString(prefix)) < 0) { if ((def->source.type = virDomainChrTypeFromString(prefix)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown chr device type '%s'"), prefix); _("unknown chr device type '%s'"), prefix);
goto error; goto error;
} }
@ -230,7 +230,7 @@ xenParseSxprChar(const char *value,
const char *offset2; const char *offset2;
if (offset == NULL) { if (offset == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -260,7 +260,7 @@ xenParseSxprChar(const char *value,
const char *offset2, *offset3; const char *offset2, *offset3;
if (offset == NULL) { if (offset == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -278,7 +278,7 @@ xenParseSxprChar(const char *value,
offset3 = strchr(offset2, ':'); offset3 = strchr(offset2, ':');
if (offset3 == NULL) { if (offset3 == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string")); "%s", _("malformed char device string"));
goto error; goto error;
} }
@ -382,7 +382,7 @@ xenParseSxprDisks(virDomainDefPtr def,
goto no_memory; goto no_memory;
if (dst == NULL) { if (dst == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, vbd has no dev")); "%s", _("domain information incomplete, vbd has no dev"));
goto error; goto error;
} }
@ -393,7 +393,7 @@ xenParseSxprDisks(virDomainDefPtr def,
if (!offset || if (!offset ||
!hvm || !hvm ||
STRNEQ(offset, ":cdrom")) { STRNEQ(offset, ":cdrom")) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, vbd has no src")); "%s", _("domain information incomplete, vbd has no src"));
goto error; goto error;
} }
@ -402,7 +402,7 @@ xenParseSxprDisks(virDomainDefPtr def,
if (src != NULL) { if (src != NULL) {
offset = strchr(src, ':'); offset = strchr(src, ':');
if (!offset) { if (!offset) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot parse vbd filename, missing driver name")); "%s", _("cannot parse vbd filename, missing driver name"));
goto error; goto error;
} }
@ -416,7 +416,7 @@ xenParseSxprDisks(virDomainDefPtr def,
goto no_memory; goto no_memory;
if (virStrncpy(disk->driverName, src, offset-src, if (virStrncpy(disk->driverName, src, offset-src,
(offset-src)+1) == NULL) { (offset-src)+1) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Driver name %s too big for destination"), _("Driver name %s too big for destination"),
src); src);
goto error; goto error;
@ -429,7 +429,7 @@ xenParseSxprDisks(virDomainDefPtr def,
STREQ (disk->driverName, "tap2")) { STREQ (disk->driverName, "tap2")) {
offset = strchr(src, ':'); offset = strchr(src, ':');
if (!offset) { if (!offset) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot parse vbd filename, missing driver type")); "%s", _("cannot parse vbd filename, missing driver type"));
goto error; goto error;
} }
@ -438,7 +438,7 @@ xenParseSxprDisks(virDomainDefPtr def,
goto no_memory; goto no_memory;
if (virStrncpy(disk->driverType, src, offset-src, if (virStrncpy(disk->driverType, src, offset-src,
(offset-src)+1) == NULL) { (offset-src)+1) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Driver type %s too big for destination"), _("Driver type %s too big for destination"),
src); src);
goto error; goto error;
@ -601,7 +601,7 @@ xenParseSxprNets(virDomainDefPtr def,
tmp = sexpr_node(node, "device/vif/mac"); tmp = sexpr_node(node, "device/vif/mac");
if (tmp) { if (tmp) {
if (virMacAddrParse(tmp, &net->mac) < 0) { if (virMacAddrParse(tmp, &net->mac) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("malformed mac address '%s'"), tmp); _("malformed mac address '%s'"), tmp);
goto cleanup; goto cleanup;
} }
@ -688,7 +688,7 @@ xenParseSxprSound(virDomainDefPtr def,
else else
len = strlen(offset); len = strlen(offset);
if (virStrncpy(model, offset, len, sizeof(model)) == NULL) { if (virStrncpy(model, offset, len, sizeof(model)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Sound model %s too big for destination"), _("Sound model %s too big for destination"),
offset); offset);
goto error; goto error;
@ -910,7 +910,7 @@ xenParseSxprGraphicsNew(virDomainDefPtr def,
goto no_memory; goto no_memory;
if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) { if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown graphics type '%s'"), tmp); _("unknown graphics type '%s'"), tmp);
goto error; goto error;
} }
@ -1035,43 +1035,43 @@ xenParseSxprPCI(virDomainDefPtr def,
continue; continue;
if (!(domain = sexpr_node(node, "dev/domain"))) { if (!(domain = sexpr_node(node, "dev/domain"))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI domain")); "%s", _("missing PCI domain"));
goto error; goto error;
} }
if (!(bus = sexpr_node(node, "dev/bus"))) { if (!(bus = sexpr_node(node, "dev/bus"))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI bus")); "%s", _("missing PCI bus"));
goto error; goto error;
} }
if (!(slot = sexpr_node(node, "dev/slot"))) { if (!(slot = sexpr_node(node, "dev/slot"))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI slot")); "%s", _("missing PCI slot"));
goto error; goto error;
} }
if (!(func = sexpr_node(node, "dev/func"))) { if (!(func = sexpr_node(node, "dev/func"))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI func")); "%s", _("missing PCI func"));
goto error; goto error;
} }
if (virStrToLong_i(domain, NULL, 0, &domainID) < 0) { if (virStrToLong_i(domain, NULL, 0, &domainID) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI domain '%s'"), domain); _("cannot parse PCI domain '%s'"), domain);
goto error; goto error;
} }
if (virStrToLong_i(bus, NULL, 0, &busID) < 0) { if (virStrToLong_i(bus, NULL, 0, &busID) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI bus '%s'"), bus); _("cannot parse PCI bus '%s'"), bus);
goto error; goto error;
} }
if (virStrToLong_i(slot, NULL, 0, &slotID) < 0) { if (virStrToLong_i(slot, NULL, 0, &slotID) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI slot '%s'"), slot); _("cannot parse PCI slot '%s'"), slot);
goto error; goto error;
} }
if (virStrToLong_i(func, NULL, 0, &funcID) < 0) { if (virStrToLong_i(func, NULL, 0, &funcID) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI func '%s'"), func); _("cannot parse PCI func '%s'"), func);
goto error; goto error;
} }
@ -1134,7 +1134,7 @@ xenParseSxpr(const struct sexpr *root,
tmp = sexpr_node(root, "domain/domid"); tmp = sexpr_node(root, "domain/domid");
if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */ if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing id")); "%s", _("domain information incomplete, missing id"));
goto error; goto error;
} }
@ -1147,14 +1147,14 @@ xenParseSxpr(const struct sexpr *root,
if (sexpr_node_copy(root, "domain/name", &def->name) < 0) if (sexpr_node_copy(root, "domain/name", &def->name) < 0)
goto no_memory; goto no_memory;
if (def->name == NULL) { if (def->name == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing name")); "%s", _("domain information incomplete, missing name"));
goto error; goto error;
} }
tmp = sexpr_node(root, "domain/uuid"); tmp = sexpr_node(root, "domain/uuid");
if (tmp == NULL) { if (tmp == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing name")); "%s", _("domain information incomplete, missing name"));
goto error; goto error;
} }
@ -1205,7 +1205,7 @@ xenParseSxpr(const struct sexpr *root,
if (virDomainCpuSetParse(cpus, 0, def->cpumask, if (virDomainCpuSetParse(cpus, 0, def->cpumask,
def->cpumasklen) < 0) { def->cpumasklen) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid CPU mask %s"), cpus); _("invalid CPU mask %s"), cpus);
goto error; goto error;
} }
@ -1219,7 +1219,7 @@ xenParseSxpr(const struct sexpr *root,
tmp = sexpr_node(root, "domain/on_poweroff"); tmp = sexpr_node(root, "domain/on_poweroff");
if (tmp != NULL) { if (tmp != NULL) {
if ((def->onPoweroff = virDomainLifecycleTypeFromString(tmp)) < 0) { if ((def->onPoweroff = virDomainLifecycleTypeFromString(tmp)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp); _("unknown lifecycle type %s"), tmp);
goto error; goto error;
} }
@ -1229,7 +1229,7 @@ xenParseSxpr(const struct sexpr *root,
tmp = sexpr_node(root, "domain/on_reboot"); tmp = sexpr_node(root, "domain/on_reboot");
if (tmp != NULL) { if (tmp != NULL) {
if ((def->onReboot = virDomainLifecycleTypeFromString(tmp)) < 0) { if ((def->onReboot = virDomainLifecycleTypeFromString(tmp)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp); _("unknown lifecycle type %s"), tmp);
goto error; goto error;
} }
@ -1239,7 +1239,7 @@ xenParseSxpr(const struct sexpr *root,
tmp = sexpr_node(root, "domain/on_crash"); tmp = sexpr_node(root, "domain/on_crash");
if (tmp != NULL) { if (tmp != NULL) {
if ((def->onCrash = virDomainLifecycleCrashTypeFromString(tmp)) < 0) { if ((def->onCrash = virDomainLifecycleCrashTypeFromString(tmp)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp); _("unknown lifecycle type %s"), tmp);
goto error; goto error;
} }
@ -1265,7 +1265,7 @@ xenParseSxpr(const struct sexpr *root,
const char *value = sexpr_node(root, "domain/image/hvm/localtime"); const char *value = sexpr_node(root, "domain/image/hvm/localtime");
if (value) { if (value) {
if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) { if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown localtime offset %s"), value); _("unknown localtime offset %s"), value);
goto error; goto error;
} }
@ -1307,7 +1307,7 @@ xenParseSxpr(const struct sexpr *root,
const char *value = sexpr_node(root, "domain/image/linux/localtime"); const char *value = sexpr_node(root, "domain/image/linux/localtime");
if (value) { if (value) {
if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) { if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown localtime offset %s"), value); _("unknown localtime offset %s"), value);
goto error; goto error;
} }
@ -1575,7 +1575,7 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected graphics type %d"), _("unexpected graphics type %d"),
def->type); def->type);
return -1; return -1;
@ -1634,7 +1634,7 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected graphics type %d"), _("unexpected graphics type %d"),
def->type); def->type);
return -1; return -1;
@ -1688,7 +1688,7 @@ xenFormatSxprChr(virDomainChrDefPtr def,
const char *type = virDomainChrTypeToString(def->source.type); const char *type = virDomainChrTypeToString(def->source.type);
if (!type) { if (!type) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected chr device type")); "%s", _("unexpected chr device type"));
return -1; return -1;
} }
@ -1744,7 +1744,7 @@ xenFormatSxprChr(virDomainChrDefPtr def,
break; break;
default: default:
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported chr device type '%s'"), type); _("unsupported chr device type '%s'"), type);
return -1; return -1;
} }
@ -1783,7 +1783,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
if (hvm && if (hvm &&
def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (isAttach) { if (isAttach) {
XENXS_ERROR(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("Cannot directly attach floppy %s"), def->src); _("Cannot directly attach floppy %s"), def->src);
return -1; return -1;
} }
@ -1795,7 +1795,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
def->device == VIR_DOMAIN_DISK_DEVICE_CDROM && def->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
xendConfigVersion == XEND_CONFIG_VERSION_3_0_2) { xendConfigVersion == XEND_CONFIG_VERSION_3_0_2) {
if (isAttach) { if (isAttach) {
XENXS_ERROR(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("Cannot directly attach CDROM %s"), def->src); _("Cannot directly attach CDROM %s"), def->src);
return -1; return -1;
} }
@ -1855,7 +1855,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
virBufferEscapeSexpr(buf, "(uname 'phy:/dev/%s')", virBufferEscapeSexpr(buf, "(uname 'phy:/dev/%s')",
def->src); def->src);
} else { } else {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported disk type %s"), _("unsupported disk type %s"),
virDomainDiskTypeToString(def->type)); virDomainDiskTypeToString(def->type));
return -1; return -1;
@ -1870,7 +1870,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
else else
virBufferAddLit(buf, "(mode 'w')"); virBufferAddLit(buf, "(mode 'w')");
if (def->transient) { if (def->transient) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("transient disks not supported yet")); _("transient disks not supported yet"));
return -1; return -1;
} }
@ -1912,14 +1912,14 @@ xenFormatSxprNet(virConnectPtr conn,
if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE && if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
def->type != VIR_DOMAIN_NET_TYPE_NETWORK && def->type != VIR_DOMAIN_NET_TYPE_NETWORK &&
def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) { def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported network type %d"), def->type); _("unsupported network type %d"), def->type);
return -1; return -1;
} }
if (def->script && if (def->script &&
def->type != VIR_DOMAIN_NET_TYPE_BRIDGE && def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) { def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("scripts are not supported on interfaces of type %s"), _("scripts are not supported on interfaces of type %s"),
virDomainNetTypeToString(def->type)); virDomainNetTypeToString(def->type));
return -1; return -1;
@ -1953,7 +1953,7 @@ xenFormatSxprNet(virConnectPtr conn,
char *bridge; char *bridge;
if (!network) { if (!network) {
XENXS_ERROR(VIR_ERR_NO_NETWORK, "%s", virReportError(VIR_ERR_NO_NETWORK, "%s",
def->data.network.name); def->data.network.name);
return -1; return -1;
} }
@ -1961,7 +1961,7 @@ xenFormatSxprNet(virConnectPtr conn,
bridge = virNetworkGetBridgeName(network); bridge = virNetworkGetBridgeName(network);
virNetworkFree(network); virNetworkFree(network);
if (!bridge) { if (!bridge) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("network %s is not active"), _("network %s is not active"),
def->data.network.name); def->data.network.name);
return -1; return -1;
@ -2063,7 +2063,7 @@ xenFormatSxprOnePCI(virDomainHostdevDefPtr def,
int detach) int detach)
{ {
if (def->managed) { if (def->managed) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("managed PCI devices not supported with XenD")); _("managed PCI devices not supported with XenD"));
return -1; return -1;
} }
@ -2123,7 +2123,7 @@ xenFormatSxprAllPCI(virDomainDefPtr def,
if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { def->hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
if (def->hostdevs[i]->managed) { if (def->hostdevs[i]->managed) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("managed PCI devices not supported with XenD")); _("managed PCI devices not supported with XenD"));
return -1; return -1;
} }
@ -2155,7 +2155,7 @@ xenFormatSxprSound(virDomainDefPtr def,
for (i = 0 ; i < def->nsounds ; i++) { for (i = 0 ; i < def->nsounds ; i++) {
if (!(str = virDomainSoundModelTypeToString(def->sounds[i]->model))) { if (!(str = virDomainSoundModelTypeToString(def->sounds[i]->model))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected sound model %d"), _("unexpected sound model %d"),
def->sounds[i]->model); def->sounds[i]->model);
return -1; return -1;
@ -2192,7 +2192,7 @@ xenFormatSxprInput(virDomainInputDefPtr input,
if (input->type != VIR_DOMAIN_INPUT_TYPE_MOUSE && if (input->type != VIR_DOMAIN_INPUT_TYPE_MOUSE &&
input->type != VIR_DOMAIN_INPUT_TYPE_TABLET) { input->type != VIR_DOMAIN_INPUT_TYPE_TABLET) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected input type %d"), input->type); _("unexpected input type %d"), input->type);
return -1; return -1;
} }
@ -2270,21 +2270,21 @@ xenFormatSxpr(virConnectPtr conn,
} }
if (!(tmp = virDomainLifecycleTypeToString(def->onPoweroff))) { if (!(tmp = virDomainLifecycleTypeToString(def->onPoweroff))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onPoweroff); _("unexpected lifecycle value %d"), def->onPoweroff);
goto error; goto error;
} }
virBufferAsprintf(&buf, "(on_poweroff '%s')", tmp); virBufferAsprintf(&buf, "(on_poweroff '%s')", tmp);
if (!(tmp = virDomainLifecycleTypeToString(def->onReboot))) { if (!(tmp = virDomainLifecycleTypeToString(def->onReboot))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onReboot); _("unexpected lifecycle value %d"), def->onReboot);
goto error; goto error;
} }
virBufferAsprintf(&buf, "(on_reboot '%s')", tmp); virBufferAsprintf(&buf, "(on_reboot '%s')", tmp);
if (!(tmp = virDomainLifecycleCrashTypeToString(def->onCrash))) { if (!(tmp = virDomainLifecycleCrashTypeToString(def->onCrash))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onCrash); _("unexpected lifecycle value %d"), def->onCrash);
goto error; goto error;
} }
@ -2302,7 +2302,7 @@ xenFormatSxpr(virConnectPtr conn,
if (hvm && if (hvm &&
def->os.loader == NULL) { def->os.loader == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s",_("no HVM domain loader")); "%s",_("no HVM domain loader"));
goto error; goto error;
} }
@ -2492,7 +2492,7 @@ xenFormatSxpr(virConnectPtr conn,
vmlocaltime = 1; vmlocaltime = 1;
break; break;
default: default:
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset='%s'"), _("unsupported clock offset='%s'"),
virDomainClockOffsetTypeToString(def->clock.offset)); virDomainClockOffsetTypeToString(def->clock.offset));
goto error; goto error;
@ -2515,7 +2515,7 @@ xenFormatSxpr(virConnectPtr conn,
break; break;
case VIR_DOMAIN_CLOCK_OFFSET_UTC: case VIR_DOMAIN_CLOCK_OFFSET_UTC:
if (def->clock.data.utc_reset) { if (def->clock.data.utc_reset) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock adjustment='reset'")); _("unsupported clock adjustment='reset'"));
goto error; goto error;
} }
@ -2524,7 +2524,7 @@ xenFormatSxpr(virConnectPtr conn,
break; break;
case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
if (def->clock.data.utc_reset) { if (def->clock.data.utc_reset) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock adjustment='reset'")); _("unsupported clock adjustment='reset'"));
goto error; goto error;
} }
@ -2532,7 +2532,7 @@ xenFormatSxpr(virConnectPtr conn,
rtc_timeoffset = 0; rtc_timeoffset = 0;
break; break;
default: default:
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset='%s'"), _("unsupported clock offset='%s'"),
virDomainClockOffsetTypeToString(def->clock.offset)); virDomainClockOffsetTypeToString(def->clock.offset));
goto error; goto error;
@ -2548,7 +2548,7 @@ xenFormatSxpr(virConnectPtr conn,
vmlocaltime = 1; vmlocaltime = 1;
break; break;
default: default:
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset='%s'"), _("unsupported clock offset='%s'"),
virDomainClockOffsetTypeToString(def->clock.offset)); virDomainClockOffsetTypeToString(def->clock.offset));
goto error; goto error;

View File

@ -56,7 +56,7 @@ static int xenXMConfigGetBool(virConfPtr conf,
} else if (val->type == VIR_CONF_STRING) { } else if (val->type == VIR_CONF_STRING) {
*value = STREQ(val->str, "1") ? 1 : 0; *value = STREQ(val->str, "1") ? 1 : 0;
} else { } else {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name); _("config value %s was malformed"), name);
return -1; return -1;
} }
@ -83,12 +83,12 @@ static int xenXMConfigGetULong(virConfPtr conf,
char *ret; char *ret;
*value = strtol(val->str, &ret, 10); *value = strtol(val->str, &ret, 10);
if (ret == val->str) { if (ret == val->str) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name); _("config value %s was malformed"), name);
return -1; return -1;
} }
} else { } else {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name); _("config value %s was malformed"), name);
return -1; return -1;
} }
@ -115,12 +115,12 @@ static int xenXMConfigGetULongLong(virConfPtr conf,
char *ret; char *ret;
*value = strtoll(val->str, &ret, 10); *value = strtoll(val->str, &ret, 10);
if (ret == val->str) { if (ret == val->str) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name); _("config value %s was malformed"), name);
return -1; return -1;
} }
} else { } else {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name); _("config value %s was malformed"), name);
return -1; return -1;
} }
@ -142,7 +142,7 @@ static int xenXMConfigGetString(virConfPtr conf,
} }
if (val->type != VIR_CONF_STRING) { if (val->type != VIR_CONF_STRING) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was malformed"), name); _("config value %s was malformed"), name);
return -1; return -1;
} }
@ -163,20 +163,20 @@ static int xenXMConfigCopyStringInternal(virConfPtr conf,
if (!(val = virConfGetValue(conf, name))) { if (!(val = virConfGetValue(conf, name))) {
if (allowMissing) if (allowMissing)
return 0; return 0;
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was missing"), name); _("config value %s was missing"), name);
return -1; return -1;
} }
if (val->type != VIR_CONF_STRING) { if (val->type != VIR_CONF_STRING) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was not a string"), name); _("config value %s was not a string"), name);
return -1; return -1;
} }
if (!val->str) { if (!val->str) {
if (allowMissing) if (allowMissing)
return 0; return 0;
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("config value %s was missing"), name); _("config value %s was missing"), name);
return -1; return -1;
} }
@ -208,31 +208,31 @@ static int xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *
virConfValuePtr val; virConfValuePtr val;
if (!uuid || !name || !conf) { if (!uuid || !name || !conf) {
XENXS_ERROR(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("Arguments must be non null")); _("Arguments must be non null"));
return -1; return -1;
} }
if (!(val = virConfGetValue(conf, name))) { if (!(val = virConfGetValue(conf, name))) {
XENXS_ERROR(VIR_ERR_CONF_SYNTAX, virReportError(VIR_ERR_CONF_SYNTAX,
_("config value %s was missing"), name); _("config value %s was missing"), name);
return -1; return -1;
} }
if (val->type != VIR_CONF_STRING) { if (val->type != VIR_CONF_STRING) {
XENXS_ERROR(VIR_ERR_CONF_SYNTAX, virReportError(VIR_ERR_CONF_SYNTAX,
_("config value %s not a string"), name); _("config value %s not a string"), name);
return -1; return -1;
} }
if (!val->str) { if (!val->str) {
XENXS_ERROR(VIR_ERR_CONF_SYNTAX, virReportError(VIR_ERR_CONF_SYNTAX,
_("%s can't be empty"), name); _("%s can't be empty"), name);
return -1; return -1;
} }
if (virUUIDParse(val->str, uuid) < 0) { if (virUUIDParse(val->str, uuid) < 0) {
XENXS_ERROR(VIR_ERR_CONF_SYNTAX, virReportError(VIR_ERR_CONF_SYNTAX,
_("%s not parseable"), val->str); _("%s not parseable"), val->str);
return -1; return -1;
} }
@ -287,7 +287,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type, virDomainVirtTypeToString(def->virtType)); defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type, virDomainVirtTypeToString(def->virtType));
if (defaultArch == NULL) { if (defaultArch == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("no supported architecture for os type '%s'"), _("no supported architecture for os type '%s'"),
def->os.type); def->os.type);
goto cleanup; goto cleanup;
@ -379,7 +379,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (xenXMConfigGetString(conf, "on_poweroff", &str, "destroy") < 0) if (xenXMConfigGetString(conf, "on_poweroff", &str, "destroy") < 0)
goto cleanup; goto cleanup;
if ((def->onPoweroff = virDomainLifecycleTypeFromString(str)) < 0) { if ((def->onPoweroff = virDomainLifecycleTypeFromString(str)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected value %s for on_poweroff"), str); _("unexpected value %s for on_poweroff"), str);
goto cleanup; goto cleanup;
} }
@ -387,7 +387,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (xenXMConfigGetString(conf, "on_reboot", &str, "restart") < 0) if (xenXMConfigGetString(conf, "on_reboot", &str, "restart") < 0)
goto cleanup; goto cleanup;
if ((def->onReboot = virDomainLifecycleTypeFromString(str)) < 0) { if ((def->onReboot = virDomainLifecycleTypeFromString(str)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected value %s for on_reboot"), str); _("unexpected value %s for on_reboot"), str);
goto cleanup; goto cleanup;
} }
@ -395,7 +395,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (xenXMConfigGetString(conf, "on_crash", &str, "restart") < 0) if (xenXMConfigGetString(conf, "on_crash", &str, "restart") < 0)
goto cleanup; goto cleanup;
if ((def->onCrash = virDomainLifecycleCrashTypeFromString(str)) < 0) { if ((def->onCrash = virDomainLifecycleCrashTypeFromString(str)) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected value %s for on_crash"), str); _("unexpected value %s for on_crash"), str);
goto cleanup; goto cleanup;
} }
@ -509,7 +509,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto no_memory; goto no_memory;
if (virStrncpy(disk->src, head, offset - head, if (virStrncpy(disk->src, head, offset - head,
(offset - head) + 1) == NULL) { (offset - head) + 1) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Source file %s too big for destination"), _("Source file %s too big for destination"),
head); head);
goto cleanup; goto cleanup;
@ -528,7 +528,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto no_memory; goto no_memory;
if (virStrncpy(disk->dst, head, offset - head, if (virStrncpy(disk->dst, head, offset - head,
(offset - head) + 1) == NULL) { (offset - head) + 1) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Dest file %s too big for destination"), head); _("Dest file %s too big for destination"), head);
goto cleanup; goto cleanup;
} }
@ -544,7 +544,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (virStrncpy(disk->driverName, disk->src, if (virStrncpy(disk->driverName, disk->src,
(tmp - disk->src), (tmp - disk->src),
(tmp - disk->src) + 1) == NULL) { (tmp - disk->src) + 1) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Driver name %s too big for destination"), _("Driver name %s too big for destination"),
disk->src); disk->src);
goto cleanup; goto cleanup;
@ -565,7 +565,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (virStrncpy(disk->driverType, disk->src, if (virStrncpy(disk->driverType, disk->src,
(tmp - disk->src), (tmp - disk->src),
(tmp - disk->src) + 1) == NULL) { (tmp - disk->src) + 1) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Driver type %s too big for destination"), _("Driver type %s too big for destination"),
disk->src); disk->src);
goto cleanup; goto cleanup;
@ -681,7 +681,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (STRPREFIX(key, "mac=")) { if (STRPREFIX(key, "mac=")) {
int len = nextkey ? (nextkey - data) : sizeof(mac) - 1; int len = nextkey ? (nextkey - data) : sizeof(mac) - 1;
if (virStrncpy(mac, data, len, sizeof(mac)) == NULL) { if (virStrncpy(mac, data, len, sizeof(mac)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("MAC address %s too big for destination"), _("MAC address %s too big for destination"),
data); data);
goto skipnic; goto skipnic;
@ -689,7 +689,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
} else if (STRPREFIX(key, "bridge=")) { } else if (STRPREFIX(key, "bridge=")) {
int len = nextkey ? (nextkey - data) : sizeof(bridge) - 1; int len = nextkey ? (nextkey - data) : sizeof(bridge) - 1;
if (virStrncpy(bridge, data, len, sizeof(bridge)) == NULL) { if (virStrncpy(bridge, data, len, sizeof(bridge)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Bridge %s too big for destination"), _("Bridge %s too big for destination"),
data); data);
goto skipnic; goto skipnic;
@ -703,21 +703,21 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
} else if (STRPREFIX(key, "model=")) { } else if (STRPREFIX(key, "model=")) {
int len = nextkey ? (nextkey - data) : sizeof(model) - 1; int len = nextkey ? (nextkey - data) : sizeof(model) - 1;
if (virStrncpy(model, data, len, sizeof(model)) == NULL) { if (virStrncpy(model, data, len, sizeof(model)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Model %s too big for destination"), data); _("Model %s too big for destination"), data);
goto skipnic; goto skipnic;
} }
} else if (STRPREFIX(key, "type=")) { } else if (STRPREFIX(key, "type=")) {
int len = nextkey ? (nextkey - data) : sizeof(type) - 1; int len = nextkey ? (nextkey - data) : sizeof(type) - 1;
if (virStrncpy(type, data, len, sizeof(type)) == NULL) { if (virStrncpy(type, data, len, sizeof(type)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Type %s too big for destination"), data); _("Type %s too big for destination"), data);
goto skipnic; goto skipnic;
} }
} else if (STRPREFIX(key, "vifname=")) { } else if (STRPREFIX(key, "vifname=")) {
int len = nextkey ? (nextkey - data) : sizeof(vifname) - 1; int len = nextkey ? (nextkey - data) : sizeof(vifname) - 1;
if (virStrncpy(vifname, data, len, sizeof(vifname)) == NULL) { if (virStrncpy(vifname, data, len, sizeof(vifname)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Vifname %s too big for destination"), _("Vifname %s too big for destination"),
data); data);
goto skipnic; goto skipnic;
@ -725,7 +725,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
} else if (STRPREFIX(key, "ip=")) { } else if (STRPREFIX(key, "ip=")) {
int len = nextkey ? (nextkey - data) : sizeof(ip) - 1; int len = nextkey ? (nextkey - data) : sizeof(ip) - 1;
if (virStrncpy(ip, data, len, sizeof(ip)) == NULL) { if (virStrncpy(ip, data, len, sizeof(ip)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("IP %s too big for destination"), data); _("IP %s too big for destination"), data);
goto skipnic; goto skipnic;
} }
@ -743,7 +743,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (mac[0]) { if (mac[0]) {
if (virMacAddrParse(mac, &net->mac) < 0) { if (virMacAddrParse(mac, &net->mac) < 0) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("malformed mac address '%s'"), mac); _("malformed mac address '%s'"), mac);
goto cleanup; goto cleanup;
} }
@ -823,7 +823,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto skippci; goto skippci;
if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) == NULL) { if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Domain %s too big for destination"), key); _("Domain %s too big for destination"), key);
goto skippci; goto skippci;
} }
@ -833,7 +833,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto skippci; goto skippci;
if (virStrncpy(bus, key, (nextkey - key), sizeof(bus)) == NULL) { if (virStrncpy(bus, key, (nextkey - key), sizeof(bus)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Bus %s too big for destination"), key); _("Bus %s too big for destination"), key);
goto skippci; goto skippci;
} }
@ -843,7 +843,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto skippci; goto skippci;
if (virStrncpy(slot, key, (nextkey - key), sizeof(slot)) == NULL) { if (virStrncpy(slot, key, (nextkey - key), sizeof(slot)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Slot %s too big for destination"), key); _("Slot %s too big for destination"), key);
goto skippci; goto skippci;
} }
@ -853,7 +853,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto skippci; goto skippci;
if (virStrncpy(func, key, 1, sizeof(func)) == NULL) { if (virStrncpy(func, key, 1, sizeof(func)) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Function %s too big for destination"), key); _("Function %s too big for destination"), key);
goto skippci; goto skippci;
} }
@ -979,7 +979,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
char *key = vfb; char *key = vfb;
if (virStrcpyStatic(vfb, list->list->str) == NULL) { if (virStrcpyStatic(vfb, list->list->str) == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("VFB %s too big for destination"), _("VFB %s too big for destination"),
list->list->str); list->list->str);
goto cleanup; goto cleanup;
@ -1159,7 +1159,7 @@ int xenXMConfigSetInt(virConfPtr conf, const char *setting, long long l) {
virConfValuePtr value = NULL; virConfValuePtr value = NULL;
if ((long) l != l) { if ((long) l != l) {
XENXS_ERROR(VIR_ERR_OVERFLOW, _("failed to store %lld to %s"), virReportError(VIR_ERR_OVERFLOW, _("failed to store %lld to %s"),
l, setting); l, setting);
return -1; return -1;
} }
@ -1219,7 +1219,7 @@ static int xenFormatXMDisk(virConfValuePtr list,
virBufferAddLit(&buf, "phy:"); virBufferAddLit(&buf, "phy:");
break; break;
default: default:
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type %s"), _("unsupported disk type %s"),
virDomainDiskTypeToString(disk->type)); virDomainDiskTypeToString(disk->type));
goto cleanup; goto cleanup;
@ -1242,7 +1242,7 @@ static int xenFormatXMDisk(virConfValuePtr list,
else else
virBufferAddLit(&buf, ",w"); virBufferAddLit(&buf, ",w");
if (disk->transient) { if (disk->transient) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("transient disks not supported yet")); _("transient disks not supported yet"));
return -1; return -1;
} }
@ -1350,14 +1350,14 @@ static int xenFormatXMNet(virConnectPtr conn,
virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name); virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name);
char *bridge; char *bridge;
if (!network) { if (!network) {
XENXS_ERROR(VIR_ERR_NO_NETWORK, "%s", virReportError(VIR_ERR_NO_NETWORK, "%s",
net->data.network.name); net->data.network.name);
return -1; return -1;
} }
bridge = virNetworkGetBridgeName(network); bridge = virNetworkGetBridgeName(network);
virNetworkFree(network); virNetworkFree(network);
if (!bridge) { if (!bridge) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("network %s is not active"), _("network %s is not active"),
net->data.network.name); net->data.network.name);
return -1; return -1;
@ -1369,7 +1369,7 @@ static int xenFormatXMNet(virConnectPtr conn,
break; break;
default: default:
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported network type %d"), _("unsupported network type %d"),
net->type); net->type);
goto cleanup; goto cleanup;
@ -1670,7 +1670,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
vmlocaltime = 1; vmlocaltime = 1;
break; break;
default: default:
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset='%s'"), _("unsupported clock offset='%s'"),
virDomainClockOffsetTypeToString(def->clock.offset)); virDomainClockOffsetTypeToString(def->clock.offset));
goto cleanup; goto cleanup;
@ -1686,7 +1686,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
break; break;
case VIR_DOMAIN_CLOCK_OFFSET_UTC: case VIR_DOMAIN_CLOCK_OFFSET_UTC:
if (def->clock.data.utc_reset) { if (def->clock.data.utc_reset) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock adjustment='reset'")); _("unsupported clock adjustment='reset'"));
goto cleanup; goto cleanup;
} }
@ -1695,7 +1695,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
break; break;
case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
if (def->clock.data.utc_reset) { if (def->clock.data.utc_reset) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock adjustment='reset'")); _("unsupported clock adjustment='reset'"));
goto cleanup; goto cleanup;
} }
@ -1703,7 +1703,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
rtc_timeoffset = 0; rtc_timeoffset = 0;
break; break;
default: default:
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset='%s'"), _("unsupported clock offset='%s'"),
virDomainClockOffsetTypeToString(def->clock.offset)); virDomainClockOffsetTypeToString(def->clock.offset));
goto cleanup; goto cleanup;
@ -1720,7 +1720,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
vmlocaltime = 1; vmlocaltime = 1;
break; break;
default: default:
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset='%s'"), _("unsupported clock offset='%s'"),
virDomainClockOffsetTypeToString(def->clock.offset)); virDomainClockOffsetTypeToString(def->clock.offset));
goto cleanup; goto cleanup;
@ -1732,7 +1732,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
if (!(lifecycle = virDomainLifecycleTypeToString(def->onPoweroff))) { if (!(lifecycle = virDomainLifecycleTypeToString(def->onPoweroff))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle action %d"), def->onPoweroff); _("unexpected lifecycle action %d"), def->onPoweroff);
goto cleanup; goto cleanup;
} }
@ -1741,7 +1741,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
if (!(lifecycle = virDomainLifecycleTypeToString(def->onReboot))) { if (!(lifecycle = virDomainLifecycleTypeToString(def->onReboot))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle action %d"), def->onReboot); _("unexpected lifecycle action %d"), def->onReboot);
goto cleanup; goto cleanup;
} }
@ -1750,7 +1750,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
if (!(lifecycle = virDomainLifecycleCrashTypeToString(def->onCrash))) { if (!(lifecycle = virDomainLifecycleCrashTypeToString(def->onCrash))) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle action %d"), def->onCrash); _("unexpected lifecycle action %d"), def->onCrash);
goto cleanup; goto cleanup;
} }

View File

@ -57,8 +57,4 @@
# define VIR_FROM_THIS VIR_FROM_NONE # define VIR_FROM_THIS VIR_FROM_NONE
# define XENXS_ERROR(code, ...) \
virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, __FUNCTION__, \
__LINE__, __VA_ARGS__)
#endif /* __VIR_XENXS_PRIVATE_H__ */ #endif /* __VIR_XENXS_PRIVATE_H__ */