diff --git a/cfg.mk b/cfg.mk index 5e2a4be317..dcde9e9d32 100644 --- a/cfg.mk +++ b/cfg.mk @@ -512,7 +512,6 @@ msg_gen_function += HYPERV_ERROR msg_gen_function += PHYP_ERROR msg_gen_function += VIR_ERROR msg_gen_function += VMX_ERROR -msg_gen_function += XENXS_ERROR msg_gen_function += lxcError msg_gen_function += libxlError msg_gen_function += nodeReportError diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 2a240fc240..42533cee08 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -56,8 +56,8 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion) int id = -1; const char * tmp = sexpr_node(root, "domain/domid"); if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */ - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing id")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing id")); } else { id = tmp ? sexpr_int(root, "domain/domid") : -1; } @@ -93,8 +93,8 @@ xenParseSxprOS(const struct sexpr *node, goto no_memory; if (def->os.loader == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing HVM loader")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing HVM loader")); return -1; } } else { @@ -153,8 +153,8 @@ xenParseSxprOS(const struct sexpr *node, if (!hvm && !def->os.kernel && !def->os.bootloader) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing kernel & bootloader")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing kernel & bootloader")); return -1; } @@ -204,8 +204,8 @@ xenParseSxprChar(const char *value, def->source.data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET; } else { if ((def->source.type = virDomainChrTypeFromString(prefix)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown chr device type '%s'"), prefix); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown chr device type '%s'"), prefix); goto error; } } @@ -230,8 +230,8 @@ xenParseSxprChar(const char *value, const char *offset2; if (offset == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed char device string")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed char device string")); goto error; } @@ -260,8 +260,8 @@ xenParseSxprChar(const char *value, const char *offset2, *offset3; if (offset == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed char device string")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed char device string")); goto error; } @@ -278,8 +278,8 @@ xenParseSxprChar(const char *value, offset3 = strchr(offset2, ':'); if (offset3 == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed char device string")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed char device string")); goto error; } @@ -382,8 +382,8 @@ xenParseSxprDisks(virDomainDefPtr def, goto no_memory; if (dst == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, vbd has no dev")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, vbd has no dev")); goto error; } @@ -393,8 +393,8 @@ xenParseSxprDisks(virDomainDefPtr def, if (!offset || !hvm || STRNEQ(offset, ":cdrom")) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, vbd has no src")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, vbd has no src")); goto error; } } @@ -402,8 +402,8 @@ xenParseSxprDisks(virDomainDefPtr def, if (src != NULL) { offset = strchr(src, ':'); if (!offset) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot parse vbd filename, missing driver name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot parse vbd filename, missing driver name")); goto error; } @@ -416,9 +416,9 @@ xenParseSxprDisks(virDomainDefPtr def, goto no_memory; if (virStrncpy(disk->driverName, src, offset-src, (offset-src)+1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver name %s too big for destination"), - src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver name %s too big for destination"), + src); goto error; } } @@ -429,8 +429,8 @@ xenParseSxprDisks(virDomainDefPtr def, STREQ (disk->driverName, "tap2")) { offset = strchr(src, ':'); if (!offset) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot parse vbd filename, missing driver type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot parse vbd filename, missing driver type")); goto error; } @@ -438,9 +438,9 @@ xenParseSxprDisks(virDomainDefPtr def, goto no_memory; if (virStrncpy(disk->driverType, src, offset-src, (offset-src)+1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver type %s too big for destination"), - src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver type %s too big for destination"), + src); goto error; } @@ -601,8 +601,8 @@ xenParseSxprNets(virDomainDefPtr def, tmp = sexpr_node(node, "device/vif/mac"); if (tmp) { if (virMacAddrParse(tmp, &net->mac) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("malformed mac address '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("malformed mac address '%s'"), tmp); goto cleanup; } } @@ -688,9 +688,9 @@ xenParseSxprSound(virDomainDefPtr def, else len = strlen(offset); if (virStrncpy(model, offset, len, sizeof(model)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Sound model %s too big for destination"), - offset); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Sound model %s too big for destination"), + offset); goto error; } @@ -910,8 +910,8 @@ xenParseSxprGraphicsNew(virDomainDefPtr def, goto no_memory; if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown graphics type '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown graphics type '%s'"), tmp); goto error; } @@ -1035,44 +1035,44 @@ xenParseSxprPCI(virDomainDefPtr def, continue; if (!(domain = sexpr_node(node, "dev/domain"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI domain")); goto error; } if (!(bus = sexpr_node(node, "dev/bus"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI bus")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI bus")); goto error; } if (!(slot = sexpr_node(node, "dev/slot"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI slot")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI slot")); goto error; } if (!(func = sexpr_node(node, "dev/func"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI func")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI func")); goto error; } if (virStrToLong_i(domain, NULL, 0, &domainID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI domain '%s'"), domain); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI domain '%s'"), domain); goto error; } if (virStrToLong_i(bus, NULL, 0, &busID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI bus '%s'"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI bus '%s'"), bus); goto error; } if (virStrToLong_i(slot, NULL, 0, &slotID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI slot '%s'"), slot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI slot '%s'"), slot); goto error; } if (virStrToLong_i(func, NULL, 0, &funcID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI func '%s'"), func); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI func '%s'"), func); goto error; } @@ -1134,8 +1134,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/domid"); if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */ - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing id")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing id")); goto error; } def->virtType = VIR_DOMAIN_VIRT_XEN; @@ -1147,15 +1147,15 @@ xenParseSxpr(const struct sexpr *root, if (sexpr_node_copy(root, "domain/name", &def->name) < 0) goto no_memory; if (def->name == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing name")); goto error; } tmp = sexpr_node(root, "domain/uuid"); if (tmp == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing name")); goto error; } if (virUUIDParse(tmp, def->uuid) < 0) @@ -1205,8 +1205,8 @@ xenParseSxpr(const struct sexpr *root, if (virDomainCpuSetParse(cpus, 0, def->cpumask, def->cpumasklen) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("invalid CPU mask %s"), cpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid CPU mask %s"), cpus); goto error; } } @@ -1219,8 +1219,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/on_poweroff"); if (tmp != NULL) { if ((def->onPoweroff = virDomainLifecycleTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown lifecycle type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown lifecycle type %s"), tmp); goto error; } } else @@ -1229,8 +1229,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/on_reboot"); if (tmp != NULL) { if ((def->onReboot = virDomainLifecycleTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown lifecycle type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown lifecycle type %s"), tmp); goto error; } } else @@ -1239,8 +1239,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/on_crash"); if (tmp != NULL) { if ((def->onCrash = virDomainLifecycleCrashTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown lifecycle type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown lifecycle type %s"), tmp); goto error; } } else @@ -1265,8 +1265,8 @@ xenParseSxpr(const struct sexpr *root, const char *value = sexpr_node(root, "domain/image/hvm/localtime"); if (value) { if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown localtime offset %s"), value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown localtime offset %s"), value); goto error; } } @@ -1307,8 +1307,8 @@ xenParseSxpr(const struct sexpr *root, const char *value = sexpr_node(root, "domain/image/linux/localtime"); if (value) { if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown localtime offset %s"), value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown localtime offset %s"), value); goto error; } } @@ -1575,9 +1575,9 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected graphics type %d"), - def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected graphics type %d"), + def->type); return -1; } @@ -1634,9 +1634,9 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected graphics type %d"), - def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected graphics type %d"), + def->type); return -1; } @@ -1688,8 +1688,8 @@ xenFormatSxprChr(virDomainChrDefPtr def, const char *type = virDomainChrTypeToString(def->source.type); if (!type) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("unexpected chr device type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unexpected chr device type")); return -1; } @@ -1744,8 +1744,8 @@ xenFormatSxprChr(virDomainChrDefPtr def, break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported chr device type '%s'"), type); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported chr device type '%s'"), type); return -1; } @@ -1783,8 +1783,8 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, if (hvm && def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (isAttach) { - XENXS_ERROR(VIR_ERR_INVALID_ARG, - _("Cannot directly attach floppy %s"), def->src); + virReportError(VIR_ERR_INVALID_ARG, + _("Cannot directly attach floppy %s"), def->src); return -1; } return 0; @@ -1795,8 +1795,8 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, def->device == VIR_DOMAIN_DISK_DEVICE_CDROM && xendConfigVersion == XEND_CONFIG_VERSION_3_0_2) { if (isAttach) { - XENXS_ERROR(VIR_ERR_INVALID_ARG, - _("Cannot directly attach CDROM %s"), def->src); + virReportError(VIR_ERR_INVALID_ARG, + _("Cannot directly attach CDROM %s"), def->src); return -1; } return 0; @@ -1855,9 +1855,9 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, virBufferEscapeSexpr(buf, "(uname 'phy:/dev/%s')", def->src); } else { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported disk type %s"), - virDomainDiskTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported disk type %s"), + virDomainDiskTypeToString(def->type)); return -1; } } @@ -1870,8 +1870,8 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, else virBufferAddLit(buf, "(mode 'w')"); if (def->transient) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("transient disks not supported yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("transient disks not supported yet")); return -1; } @@ -1912,16 +1912,16 @@ xenFormatSxprNet(virConnectPtr conn, if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE && def->type != VIR_DOMAIN_NET_TYPE_NETWORK && def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unsupported network type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported network type %d"), def->type); return -1; } if (def->script && def->type != VIR_DOMAIN_NET_TYPE_BRIDGE && def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("scripts are not supported on interfaces of type %s"), - virDomainNetTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("scripts are not supported on interfaces of type %s"), + virDomainNetTypeToString(def->type)); return -1; } @@ -1953,17 +1953,17 @@ xenFormatSxprNet(virConnectPtr conn, char *bridge; if (!network) { - XENXS_ERROR(VIR_ERR_NO_NETWORK, "%s", - def->data.network.name); + virReportError(VIR_ERR_NO_NETWORK, "%s", + def->data.network.name); return -1; } bridge = virNetworkGetBridgeName(network); virNetworkFree(network); if (!bridge) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("network %s is not active"), - def->data.network.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network %s is not active"), + def->data.network.name); return -1; } virBufferEscapeSexpr(buf, "(bridge '%s')", bridge); @@ -2063,8 +2063,8 @@ xenFormatSxprOnePCI(virDomainHostdevDefPtr def, int detach) { if (def->managed) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("managed PCI devices not supported with XenD")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("managed PCI devices not supported with XenD")); return -1; } @@ -2123,8 +2123,8 @@ xenFormatSxprAllPCI(virDomainDefPtr def, if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && def->hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { if (def->hostdevs[i]->managed) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("managed PCI devices not supported with XenD")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("managed PCI devices not supported with XenD")); return -1; } @@ -2155,9 +2155,9 @@ xenFormatSxprSound(virDomainDefPtr def, for (i = 0 ; i < def->nsounds ; i++) { if (!(str = virDomainSoundModelTypeToString(def->sounds[i]->model))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected sound model %d"), - def->sounds[i]->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected sound model %d"), + def->sounds[i]->model); return -1; } if (i) @@ -2192,8 +2192,8 @@ xenFormatSxprInput(virDomainInputDefPtr input, if (input->type != VIR_DOMAIN_INPUT_TYPE_MOUSE && input->type != VIR_DOMAIN_INPUT_TYPE_TABLET) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected input type %d"), input->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected input type %d"), input->type); return -1; } @@ -2270,22 +2270,22 @@ xenFormatSxpr(virConnectPtr conn, } if (!(tmp = virDomainLifecycleTypeToString(def->onPoweroff))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle value %d"), def->onPoweroff); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle value %d"), def->onPoweroff); goto error; } virBufferAsprintf(&buf, "(on_poweroff '%s')", tmp); if (!(tmp = virDomainLifecycleTypeToString(def->onReboot))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle value %d"), def->onReboot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle value %d"), def->onReboot); goto error; } virBufferAsprintf(&buf, "(on_reboot '%s')", tmp); if (!(tmp = virDomainLifecycleCrashTypeToString(def->onCrash))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle value %d"), def->onCrash); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle value %d"), def->onCrash); goto error; } virBufferAsprintf(&buf, "(on_crash '%s')", tmp); @@ -2302,8 +2302,8 @@ xenFormatSxpr(virConnectPtr conn, if (hvm && def->os.loader == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s",_("no HVM domain loader")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s",_("no HVM domain loader")); goto error; } @@ -2492,9 +2492,9 @@ xenFormatSxpr(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto error; } } else { @@ -2515,8 +2515,8 @@ xenFormatSxpr(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_UTC: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto error; } vmlocaltime = 0; @@ -2524,17 +2524,17 @@ xenFormatSxpr(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto error; } vmlocaltime = 1; rtc_timeoffset = 0; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto error; } virBufferAsprintf(&buf, "(rtc_timeoffset %d)", rtc_timeoffset); @@ -2548,9 +2548,9 @@ xenFormatSxpr(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto error; } } /* !hvm */ diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 07cb9bd93b..99e736e5cf 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -56,8 +56,8 @@ static int xenXMConfigGetBool(virConfPtr conf, } else if (val->type == VIR_CONF_STRING) { *value = STREQ(val->str, "1") ? 1 : 0; } else { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } return 0; @@ -83,13 +83,13 @@ static int xenXMConfigGetULong(virConfPtr conf, char *ret; *value = strtol(val->str, &ret, 10); if (ret == val->str) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } } else { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } return 0; @@ -115,13 +115,13 @@ static int xenXMConfigGetULongLong(virConfPtr conf, char *ret; *value = strtoll(val->str, &ret, 10); if (ret == val->str) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } } else { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } return 0; @@ -142,8 +142,8 @@ static int xenXMConfigGetString(virConfPtr conf, } if (val->type != VIR_CONF_STRING) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } if (!val->str) @@ -163,21 +163,21 @@ static int xenXMConfigCopyStringInternal(virConfPtr conf, if (!(val = virConfGetValue(conf, name))) { if (allowMissing) return 0; - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was missing"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was missing"), name); return -1; } if (val->type != VIR_CONF_STRING) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was not a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was not a string"), name); return -1; } if (!val->str) { if (allowMissing) return 0; - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was missing"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was missing"), name); return -1; } @@ -208,32 +208,32 @@ static int xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char * virConfValuePtr val; if (!uuid || !name || !conf) { - XENXS_ERROR(VIR_ERR_INVALID_ARG, - _("Arguments must be non null")); + virReportError(VIR_ERR_INVALID_ARG, + _("Arguments must be non null")); return -1; } if (!(val = virConfGetValue(conf, name))) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("config value %s was missing"), name); + virReportError(VIR_ERR_CONF_SYNTAX, + _("config value %s was missing"), name); return -1; } if (val->type != VIR_CONF_STRING) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("config value %s not a string"), name); + virReportError(VIR_ERR_CONF_SYNTAX, + _("config value %s not a string"), name); return -1; } if (!val->str) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("%s can't be empty"), name); + virReportError(VIR_ERR_CONF_SYNTAX, + _("%s can't be empty"), name); return -1; } if (virUUIDParse(val->str, uuid) < 0) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("%s not parseable"), val->str); + virReportError(VIR_ERR_CONF_SYNTAX, + _("%s not parseable"), val->str); return -1; } @@ -287,9 +287,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type, virDomainVirtTypeToString(def->virtType)); if (defaultArch == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("no supported architecture for os type '%s'"), - def->os.type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no supported architecture for os type '%s'"), + def->os.type); goto cleanup; } if (!(def->os.arch = strdup(defaultArch))) @@ -379,24 +379,24 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (xenXMConfigGetString(conf, "on_poweroff", &str, "destroy") < 0) goto cleanup; if ((def->onPoweroff = virDomainLifecycleTypeFromString(str)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_poweroff"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected value %s for on_poweroff"), str); goto cleanup; } if (xenXMConfigGetString(conf, "on_reboot", &str, "restart") < 0) goto cleanup; if ((def->onReboot = virDomainLifecycleTypeFromString(str)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_reboot"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected value %s for on_reboot"), str); goto cleanup; } if (xenXMConfigGetString(conf, "on_crash", &str, "restart") < 0) goto cleanup; if ((def->onCrash = virDomainLifecycleCrashTypeFromString(str)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_crash"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected value %s for on_crash"), str); goto cleanup; } @@ -509,9 +509,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto no_memory; if (virStrncpy(disk->src, head, offset - head, (offset - head) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Source file %s too big for destination"), - head); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Source file %s too big for destination"), + head); goto cleanup; } } @@ -528,8 +528,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto no_memory; if (virStrncpy(disk->dst, head, offset - head, (offset - head) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Dest file %s too big for destination"), head); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Dest file %s too big for destination"), head); goto cleanup; } head = offset + 1; @@ -544,9 +544,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (virStrncpy(disk->driverName, disk->src, (tmp - disk->src), (tmp - disk->src) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver name %s too big for destination"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver name %s too big for destination"), + disk->src); goto cleanup; } @@ -565,9 +565,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (virStrncpy(disk->driverType, disk->src, (tmp - disk->src), (tmp - disk->src) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver type %s too big for destination"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver type %s too big for destination"), + disk->src); goto cleanup; } @@ -681,17 +681,17 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (STRPREFIX(key, "mac=")) { int len = nextkey ? (nextkey - data) : sizeof(mac) - 1; if (virStrncpy(mac, data, len, sizeof(mac)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("MAC address %s too big for destination"), - data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("MAC address %s too big for destination"), + data); goto skipnic; } } else if (STRPREFIX(key, "bridge=")) { int len = nextkey ? (nextkey - data) : sizeof(bridge) - 1; if (virStrncpy(bridge, data, len, sizeof(bridge)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Bridge %s too big for destination"), - data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Bridge %s too big for destination"), + data); goto skipnic; } } else if (STRPREFIX(key, "script=")) { @@ -703,30 +703,30 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, } else if (STRPREFIX(key, "model=")) { int len = nextkey ? (nextkey - data) : sizeof(model) - 1; if (virStrncpy(model, data, len, sizeof(model)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Model %s too big for destination"), data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Model %s too big for destination"), data); goto skipnic; } } else if (STRPREFIX(key, "type=")) { int len = nextkey ? (nextkey - data) : sizeof(type) - 1; if (virStrncpy(type, data, len, sizeof(type)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Type %s too big for destination"), data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Type %s too big for destination"), data); goto skipnic; } } else if (STRPREFIX(key, "vifname=")) { int len = nextkey ? (nextkey - data) : sizeof(vifname) - 1; if (virStrncpy(vifname, data, len, sizeof(vifname)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Vifname %s too big for destination"), - data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Vifname %s too big for destination"), + data); goto skipnic; } } else if (STRPREFIX(key, "ip=")) { int len = nextkey ? (nextkey - data) : sizeof(ip) - 1; if (virStrncpy(ip, data, len, sizeof(ip)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IP %s too big for destination"), data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IP %s too big for destination"), data); goto skipnic; } } @@ -743,8 +743,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (mac[0]) { if (virMacAddrParse(mac, &net->mac) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("malformed mac address '%s'"), mac); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("malformed mac address '%s'"), mac); goto cleanup; } } @@ -823,8 +823,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Domain %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Domain %s too big for destination"), key); goto skippci; } @@ -833,8 +833,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(bus, key, (nextkey - key), sizeof(bus)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Bus %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Bus %s too big for destination"), key); goto skippci; } @@ -843,8 +843,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(slot, key, (nextkey - key), sizeof(slot)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Slot %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Slot %s too big for destination"), key); goto skippci; } @@ -853,8 +853,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(func, key, 1, sizeof(func)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Function %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Function %s too big for destination"), key); goto skippci; } @@ -979,9 +979,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, char *key = vfb; if (virStrcpyStatic(vfb, list->list->str) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VFB %s too big for destination"), - list->list->str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VFB %s too big for destination"), + list->list->str); goto cleanup; } @@ -1159,8 +1159,8 @@ int xenXMConfigSetInt(virConfPtr conf, const char *setting, long long l) { virConfValuePtr value = NULL; if ((long) l != l) { - XENXS_ERROR(VIR_ERR_OVERFLOW, _("failed to store %lld to %s"), - l, setting); + virReportError(VIR_ERR_OVERFLOW, _("failed to store %lld to %s"), + l, setting); return -1; } if (VIR_ALLOC(value) < 0) { @@ -1219,9 +1219,9 @@ static int xenFormatXMDisk(virConfValuePtr list, virBufferAddLit(&buf, "phy:"); break; default: - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk type %s"), - virDomainDiskTypeToString(disk->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk type %s"), + virDomainDiskTypeToString(disk->type)); goto cleanup; } } @@ -1242,8 +1242,8 @@ static int xenFormatXMDisk(virConfValuePtr list, else virBufferAddLit(&buf, ",w"); if (disk->transient) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("transient disks not supported yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("transient disks not supported yet")); return -1; } @@ -1350,16 +1350,16 @@ static int xenFormatXMNet(virConnectPtr conn, virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name); char *bridge; if (!network) { - XENXS_ERROR(VIR_ERR_NO_NETWORK, "%s", - net->data.network.name); + virReportError(VIR_ERR_NO_NETWORK, "%s", + net->data.network.name); return -1; } bridge = virNetworkGetBridgeName(network); virNetworkFree(network); if (!bridge) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("network %s is not active"), - net->data.network.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network %s is not active"), + net->data.network.name); return -1; } @@ -1369,9 +1369,9 @@ static int xenFormatXMNet(virConnectPtr conn, break; default: - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unsupported network type %d"), - net->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported network type %d"), + net->type); goto cleanup; } @@ -1670,9 +1670,9 @@ virConfPtr xenFormatXM(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto cleanup; } } else { @@ -1686,8 +1686,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_UTC: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto cleanup; } vmlocaltime = 0; @@ -1695,17 +1695,17 @@ virConfPtr xenFormatXM(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto cleanup; } vmlocaltime = 1; rtc_timeoffset = 0; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto cleanup; } if (xenXMConfigSetInt(conf, "rtc_timeoffset", rtc_timeoffset) < 0) @@ -1720,9 +1720,9 @@ virConfPtr xenFormatXM(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto cleanup; } } /* !hvm */ @@ -1732,8 +1732,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, if (!(lifecycle = virDomainLifecycleTypeToString(def->onPoweroff))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle action %d"), def->onPoweroff); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle action %d"), def->onPoweroff); goto cleanup; } if (xenXMConfigSetString(conf, "on_poweroff", lifecycle) < 0) @@ -1741,8 +1741,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, if (!(lifecycle = virDomainLifecycleTypeToString(def->onReboot))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle action %d"), def->onReboot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle action %d"), def->onReboot); goto cleanup; } if (xenXMConfigSetString(conf, "on_reboot", lifecycle) < 0) @@ -1750,8 +1750,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, if (!(lifecycle = virDomainLifecycleCrashTypeToString(def->onCrash))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle action %d"), def->onCrash); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle action %d"), def->onCrash); goto cleanup; } if (xenXMConfigSetString(conf, "on_crash", lifecycle) < 0) diff --git a/src/xenxs/xenxs_private.h b/src/xenxs/xenxs_private.h index bc903f5ad2..4fc9461424 100644 --- a/src/xenxs/xenxs_private.h +++ b/src/xenxs/xenxs_private.h @@ -57,8 +57,4 @@ # 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__ */