mirror of https://gitee.com/openkylin/libvirt.git
maint: mark translatable string args of VIR_ERROR
Run this: git grep -l 'VIR_ERROR\s*("'|xargs perl -pi -e \ 's/(VIR_ERROR)\s*\((".*?"),/$1(_($2),/'
This commit is contained in:
parent
8d63d82e5c
commit
2d3208029b
|
@ -817,7 +817,7 @@ static int qemudInitPaths(struct qemud_server *server,
|
|||
|
||||
snprintf_error:
|
||||
if (ret)
|
||||
VIR_ERROR("%s",
|
||||
VIR_ERROR(_("%s"),
|
||||
_("Resulting path too long for buffer in qemudInitPaths()"));
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -64,7 +64,7 @@ virDriverLoadModule(const char *name)
|
|||
|
||||
handle = dlopen(modfile, RTLD_NOW | RTLD_LOCAL);
|
||||
if (!handle) {
|
||||
VIR_ERROR("failed to load module %s %s", modfile, dlerror());
|
||||
VIR_ERROR(_("failed to load module %s %s"), modfile, dlerror());
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -74,12 +74,12 @@ virDriverLoadModule(const char *name)
|
|||
|
||||
regsym = dlsym(handle, regfunc);
|
||||
if (!regsym) {
|
||||
VIR_ERROR("Missing module registration symbol %s", regfunc);
|
||||
VIR_ERROR(_("Missing module registration symbol %s"), regfunc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((*regsym)() < 0) {
|
||||
VIR_ERROR("Failed module registration %s", regfunc);
|
||||
VIR_ERROR(_("Failed module registration %s"), regfunc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
|
@ -976,7 +976,7 @@ int virStateInitialize(int privileged) {
|
|||
for (i = 0 ; i < virStateDriverTabCount ; i++) {
|
||||
if (virStateDriverTab[i]->initialize &&
|
||||
virStateDriverTab[i]->initialize(privileged) < 0) {
|
||||
VIR_ERROR("Initialization of %s state driver failed",
|
||||
VIR_ERROR(_("Initialization of %s state driver failed"),
|
||||
virStateDriverTab[i]->name);
|
||||
ret = -1;
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ static int lxcControllerMain(int monitor,
|
|||
fdArray[0].active = 0;
|
||||
fdArray[1].fd = contPty;
|
||||
fdArray[1].active = 0;
|
||||
VIR_ERROR("monitor=%d client=%d appPty=%d contPty=%d", monitor,client, appPty, contPty);
|
||||
VIR_ERROR(_("monitor=%d client=%d appPty=%d contPty=%d"), monitor,client, appPty, contPty);
|
||||
/* create the epoll fild descriptor */
|
||||
epollFd = epoll_create(2);
|
||||
if (0 > epollFd) {
|
||||
|
|
|
@ -787,7 +787,7 @@ static int halDeviceMonitorStartup(int privileged ATTRIBUTE_UNUSED)
|
|||
|
||||
failure:
|
||||
if (dbus_error_is_set(&err)) {
|
||||
VIR_ERROR("%s: %s", err.name, err.message);
|
||||
VIR_ERROR(_("%s: %s"), err.name, err.message);
|
||||
dbus_error_free(&err);
|
||||
}
|
||||
virNodeDeviceObjListFree(&driverState->devs);
|
||||
|
|
|
@ -197,7 +197,7 @@ static int logStrToLong_ui(char const *s,
|
|||
|
||||
ret = virStrToLong_ui(s, end_ptr, base, result);
|
||||
if (ret != 0) {
|
||||
VIR_ERROR("Failed to convert '%s' to unsigned int", s);
|
||||
VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s);
|
||||
} else {
|
||||
VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ static int get_sriov_function(const char *device_link,
|
|||
device_path = canonicalize_file_name (device_link);
|
||||
if (device_path == NULL) {
|
||||
memset(errbuf, '\0', sizeof(errbuf));
|
||||
VIR_ERROR("Failed to resolve device link '%s': '%s'", device_link,
|
||||
VIR_ERROR(_("Failed to resolve device link '%s': '%s'"), device_link,
|
||||
virStrerror(errno, errbuf, sizeof(errbuf)));
|
||||
goto out;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ static int get_sriov_function(const char *device_link,
|
|||
}
|
||||
|
||||
if (parse_pci_config_address(config_address, *bdf) != 0) {
|
||||
VIR_ERROR("Failed to parse PCI config address '%s'", config_address);
|
||||
VIR_ERROR(_("Failed to parse PCI config address '%s'"), config_address);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ int get_virtual_functions_linux(const char *sysfs_path,
|
|||
|
||||
/* We should not get back SRIOV_NOT_FOUND in this
|
||||
* case, so if we do, it's an error. */
|
||||
VIR_ERROR("Failed to get SR IOV function from device link '%s'",
|
||||
VIR_ERROR(_("Failed to get SR IOV function from device link '%s'"),
|
||||
device_link);
|
||||
goto out;
|
||||
} else {
|
||||
|
|
|
@ -57,7 +57,7 @@ static int udevStrToLong_ull(char const *s,
|
|||
|
||||
ret = virStrToLong_ull(s, end_ptr, base, result);
|
||||
if (ret != 0) {
|
||||
VIR_ERROR("Failed to convert '%s' to unsigned long long", s);
|
||||
VIR_ERROR(_("Failed to convert '%s' to unsigned long long"), s);
|
||||
} else {
|
||||
VIR_DEBUG("Converted '%s' to unsigned long %llu", s, *result);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ static int udevStrToLong_ui(char const *s,
|
|||
|
||||
ret = virStrToLong_ui(s, end_ptr, base, result);
|
||||
if (ret != 0) {
|
||||
VIR_ERROR("Failed to convert '%s' to unsigned int", s);
|
||||
VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s);
|
||||
} else {
|
||||
VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static int udevStrToLong_i(char const *s,
|
|||
|
||||
ret = virStrToLong_i(s, end_ptr, base, result);
|
||||
if (ret != 0) {
|
||||
VIR_ERROR("Failed to convert '%s' to int", s);
|
||||
VIR_ERROR(_("Failed to convert '%s' to int"), s);
|
||||
} else {
|
||||
VIR_DEBUG("Converted '%s' to int %u", s, *result);
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ static int udevGetSCSIType(unsigned int type, char **typestring)
|
|||
ret = -1;
|
||||
virReportOOMError();
|
||||
} else {
|
||||
VIR_ERROR("Failed to find SCSI device type %d", type);
|
||||
VIR_ERROR(_("Failed to find SCSI device type %d"), type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
|
|||
|
||||
out:
|
||||
if (ret != 0) {
|
||||
VIR_ERROR("Failed to process SCSI device with sysfs path '%s'",
|
||||
VIR_ERROR(_("Failed to process SCSI device with sysfs path '%s'"),
|
||||
def->sysfs_path);
|
||||
}
|
||||
return ret;
|
||||
|
@ -1165,7 +1165,7 @@ static int udevGetDeviceDetails(struct udev_device *device,
|
|||
ret = udevProcessStorage(device, def);
|
||||
break;
|
||||
default:
|
||||
VIR_ERROR("Unknown device type %d", def->caps->type);
|
||||
VIR_ERROR(_("Unknown device type %d"), def->caps->type);
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -1286,7 +1286,7 @@ static int udevAddOneDevice(struct udev_device *device)
|
|||
nodeDeviceUnlock(driverState);
|
||||
|
||||
if (dev == NULL) {
|
||||
VIR_ERROR("Failed to create device for '%s'", def->name);
|
||||
VIR_ERROR(_("Failed to create device for '%s'"), def->name);
|
||||
virNodeDeviceDefFree(def);
|
||||
goto out;
|
||||
}
|
||||
|
@ -1333,7 +1333,7 @@ static int udevEnumerateDevices(struct udev *udev)
|
|||
|
||||
ret = udev_enumerate_scan_devices(udev_enumerate);
|
||||
if (0 != ret) {
|
||||
VIR_ERROR("udev scan devices returned %d", ret);
|
||||
VIR_ERROR(_("udev scan devices returned %d"), ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ udevGetDMIData(union _virNodeDevCapData *data)
|
|||
if (device == NULL) {
|
||||
device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
|
||||
if (device == NULL) {
|
||||
VIR_ERROR("Failed to get udev device for syspath '%s' or '%s'",
|
||||
VIR_ERROR(_("Failed to get udev device for syspath '%s' or '%s'"),
|
||||
DMI_DEVPATH, DMI_DEVPATH_FALLBACK);
|
||||
goto out;
|
||||
}
|
||||
|
@ -1534,7 +1534,7 @@ static int udevSetupSystemDev(void)
|
|||
|
||||
dev = virNodeDeviceAssignDef(&driverState->devs, def);
|
||||
if (dev == NULL) {
|
||||
VIR_ERROR("Failed to create device for '%s'", def->name);
|
||||
VIR_ERROR(_("Failed to create device for '%s'"), def->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -1067,7 +1067,7 @@ phypListDomainsGeneric(virConnectPtr conn, int *ids, int nids,
|
|||
break;
|
||||
else if (ret[i] == '\n') {
|
||||
if (virStrToLong_i(id_c, &char_ptr, 10, &ids[got]) == -1) {
|
||||
VIR_ERROR("Cannot parse number from '%s'", id_c);
|
||||
VIR_ERROR(_("Cannot parse number from '%s'"), id_c);
|
||||
goto err;
|
||||
}
|
||||
memset(id_c, 0, 10);
|
||||
|
@ -1520,7 +1520,7 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
|
|||
goto err;
|
||||
|
||||
if (nvcpus > phypGetLparCPUMAX(dom)) {
|
||||
VIR_ERROR("%s",
|
||||
VIR_ERROR(_("%s"),
|
||||
"You are trying to set a number of CPUs bigger than "
|
||||
"the max possible..");
|
||||
goto err;
|
||||
|
@ -1547,7 +1547,7 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
|
|||
ret = phypExec(session, cmd, &exit_status, dom->conn);
|
||||
|
||||
if (exit_status < 0) {
|
||||
VIR_ERROR("%s",
|
||||
VIR_ERROR(_("%s"),
|
||||
"Possibly you don't have IBM Tools installed in your LPAR."
|
||||
"Contact your support to enable this feature.");
|
||||
goto err;
|
||||
|
@ -1690,7 +1690,7 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
|
|||
ret = phypExec(session, cmd, &exit_status, conn);
|
||||
|
||||
if (exit_status < 0) {
|
||||
VIR_ERROR("%s\"%s\"", "Unable to create LPAR. Reason: ", ret);
|
||||
VIR_ERROR(_("%s\"%s\""), "Unable to create LPAR. Reason: ", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -1992,7 +1992,7 @@ phypUUIDTable_Push(virConnectPtr conn)
|
|||
/* end of file */
|
||||
break;
|
||||
} else {
|
||||
VIR_ERROR("Failed to read from '%s'", local_file);
|
||||
VIR_ERROR(_("Failed to read from '%s'"), local_file);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
|||
}
|
||||
ctl = virCgroupControllerTypeFromString(pp->str);
|
||||
if (ctl < 0) {
|
||||
VIR_ERROR("Unknown cgroup controller '%s'", pp->str);
|
||||
VIR_ERROR(_("Unknown cgroup controller '%s'"), pp->str);
|
||||
virConfFree(conf);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1367,7 +1367,7 @@ static void qemuDomainSnapshotLoad(void *payload,
|
|||
|
||||
virDomainObjLock(vm);
|
||||
if (virAsprintf(&snapDir, "%s/%s", baseDir, vm->def->name) < 0) {
|
||||
VIR_ERROR("Failed to allocate memory for snapshot directory for domain %s",
|
||||
VIR_ERROR(_("Failed to allocate memory for snapshot directory for domain %s"),
|
||||
vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1377,7 +1377,7 @@ static void qemuDomainSnapshotLoad(void *payload,
|
|||
|
||||
if (!(dir = opendir(snapDir))) {
|
||||
if (errno != ENOENT)
|
||||
VIR_ERROR("Failed to open snapshot directory %s for domain %s: %s",
|
||||
VIR_ERROR(_("Failed to open snapshot directory %s for domain %s: %s"),
|
||||
snapDir, vm->def->name,
|
||||
virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||
goto cleanup;
|
||||
|
@ -1399,7 +1399,7 @@ static void qemuDomainSnapshotLoad(void *payload,
|
|||
ret = virFileReadAll(fullpath, 1024*1024*1, &xmlStr);
|
||||
if (ret < 0) {
|
||||
/* Nothing we can do here, skip this one */
|
||||
VIR_ERROR("Failed to read snapshot file %s: %s", fullpath,
|
||||
VIR_ERROR(_("Failed to read snapshot file %s: %s"), fullpath,
|
||||
virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||
VIR_FREE(fullpath);
|
||||
continue;
|
||||
|
@ -1408,7 +1408,7 @@ static void qemuDomainSnapshotLoad(void *payload,
|
|||
def = virDomainSnapshotDefParseString(xmlStr, 0);
|
||||
if (def == NULL) {
|
||||
/* Nothing we can do here, skip this one */
|
||||
VIR_ERROR("Failed to parse snapshot XML from file '%s'", fullpath);
|
||||
VIR_ERROR(_("Failed to parse snapshot XML from file '%s'"), fullpath);
|
||||
VIR_FREE(fullpath);
|
||||
VIR_FREE(xmlStr);
|
||||
continue;
|
||||
|
|
|
@ -315,7 +315,7 @@ qemuMonitorIOProcess(qemuMonitorPtr mon)
|
|||
# if DEBUG_RAW_IO
|
||||
char *str1 = qemuMonitorEscapeNonPrintable(msg ? msg->txBuffer : "");
|
||||
char *str2 = qemuMonitorEscapeNonPrintable(mon->buffer);
|
||||
VIR_ERROR("Process %d %p %p [[[[%s]]][[[%s]]]", (int)mon->bufferOffset, mon->msg, msg, str1, str2);
|
||||
VIR_ERROR(_("Process %d %p %p [[[[%s]]][[[%s]]]"), (int)mon->bufferOffset, mon->msg, msg, str1, str2);
|
||||
VIR_FREE(str1);
|
||||
VIR_FREE(str2);
|
||||
# else
|
||||
|
@ -509,7 +509,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
|
|||
#endif
|
||||
|
||||
if (mon->fd != fd || mon->watch != watch) {
|
||||
VIR_ERROR("event from unexpected fd %d!=%d / watch %d!=%d", mon->fd, fd, mon->watch, watch);
|
||||
VIR_ERROR(_("event from unexpected fd %d!=%d / watch %d!=%d"), mon->fd, fd, mon->watch, watch);
|
||||
failed = 1;
|
||||
} else {
|
||||
if (!mon->lastErrno &&
|
||||
|
|
|
@ -73,7 +73,7 @@ storageDriverAutostart(virStorageDriverStatePtr driver) {
|
|||
!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageBackendPtr backend;
|
||||
if ((backend = virStorageBackendForType(pool->def->type)) == NULL) {
|
||||
VIR_ERROR("Missing backend %d", pool->def->type);
|
||||
VIR_ERROR(_("Missing backend %d"), pool->def->type);
|
||||
virStoragePoolObjUnlock(pool);
|
||||
continue;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ storageDriverAutostart(virStorageDriverStatePtr driver) {
|
|||
if (backend->startPool &&
|
||||
backend->startPool(NULL, pool) < 0) {
|
||||
virErrorPtr err = virGetLastError();
|
||||
VIR_ERROR("Failed to autostart storage pool '%s': %s",
|
||||
VIR_ERROR(_("Failed to autostart storage pool '%s': %s"),
|
||||
pool->def->name, err ? err->message :
|
||||
"no error message found");
|
||||
virStoragePoolObjUnlock(pool);
|
||||
|
@ -92,7 +92,7 @@ storageDriverAutostart(virStorageDriverStatePtr driver) {
|
|||
virErrorPtr err = virGetLastError();
|
||||
if (backend->stopPool)
|
||||
backend->stopPool(NULL, pool);
|
||||
VIR_ERROR("Failed to autostart storage pool '%s': %s",
|
||||
VIR_ERROR(_("Failed to autostart storage pool '%s': %s"),
|
||||
pool->def->name, err ? err->message :
|
||||
"no error message found");
|
||||
virStoragePoolObjUnlock(pool);
|
||||
|
@ -634,7 +634,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
|
|||
|
||||
if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
|
||||
char ebuf[1024];
|
||||
VIR_ERROR("Failed to delete autostart link '%s': %s",
|
||||
VIR_ERROR(_("Failed to delete autostart link '%s': %s"),
|
||||
pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf));
|
||||
}
|
||||
|
||||
|
|
|
@ -791,10 +791,10 @@ static int umlCleanupTapDevices(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
def->type != VIR_DOMAIN_NET_TYPE_NETWORK)
|
||||
continue;
|
||||
|
||||
VIR_ERROR("Cleanup '%s'", def->ifname);
|
||||
VIR_ERROR(_("Cleanup '%s'"), def->ifname);
|
||||
err = brDeleteTap(brctl, def->ifname);
|
||||
if (err) {
|
||||
VIR_ERROR("Cleanup failed %d", err);
|
||||
VIR_ERROR(_("Cleanup failed %d"), err);
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ static int virCgroupDetect(virCgroupPtr group)
|
|||
|
||||
rc = virCgroupDetectMounts(group);
|
||||
if (rc < 0) {
|
||||
VIR_ERROR("Failed to detect mounts for %s", group->path);
|
||||
VIR_ERROR(_("Failed to detect mounts for %s"), group->path);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ static int virCgroupDetect(virCgroupPtr group)
|
|||
continue;
|
||||
|
||||
if (!group->controllers[i].placement) {
|
||||
VIR_ERROR("Could not find placement for controller %s at %s",
|
||||
VIR_ERROR(_("Could not find placement for controller %s at %s"),
|
||||
virCgroupControllerTypeToString(i),
|
||||
group->controllers[i].placement);
|
||||
rc = -ENOENT;
|
||||
|
@ -230,7 +230,7 @@ static int virCgroupDetect(virCgroupPtr group)
|
|||
group->controllers[i].placement);
|
||||
}
|
||||
} else {
|
||||
VIR_ERROR("Failed to detect mapping for %s", group->path);
|
||||
VIR_ERROR(_("Failed to detect mapping for %s"), group->path);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -422,7 +422,7 @@ static int virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group)
|
|||
inherit_values[i],
|
||||
&value);
|
||||
if (rc != 0) {
|
||||
VIR_ERROR("Failed to get %s %d", inherit_values[i], rc);
|
||||
VIR_ERROR(_("Failed to get %s %d"), inherit_values[i], rc);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ static int virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group)
|
|||
VIR_FREE(value);
|
||||
|
||||
if (rc != 0) {
|
||||
VIR_ERROR("Failed to set %s %d", inherit_values[i], rc);
|
||||
VIR_ERROR(_("Failed to set %s %d"), inherit_values[i], rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ static int virClearCapabilities(void)
|
|||
capng_clear(CAPNG_SELECT_BOTH);
|
||||
|
||||
if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
|
||||
VIR_ERROR("cannot clear process capabilities %d", ret);
|
||||
VIR_ERROR(_("cannot clear process capabilities %d"), ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue