mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Replace use of virStorageReportError with virReportError
Update the storage driver to use virReportError instead of the virStorageReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
89e23562c9
commit
d8a1c4c49f
1
cfg.mk
1
cfg.mk
@ -549,7 +549,6 @@ msg_gen_function += virReportErrorHelper
|
||||
msg_gen_function += virReportSystemError
|
||||
msg_gen_function += virSecretReportError
|
||||
msg_gen_function += virSecurityReportError
|
||||
msg_gen_function += virStorageReportError
|
||||
msg_gen_function += virXenInotifyError
|
||||
msg_gen_function += virXenStoreError
|
||||
msg_gen_function += virXendError
|
||||
|
@ -385,9 +385,9 @@ virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (vol->target.encryption != NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support encrypted "
|
||||
"volumes"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support encrypted "
|
||||
"volumes"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -425,8 +425,8 @@ virStorageGenerateSecretUUID(virConnectPtr conn,
|
||||
for (attempt = 0; attempt < 65536; attempt++) {
|
||||
virSecretPtr tmp;
|
||||
if (virUUIDGenerate(uuid) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unable to generate uuid"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unable to generate uuid"));
|
||||
return -1;
|
||||
}
|
||||
tmp = conn->secretDriver->lookupByUUID(conn, uuid);
|
||||
@ -436,8 +436,8 @@ virStorageGenerateSecretUUID(virConnectPtr conn,
|
||||
virSecretFree(tmp);
|
||||
}
|
||||
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("too many conflicts when generating an uuid"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("too many conflicts when generating an uuid"));
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -459,15 +459,15 @@ virStorageGenerateQcowEncryption(virConnectPtr conn,
|
||||
conn->secretDriver->lookupByUUID == NULL ||
|
||||
conn->secretDriver->defineXML == NULL ||
|
||||
conn->secretDriver->setValue == NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("secret storage not supported"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("secret storage not supported"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
enc = vol->target.encryption;
|
||||
if (enc->nsecrets != 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("secrets already defined"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("secrets already defined"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -631,9 +631,9 @@ static int virStorageBackendQEMUImgBackingFormat(const char *qemuimg)
|
||||
|
||||
if ((start = strstr(help, " create ")) == NULL ||
|
||||
(end = strstr(start, "\n")) == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to parse qemu-img output '%s'"),
|
||||
help);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to parse qemu-img output '%s'"),
|
||||
help);
|
||||
goto cleanup;
|
||||
}
|
||||
if (((tmp = strstr(start, "-F fmt")) && tmp < end) ||
|
||||
@ -682,15 +682,15 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
|
||||
NULL;
|
||||
|
||||
if (type == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage vol type %d"),
|
||||
vol->target.format);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage vol type %d"),
|
||||
vol->target.format);
|
||||
return -1;
|
||||
}
|
||||
if (inputvol && inputType == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage vol type %d"),
|
||||
inputvol->target.format);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage vol type %d"),
|
||||
inputvol->target.format);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -705,16 +705,16 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
|
||||
if (inputvol &&
|
||||
(!inputBackingPath ||
|
||||
STRNEQ(inputBackingPath, vol->backingStore.path))) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("a different backing store cannot "
|
||||
"be specified."));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("a different backing store cannot "
|
||||
"be specified."));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (backingType == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage vol backing store type %d"),
|
||||
vol->backingStore.format);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage vol backing store type %d"),
|
||||
vol->backingStore.format);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -743,22 +743,22 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
|
||||
|
||||
if (vol->target.format != VIR_STORAGE_FILE_QCOW &&
|
||||
vol->target.format != VIR_STORAGE_FILE_QCOW2) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("qcow volume encryption unsupported with "
|
||||
"volume format %s"), type);
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("qcow volume encryption unsupported with "
|
||||
"volume format %s"), type);
|
||||
return -1;
|
||||
}
|
||||
enc = vol->target.encryption;
|
||||
if (enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_QCOW &&
|
||||
enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unsupported volume encryption format %d"),
|
||||
vol->target.encryption->format);
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unsupported volume encryption format %d"),
|
||||
vol->target.encryption->format);
|
||||
return -1;
|
||||
}
|
||||
if (enc->nsecrets > 1) {
|
||||
virStorageReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("too many secrets for qcow encryption"));
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("too many secrets for qcow encryption"));
|
||||
return -1;
|
||||
}
|
||||
if (enc->format == VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT ||
|
||||
@ -777,8 +777,8 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
|
||||
create_tool = virFindFileInPath("qemu-img");
|
||||
|
||||
if (!create_tool) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("unable to find kvm-img or qemu-img"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("unable to find kvm-img or qemu-img"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -871,27 +871,27 @@ virStorageBackendCreateQcowCreate(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (inputvol) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot copy from volume with qcow-create"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot copy from volume with qcow-create"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vol->target.format != VIR_STORAGE_FILE_QCOW2) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unsupported storage vol type %d"),
|
||||
vol->target.format);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unsupported storage vol type %d"),
|
||||
vol->target.format);
|
||||
return -1;
|
||||
}
|
||||
if (vol->backingStore.path != NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("copy-on-write image not supported with "
|
||||
"qcow-create"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("copy-on-write image not supported with "
|
||||
"qcow-create"));
|
||||
return -1;
|
||||
}
|
||||
if (vol->target.encryption != NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("encrypted volumes not supported with "
|
||||
"qcow-create"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("encrypted volumes not supported with "
|
||||
"qcow-create"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -921,9 +921,9 @@ virStorageBackendFSImageToolTypeToFunc(int tool_type)
|
||||
case TOOL_QCOW_CREATE:
|
||||
return virStorageBackendCreateQcowCreate;
|
||||
default:
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unknown file create tool type '%d'."),
|
||||
tool_type);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unknown file create tool type '%d'."),
|
||||
tool_type);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -969,9 +969,9 @@ virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
|
||||
inputvol->target.format != VIR_STORAGE_FILE_RAW)) {
|
||||
|
||||
if ((tool_type = virStorageBackendFindFSImageTool(NULL)) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("creation of non-raw file images is "
|
||||
"not supported without qemu-img."));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("creation of non-raw file images is "
|
||||
"not supported without qemu-img."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -992,8 +992,8 @@ virStorageBackendForType(int type) {
|
||||
if (backends[i]->type == type)
|
||||
return backends[i];
|
||||
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("missing backend for pool type %d"), type);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("missing backend for pool type %d"), type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1069,8 +1069,8 @@ virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags)
|
||||
VIR_INFO("Skipping volume '%s'", path);
|
||||
|
||||
if (mode & VIR_STORAGE_VOL_OPEN_ERROR) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected storage mode for '%s'"), path);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected storage mode for '%s'"), path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1444,8 +1444,8 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
|
||||
if (err != 0) {
|
||||
char error[100];
|
||||
regerror(err, ®[i], error, sizeof(error));
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to compile regex %s"), error);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to compile regex %s"), error);
|
||||
for (j = 0 ; j <= i ; j++)
|
||||
regfree(®[j]);
|
||||
VIR_FREE(reg);
|
||||
@ -1474,8 +1474,8 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
|
||||
}
|
||||
|
||||
if ((list = VIR_FDOPEN(fd, "r")) == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot read fd"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot read fd"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1586,8 +1586,8 @@ virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
|
||||
}
|
||||
|
||||
if ((fp = VIR_FDOPEN(fd, "r")) == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot open file using fd"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot open file using fd"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1646,8 +1646,8 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
|
||||
virStorageBackendListVolRegexFunc func ATTRIBUTE_UNUSED,
|
||||
void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%s not implemented on Win32"), __FUNCTION__);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%s not implemented on Win32"), __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1659,7 +1659,8 @@ virStorageBackendRunProgNul(virConnectPtr conn,
|
||||
virStorageBackendListVolNulFunc func ATTRIBUTE_UNUSED,
|
||||
void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, _("%s not implemented on Win32"), __FUNCTION__);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("%s not implemented on Win32"), __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
@ -29,10 +29,6 @@
|
||||
# include "storage_conf.h"
|
||||
# include "command.h"
|
||||
|
||||
# define virStorageReportError(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_STORAGE, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
typedef char * (*virStorageBackendFindPoolSources)(virConnectPtr conn, const char *srcSpec, unsigned int flags);
|
||||
typedef int (*virStorageBackendCheckPool)(virConnectPtr conn, virStoragePoolObjPtr pool, bool *active);
|
||||
typedef int (*virStorageBackendStartPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
|
||||
|
@ -106,15 +106,15 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
|
||||
|
||||
if (virStrToLong_ull(groups[3], NULL, 10,
|
||||
&vol->source.extents[0].start) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot parse device start location"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot parse device start location"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virStrToLong_ull(groups[4], NULL, 10,
|
||||
&vol->source.extents[0].end) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot parse device end location"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot parse device end location"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -327,9 +327,9 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virFileWaitForDevices();
|
||||
|
||||
if (!virFileExists(pool->def->source.devices[0].path)) {
|
||||
virStorageReportError(VIR_ERR_INVALID_ARG,
|
||||
_("device path '%s' doesn't exist"),
|
||||
pool->def->source.devices[0].path);
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("device path '%s' doesn't exist"),
|
||||
pool->def->source.devices[0].path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -399,9 +399,9 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
||||
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Overwrite and no overwrite flags"
|
||||
" are mutually exclusive"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Overwrite and no overwrite flags"
|
||||
" are mutually exclusive"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -415,11 +415,11 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
if (check > 0) {
|
||||
ok_to_mklabel = true;
|
||||
} else if (check < 0) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("Error checking for disk label"));
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("Error checking for disk label"));
|
||||
} else {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Disk label already present"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Disk label already present"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,8 +468,8 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
|
||||
const char *partedFormat;
|
||||
partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format);
|
||||
if (partedFormat == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Invalid partition type"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Invalid partition type"));
|
||||
return -1;
|
||||
}
|
||||
if (vol->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) {
|
||||
@ -477,8 +477,8 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
|
||||
for (i = 0; i < pool->volumes.count; i++) {
|
||||
if (pool->volumes.objs[i]->target.format ==
|
||||
VIR_STORAGE_VOL_DISK_EXTENDED) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("extended partition already exists"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("extended partition already exists"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -512,14 +512,14 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
|
||||
}
|
||||
}
|
||||
if (i == pool->volumes.count) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("no extended partition found and no primary partition available"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("no extended partition found and no primary partition available"));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("unknown partition type"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("unknown partition type"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -602,8 +602,8 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
|
||||
}
|
||||
|
||||
if (smallestExtent == -1) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("no large enough free extent"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("no large enough free extent"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -643,9 +643,9 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
NULL);
|
||||
|
||||
if (vol->target.encryption != NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support encrypted "
|
||||
"volumes"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support encrypted "
|
||||
"volumes"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -733,9 +733,9 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
isDevMapperDevice = virIsDevMapperDevice(devpath);
|
||||
|
||||
if (!isDevMapperDevice && !STRPREFIX(dev_name, srcname)) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Volume path '%s' did not start with parent "
|
||||
"pool source device name."), dev_name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Volume path '%s' did not start with parent "
|
||||
"pool source device name."), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -743,9 +743,9 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
part_num = dev_name + strlen(srcname);
|
||||
|
||||
if (*part_num == 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse partition number from target "
|
||||
"'%s'"), dev_name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse partition number from target "
|
||||
"'%s'"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -113,9 +113,9 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
|
||||
/* If the backing file is currently unavailable, only log an error,
|
||||
* but continue. Returning -1 here would disable the whole storage
|
||||
* pool, making it unavailable for even maintenance. */
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot probe backing volume format: %s"),
|
||||
*backingStore);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot probe backing volume format: %s"),
|
||||
*backingStore);
|
||||
ret = -3;
|
||||
} else {
|
||||
*backingStoreFormat = ret;
|
||||
@ -191,14 +191,14 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR
|
||||
path = groups[0];
|
||||
|
||||
if (!(name = strrchr(path, '/'))) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid netfs path (no /): %s"), path);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid netfs path (no /): %s"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
name += 1;
|
||||
if (*name == '\0') {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid netfs path (ends in /): %s"), path);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid netfs path (ends in /): %s"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -264,8 +264,8 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE
|
||||
goto cleanup;
|
||||
|
||||
if (source->nhost != 1) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -355,33 +355,33 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
|
||||
|
||||
if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
|
||||
if (pool->def->source.nhost != 1) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
return -1;
|
||||
}
|
||||
if (pool->def->source.hosts[0].name == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
return -1;
|
||||
}
|
||||
if (pool->def->source.dir == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source path"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source path"));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (pool->def->source.ndevice != 1) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Short-circuit if already mounted */
|
||||
if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 0) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Target '%s' is already mounted"),
|
||||
pool->def->target.path);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Target '%s' is already mounted"),
|
||||
pool->def->target.path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -452,24 +452,24 @@ virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) {
|
||||
|
||||
if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
|
||||
if (pool->def->source.nhost != 1) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
return -1;
|
||||
}
|
||||
if (pool->def->source.hosts[0].name == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
return -1;
|
||||
}
|
||||
if (pool->def->source.dir == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source dir"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source dir"));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (pool->def->source.ndevice != 1) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -557,19 +557,19 @@ virStorageBackendFileSystemProbe(const char *device,
|
||||
format, device);
|
||||
|
||||
if (blkid_known_fstype(format) == 0) {
|
||||
virStorageReportError(VIR_ERR_STORAGE_PROBE_FAILED,
|
||||
_("Not capable of probing for "
|
||||
"filesystem of type %s"),
|
||||
format);
|
||||
virReportError(VIR_ERR_STORAGE_PROBE_FAILED,
|
||||
_("Not capable of probing for "
|
||||
"filesystem of type %s"),
|
||||
format);
|
||||
goto error;
|
||||
}
|
||||
|
||||
probe = blkid_new_probe_from_filename(device);
|
||||
if (probe == NULL) {
|
||||
virStorageReportError(VIR_ERR_STORAGE_PROBE_FAILED,
|
||||
_("Failed to create filesystem probe "
|
||||
"for device %s"),
|
||||
device);
|
||||
virReportError(VIR_ERR_STORAGE_PROBE_FAILED,
|
||||
_("Failed to create filesystem probe "
|
||||
"for device %s"),
|
||||
device);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -590,17 +590,17 @@ virStorageBackendFileSystemProbe(const char *device,
|
||||
format, device);
|
||||
ret = FILESYSTEM_PROBE_NOT_FOUND;
|
||||
} else if (blkid_probe_lookup_value(probe, "TYPE", &fstype, NULL) == 0) {
|
||||
virStorageReportError(VIR_ERR_STORAGE_POOL_BUILT,
|
||||
_("Existing filesystem of type '%s' found on "
|
||||
"device '%s'"),
|
||||
fstype, device);
|
||||
virReportError(VIR_ERR_STORAGE_POOL_BUILT,
|
||||
_("Existing filesystem of type '%s' found on "
|
||||
"device '%s'"),
|
||||
fstype, device);
|
||||
ret = FILESYSTEM_PROBE_FOUND;
|
||||
}
|
||||
|
||||
if (blkid_do_probe(probe) != 1) {
|
||||
virStorageReportError(VIR_ERR_STORAGE_PROBE_FAILED,
|
||||
_("Found additional probes to run, "
|
||||
"filesystem probing may be incorrect"));
|
||||
virReportError(VIR_ERR_STORAGE_PROBE_FAILED,
|
||||
_("Found additional probes to run, "
|
||||
"filesystem probing may be incorrect"));
|
||||
ret = FILESYSTEM_PROBE_ERROR;
|
||||
}
|
||||
|
||||
@ -620,9 +620,9 @@ static virStoragePoolProbeResult
|
||||
virStorageBackendFileSystemProbe(const char *device ATTRIBUTE_UNUSED,
|
||||
const char *format ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("probing for filesystems is unsupported "
|
||||
"by this build"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("probing for filesystems is unsupported "
|
||||
"by this build"));
|
||||
|
||||
return FILESYSTEM_PROBE_ERROR;
|
||||
}
|
||||
@ -658,11 +658,11 @@ static int
|
||||
virStorageBackendExecuteMKFS(const char *device ATTRIBUTE_UNUSED,
|
||||
const char *format ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("mkfs is not supported on this platform: "
|
||||
"Failed to make filesystem of "
|
||||
"type '%s' on device '%s'"),
|
||||
format, device);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("mkfs is not supported on this platform: "
|
||||
"Failed to make filesystem of "
|
||||
"type '%s' on device '%s'"),
|
||||
format, device);
|
||||
return -1;
|
||||
}
|
||||
#endif /* #ifdef MKFS */
|
||||
@ -676,9 +676,9 @@ virStorageBackendMakeFileSystem(virStoragePoolObjPtr pool,
|
||||
int ret = -1;
|
||||
|
||||
if (pool->def->source.devices == NULL) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("No source device specified when formatting pool '%s'"),
|
||||
pool->def->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("No source device specified when formatting pool '%s'"),
|
||||
pool->def->name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -687,9 +687,9 @@ virStorageBackendMakeFileSystem(virStoragePoolObjPtr pool,
|
||||
VIR_DEBUG("source device: '%s' format: '%s'", device, format);
|
||||
|
||||
if (!virFileExists(device)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Source device does not exist when formatting pool '%s'"),
|
||||
pool->def->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Source device does not exist when formatting pool '%s'"),
|
||||
pool->def->name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -743,9 +743,9 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
|
||||
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
|
||||
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Overwrite and no overwrite flags"
|
||||
" are mutually exclusive"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Overwrite and no overwrite flags"
|
||||
" are mutually exclusive"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -754,9 +754,9 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
goto error;
|
||||
}
|
||||
if (!(p = strrchr(parent, '/'))) {
|
||||
virStorageReportError(VIR_ERR_INVALID_ARG,
|
||||
_("path '%s' is not absolute"),
|
||||
pool->def->target.path);
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("path '%s' is not absolute"),
|
||||
pool->def->target.path);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -886,9 +886,9 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
* Unfortunately virStorageBackendProbeTarget() might already
|
||||
* have logged a similar message for the same problem, but only
|
||||
* if AUTO format detection was used. */
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot probe backing volume info: %s"),
|
||||
vol->backingStore.path);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot probe backing volume info: %s"),
|
||||
vol->backingStore.path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1025,9 +1025,9 @@ static int createFileDir(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (inputvol) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s",
|
||||
_("cannot copy from volume to a directory volume"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s",
|
||||
_("cannot copy from volume to a directory volume"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1056,10 +1056,10 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn,
|
||||
|
||||
if (inputvol) {
|
||||
if (vol->target.encryption != NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support "
|
||||
"building encrypted volumes from "
|
||||
"other volumes"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support "
|
||||
"building encrypted volumes from "
|
||||
"other volumes"));
|
||||
return -1;
|
||||
}
|
||||
create_func = virStorageBackendGetBuildVolFromFunction(vol,
|
||||
@ -1076,9 +1076,9 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn,
|
||||
if (!create_func)
|
||||
return -1;
|
||||
} else {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("creation of non-raw images "
|
||||
"is not supported without qemu-img"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("creation of non-raw images "
|
||||
"is not supported without qemu-img"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1148,9 +1148,9 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
case VIR_STORAGE_VOL_BLOCK:
|
||||
case VIR_STORAGE_VOL_NETWORK:
|
||||
default:
|
||||
virStorageReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("removing block or network volumes is not supported: %s"),
|
||||
vol->target.path);
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("removing block or network volumes is not supported: %s"),
|
||||
vol->target.path);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -1218,8 +1218,8 @@ virStorageBackendFilesystemResizeQemuImg(const char *path,
|
||||
img_tool = virFindFileInPath("qemu-img");
|
||||
|
||||
if (!img_tool) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("unable to find kvm-img or qemu-img"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("unable to find kvm-img or qemu-img"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -63,25 +63,25 @@ virStorageBackendISCSITargetIP(const char *hostname,
|
||||
|
||||
ret = getaddrinfo(hostname, NULL, &hints, &result);
|
||||
if (ret != 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("host lookup failed %s"),
|
||||
gai_strerror(ret));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("host lookup failed %s"),
|
||||
gai_strerror(ret));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (result == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("no IP address for target %s"),
|
||||
hostname);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("no IP address for target %s"),
|
||||
hostname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (getnameinfo(result->ai_addr, result->ai_addrlen,
|
||||
ipaddr, ipaddrlen, NULL, 0,
|
||||
NI_NUMERICHOST) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot format ip addr for %s"),
|
||||
hostname);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot format ip addr for %s"),
|
||||
hostname);
|
||||
freeaddrinfo(result);
|
||||
return -1;
|
||||
}
|
||||
@ -97,8 +97,8 @@ virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
|
||||
char *portal;
|
||||
|
||||
if (source->nhost != 1) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -170,8 +170,8 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool,
|
||||
|
||||
if (session == NULL &&
|
||||
!probe) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot find session"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot find session"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -196,9 +196,9 @@ virStorageBackendIQNFound(const char *initiatoriqn,
|
||||
|
||||
if (VIR_ALLOC_N(line, LINE_SIZE) != 0) {
|
||||
ret = IQN_ERROR;
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Could not allocate memory for output of '%s'"),
|
||||
ISCSIADM);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Could not allocate memory for output of '%s'"),
|
||||
ISCSIADM);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -211,10 +211,10 @@ virStorageBackendIQNFound(const char *initiatoriqn,
|
||||
}
|
||||
|
||||
if ((fp = VIR_FDOPEN(fd, "r")) == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to open stream for file descriptor "
|
||||
"when reading output from '%s': '%s'"),
|
||||
ISCSIADM, virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to open stream for file descriptor "
|
||||
"when reading output from '%s': '%s'"),
|
||||
ISCSIADM, virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||
ret = IQN_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@ -223,10 +223,10 @@ virStorageBackendIQNFound(const char *initiatoriqn,
|
||||
newline = strrchr(line, '\n');
|
||||
if (newline == NULL) {
|
||||
ret = IQN_ERROR;
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected line > %d characters "
|
||||
"when parsing output of '%s'"),
|
||||
LINE_SIZE, ISCSIADM);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected line > %d characters "
|
||||
"when parsing output of '%s'"),
|
||||
LINE_SIZE, ISCSIADM);
|
||||
goto out;
|
||||
}
|
||||
*newline = '\0';
|
||||
@ -241,9 +241,9 @@ virStorageBackendIQNFound(const char *initiatoriqn,
|
||||
token = strchr(line, ' ');
|
||||
if (!token) {
|
||||
ret = IQN_ERROR;
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing space when parsing output "
|
||||
"of '%s'"), ISCSIADM);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Missing space when parsing output "
|
||||
"of '%s'"), ISCSIADM);
|
||||
goto out;
|
||||
}
|
||||
*ifacename = strndup(line, token - line);
|
||||
@ -303,9 +303,9 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriqn,
|
||||
* We will just rely on whether the interface got created
|
||||
* properly. */
|
||||
if (virCommandRun(cmd, &exitstatus) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to run command '%s' to create new iscsi interface"),
|
||||
ISCSIADM);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to run command '%s' to create new iscsi interface"),
|
||||
ISCSIADM);
|
||||
goto cleanup;
|
||||
}
|
||||
virCommandFree(cmd);
|
||||
@ -322,9 +322,9 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriqn,
|
||||
* returned an exit status of > 0, even if they succeeded. We will just
|
||||
* rely on whether iface file got updated properly. */
|
||||
if (virCommandRun(cmd, &exitstatus) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to run command '%s' to update iscsi interface with IQN '%s'"),
|
||||
ISCSIADM, initiatoriqn);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to run command '%s' to update iscsi interface with IQN '%s'"),
|
||||
ISCSIADM, initiatoriqn);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -587,8 +587,8 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
return NULL;
|
||||
|
||||
if (source->nhost != 1) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -651,21 +651,21 @@ virStorageBackendISCSICheckPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
*isActive = false;
|
||||
|
||||
if (pool->def->source.nhost != 1) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pool->def->source.hosts[0].name == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pool->def->source.ndevice != 1 ||
|
||||
pool->def->source.devices[0].path == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -689,21 +689,21 @@ virStorageBackendISCSIStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
const char *loginargv[] = { "--login", NULL };
|
||||
|
||||
if (pool->def->source.nhost != 1) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Expected exactly 1 host for the storage pool"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pool->def->source.hosts[0].name == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source host"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pool->def->source.ndevice != 1 ||
|
||||
pool->def->source.devices[0].path == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing source device"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,8 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
|
||||
nextents = 1;
|
||||
if (STREQ(groups[4], VIR_STORAGE_VOL_LOGICAL_SEGTYPE_STRIPED)) {
|
||||
if (virStrToLong_i(groups[5], NULL, 10, &nextents) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed volume extent stripes value"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed volume extent stripes value"));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -162,18 +162,18 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
|
||||
}
|
||||
|
||||
if (virStrToLong_ull(groups[6], NULL, 10, &length) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("malformed volume extent length value"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("malformed volume extent length value"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (virStrToLong_ull(groups[7], NULL, 10, &size) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("malformed volume extent size value"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("malformed volume extent size value"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (virStrToLong_ull(groups[8], NULL, 10, &vol->allocation) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("malformed volume allocation value"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("malformed volume allocation value"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -208,15 +208,15 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
|
||||
if (err != 0) {
|
||||
char error[100];
|
||||
regerror(err, reg, error, sizeof(error));
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to compile regex %s"),
|
||||
error);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to compile regex %s"),
|
||||
error);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (regexec(reg, groups[3], nvars, vars, 0) != 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed volume extent devices value"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed volume extent devices value"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -244,8 +244,8 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
|
||||
}
|
||||
|
||||
if (virStrToLong_ull(offset_str, NULL, 10, &offset) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed volume extent offset value"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed volume extent offset value"));
|
||||
VIR_FREE(offset_str);
|
||||
goto cleanup;
|
||||
}
|
||||
@ -450,8 +450,8 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
retval = virStoragePoolSourceListFormat(&sourceList);
|
||||
if (retval == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to get source from sourceList"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to get source from sourceList"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -701,9 +701,9 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
|
||||
virCommandPtr cmd = NULL;
|
||||
|
||||
if (vol->target.encryption != NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support encrypted "
|
||||
"volumes"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("storage pool does not support encrypted "
|
||||
"volumes"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -228,9 +228,9 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
|
||||
}
|
||||
|
||||
if (virStorageBackendGetMinorNumber(names->name, &minor) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to get %s minor number"),
|
||||
names->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to get %s minor number"),
|
||||
names->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
|
||||
VIR_DEBUG("Using cephx authorization");
|
||||
if (rados_create(&ptr->cluster,
|
||||
pool->def->source.auth.cephx.username) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to initialize RADOS"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to initialize RADOS"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -84,8 +84,8 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
|
||||
}
|
||||
|
||||
if (secret == NULL) {
|
||||
virStorageReportError(VIR_ERR_NO_SECRET,
|
||||
_("failed to find the secret"));
|
||||
virReportError(VIR_ERR_NO_SECRET,
|
||||
_("failed to find the secret"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -95,38 +95,38 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
|
||||
memset(secret_value, 0, secret_value_size);
|
||||
|
||||
if (rados_key == NULL) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to decode the RADOS key"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to decode the RADOS key"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Found cephx key: %s", rados_key);
|
||||
if (rados_conf_set(ptr->cluster, "key", rados_key) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"rados_key");
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"rados_key");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
memset(rados_key, 0, strlen(rados_key));
|
||||
|
||||
if (rados_conf_set(ptr->cluster, "auth_supported", "cephx") < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"auth_supported");
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"auth_supported");
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
VIR_DEBUG("Not using cephx authorization");
|
||||
if (rados_create(&ptr->cluster, NULL) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RADOS cluster"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RADOS cluster"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (rados_conf_set(ptr->cluster, "auth_supported", "none") < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"auth_supported");
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"auth_supported");
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -145,8 +145,8 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
|
||||
pool->def->source.hosts[i].name,
|
||||
pool->def->source.hosts[i].port);
|
||||
} else {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("received malformed monitor, check the XML definition"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("received malformed monitor, check the XML definition"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,17 +158,17 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
|
||||
mon_buff = virBufferContentAndReset(&mon_host);
|
||||
VIR_DEBUG("RADOS mon_host has been set to: %s", mon_buff);
|
||||
if (rados_conf_set(ptr->cluster, "mon_host", mon_buff) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"mon_host");
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to set RADOS option: %s"),
|
||||
"mon_host");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ptr->starttime = time(0);
|
||||
if (rados_connect(ptr->cluster) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to connect to the RADOS monitor on: %s"),
|
||||
mon_buff);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to connect to the RADOS monitor on: %s"),
|
||||
mon_buff);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -214,16 +214,16 @@ static int volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
|
||||
int ret = -1;
|
||||
rbd_image_t image;
|
||||
if (rbd_open(ptr.ioctx, vol->name, &image, NULL) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to open the RBD image '%s'"),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to open the RBD image '%s'"),
|
||||
vol->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
rbd_image_info_t info;
|
||||
if (rbd_stat(image, &info, sizeof(info)) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to stat the RBD image"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to stat the RBD image"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -277,24 +277,24 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
if (rados_ioctx_create(ptr.cluster,
|
||||
pool->def->source.name, &ptr.ioctx) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
struct rados_cluster_stat_t stat;
|
||||
if (rados_cluster_stat(ptr.cluster, &stat) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to stat the RADOS cluster"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to stat the RADOS cluster"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
struct rados_pool_stat_t poolstat;
|
||||
if (rados_ioctx_pool_stat(ptr.ioctx, &poolstat) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to stat the RADOS pool '%s'"),
|
||||
pool->def->source.name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to stat the RADOS pool '%s'"),
|
||||
pool->def->source.name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -382,17 +382,17 @@ static int virStorageBackendRBDDeleteVol(virConnectPtr conn,
|
||||
|
||||
if (rados_ioctx_create(ptr.cluster,
|
||||
pool->def->source.name, &ptr.ioctx) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rbd_remove(ptr.ioctx, vol->name) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to remove volume '%s/%s'"),
|
||||
pool->def->source.name,
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to remove volume '%s/%s'"),
|
||||
pool->def->source.name,
|
||||
vol->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -423,23 +423,23 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn,
|
||||
|
||||
if (rados_ioctx_create(ptr.cluster,
|
||||
pool->def->source.name,&ptr.ioctx) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (vol->target.encryption != NULL) {
|
||||
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("storage pool does not support encrypted volumes"));
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("storage pool does not support encrypted volumes"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rbd_create(ptr.ioctx, vol->name, vol->capacity, &order) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create volume '%s/%s'"),
|
||||
pool->def->source.name,
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create volume '%s/%s'"),
|
||||
pool->def->source.name,
|
||||
vol->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -469,9 +469,9 @@ static int virStorageBackendRBDRefreshVol(virConnectPtr conn,
|
||||
|
||||
if (rados_ioctx_create(ptr.cluster,
|
||||
pool->def->source.name, &ptr.ioctx) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -506,23 +506,23 @@ static int virStorageBackendRBDResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
if (rados_ioctx_create(ptr.cluster,
|
||||
pool->def->source.name, &ptr.ioctx) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
|
||||
pool->def->source.name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rbd_open(ptr.ioctx, vol->name, &image, NULL) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to open the RBD image '%s'"),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to open the RBD image '%s'"),
|
||||
vol->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rbd_resize(image, capacity) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to resize the RBD image '%s'"),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to resize the RBD image '%s'"),
|
||||
vol->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -86,9 +86,9 @@ getDeviceType(uint32_t host,
|
||||
* character is not \0, virStrToLong_i complains
|
||||
*/
|
||||
if (virStrToLong_i(typestr, &p, 10, type) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Device type '%s' is not an integer"),
|
||||
typestr);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Device type '%s' is not an integer"),
|
||||
typestr);
|
||||
/* Hm, type wasn't an integer; seems strange */
|
||||
retval = -1;
|
||||
goto out;
|
||||
@ -266,9 +266,9 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
|
||||
&vol->allocation,
|
||||
&vol->capacity) < 0) {
|
||||
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to update volume for '%s'"),
|
||||
devpath);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to update volume for '%s'"),
|
||||
devpath);
|
||||
retval = -1;
|
||||
goto free_vol;
|
||||
}
|
||||
@ -365,9 +365,9 @@ getOldStyleBlockDevice(const char *lun_path ATTRIBUTE_UNUSED,
|
||||
blockp = strrchr(block_name, ':');
|
||||
if (blockp == NULL) {
|
||||
/* Hm, wasn't what we were expecting; have to give up */
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to parse block name %s"),
|
||||
block_name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to parse block name %s"),
|
||||
block_name);
|
||||
retval = -1;
|
||||
} else {
|
||||
blockp++;
|
||||
@ -453,9 +453,9 @@ processLU(virStoragePoolObjPtr pool,
|
||||
host, bus, target, lun);
|
||||
|
||||
if (getDeviceType(host, bus, target, lun, &device_type) < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to determine if %u:%u:%u:%u is a Direct-Access LUN"),
|
||||
host, bus, target, lun);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to determine if %u:%u:%u:%u is a Direct-Access LUN"),
|
||||
host, bus, target, lun);
|
||||
retval = -1;
|
||||
goto out;
|
||||
}
|
||||
|
@ -268,8 +268,8 @@ storagePoolLookupByUUID(virConnectPtr conn,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -293,8 +293,8 @@ storagePoolLookupByName(virConnectPtr conn,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
_("no pool with matching name '%s'"), name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
_("no pool with matching name '%s'"), name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -442,8 +442,8 @@ storageFindPoolSources(virConnectPtr conn,
|
||||
|
||||
backend_type = virStoragePoolTypeFromString(type);
|
||||
if (backend_type < 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage pool type %s"), type);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown storage pool type %s"), type);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -452,9 +452,9 @@ storageFindPoolSources(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
if (!backend->findPoolSources) {
|
||||
virStorageReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("pool type '%s' does not support source "
|
||||
"discovery"), type);
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("pool type '%s' does not support source "
|
||||
"discovery"), type);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ static int storagePoolIsActive(virStoragePoolPtr pool)
|
||||
obj = virStoragePoolObjFindByUUID(&driver->pools, pool->uuid);
|
||||
storageDriverUnlock(driver);
|
||||
if (!obj) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
ret = virStoragePoolObjIsActive(obj);
|
||||
@ -496,7 +496,7 @@ static int storagePoolIsPersistent(virStoragePoolPtr pool)
|
||||
obj = virStoragePoolObjFindByUUID(&driver->pools, pool->uuid);
|
||||
storageDriverUnlock(driver);
|
||||
if (!obj) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
ret = obj->configFile ? 1 : 0;
|
||||
@ -620,21 +620,21 @@ storagePoolUndefine(virStoragePoolPtr obj) {
|
||||
storageDriverLock(driver);
|
||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("pool is still active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("pool is still active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (pool->asyncjobs > 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
pool->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
pool->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -678,8 +678,8 @@ storagePoolStart(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -687,8 +687,8 @@ storagePoolStart(virStoragePoolPtr obj,
|
||||
goto cleanup;
|
||||
|
||||
if (virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("pool already active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("pool already active"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (backend->startPool &&
|
||||
@ -724,8 +724,8 @@ storagePoolBuild(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -733,8 +733,8 @@ storagePoolBuild(virStoragePoolPtr obj,
|
||||
goto cleanup;
|
||||
|
||||
if (virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is already active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is already active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -761,8 +761,8 @@ storagePoolDestroy(virStoragePoolPtr obj) {
|
||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -770,15 +770,15 @@ storagePoolDestroy(virStoragePoolPtr obj) {
|
||||
goto cleanup;
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (pool->asyncjobs > 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
pool->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
pool->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -821,8 +821,8 @@ storagePoolDelete(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -830,21 +830,21 @@ storagePoolDelete(virStoragePoolPtr obj,
|
||||
goto cleanup;
|
||||
|
||||
if (virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is still active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is still active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (pool->asyncjobs > 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
pool->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!backend->deletePool) {
|
||||
virStorageReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("pool does not support pool deletion"));
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("pool does not support pool deletion"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (backend->deletePool(obj->conn, pool, flags) < 0)
|
||||
@ -874,8 +874,8 @@ storagePoolRefresh(virStoragePoolPtr obj,
|
||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -883,15 +883,15 @@ storagePoolRefresh(virStoragePoolPtr obj,
|
||||
goto cleanup;
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (pool->asyncjobs > 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
pool->def->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pool '%s' has asynchronous jobs running."),
|
||||
pool->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -930,8 +930,8 @@ storagePoolGetInfo(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -970,8 +970,8 @@ storagePoolGetXMLDesc(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1000,8 +1000,8 @@ storagePoolGetAutostart(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1029,14 +1029,14 @@ storagePoolSetAutostart(virStoragePoolPtr obj,
|
||||
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!pool->configFile) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("pool has no config file"));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("pool has no config file"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1089,14 +1089,14 @@ storagePoolNumVolumes(virStoragePoolPtr obj) {
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
ret = pool->volumes.count;
|
||||
@ -1122,14 +1122,14 @@ storagePoolListVolumes(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1167,23 +1167,23 @@ storageVolumeLookupByName(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
vol = virStorageVolDefFindByName(pool, name);
|
||||
|
||||
if (!vol) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1221,8 +1221,8 @@ storageVolumeLookupByKey(virConnectPtr conn,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!ret)
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
"%s", _("no storage vol with matching key"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
"%s", _("no storage vol with matching key"));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1272,8 +1272,8 @@ storageVolumeLookupByPath(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
"%s", _("no storage vol with matching path"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
"%s", _("no storage vol with matching path"));
|
||||
|
||||
VIR_FREE(cleanpath);
|
||||
storageDriverUnlock(driver);
|
||||
@ -1300,14 +1300,14 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1319,8 +1319,8 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
|
||||
goto cleanup;
|
||||
|
||||
if (virStorageVolDefFindByName(pool, voldef->name)) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
"%s", _("storage vol already exists"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
"%s", _("storage vol already exists"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1331,9 +1331,9 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
|
||||
}
|
||||
|
||||
if (!backend->createVol) {
|
||||
virStorageReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("storage pool does not support volume "
|
||||
"creation"));
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("storage pool does not support volume "
|
||||
"creation"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1430,27 +1430,27 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
|
||||
}
|
||||
storageDriverUnlock(driver);
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (STRNEQ(obj->name, vobj->pool) && !origpool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
_("no storage pool with matching name '%s'"),
|
||||
vobj->pool);
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
_("no storage pool with matching name '%s'"),
|
||||
vobj->pool);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (origpool && !virStoragePoolObjIsActive(origpool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1459,9 +1459,9 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
|
||||
|
||||
origvol = virStorageVolDefFindByName(origpool ? origpool : pool, vobj->name);
|
||||
if (!origvol) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
vobj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
vobj->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1470,9 +1470,9 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
|
||||
goto cleanup;
|
||||
|
||||
if (virStorageVolDefFindByName(pool, newvol->name)) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("storage volume name '%s' already in use."),
|
||||
newvol->name);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("storage volume name '%s' already in use."),
|
||||
newvol->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1486,15 +1486,15 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
|
||||
newvol->allocation = origvol->capacity;
|
||||
|
||||
if (!backend->buildVolFrom) {
|
||||
virStorageReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("storage pool does not support volume creation from an existing volume"));
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("storage pool does not support volume creation from an existing volume"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (origvol->building) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
origvol->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
origvol->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1590,30 +1590,30 @@ storageVolumeDownload(virStorageVolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (vol == NULL) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vol->building) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1652,30 +1652,30 @@ storageVolumeUpload(virStorageVolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (vol == NULL) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vol->building) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1715,14 +1715,14 @@ storageVolumeResize(virStorageVolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
_("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
_("no storage pool with matching uuid"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("storage pool is not active"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1732,16 +1732,16 @@ storageVolumeResize(virStorageVolPtr obj,
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (vol == NULL) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vol->building) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1753,22 +1753,22 @@ storageVolumeResize(virStorageVolPtr obj,
|
||||
}
|
||||
|
||||
if (abs_capacity < vol->allocation) {
|
||||
virStorageReportError(VIR_ERR_INVALID_ARG,
|
||||
_("can't shrink capacity below "
|
||||
"existing allocation"));
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("can't shrink capacity below "
|
||||
"existing allocation"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (abs_capacity > vol->capacity + pool->def->available) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("Not enough space left on storage pool"));
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("Not enough space left on storage pool"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!backend->resizeVol) {
|
||||
virStorageReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("storage pool does not support changing of "
|
||||
"volume capacity"));
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("storage pool does not support changing of "
|
||||
"volume capacity"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1944,9 +1944,9 @@ storageVolumeWipeInternal(virStorageVolDefPtr def,
|
||||
alg_char = "random";
|
||||
break;
|
||||
default:
|
||||
virStorageReportError(VIR_ERR_INVALID_ARG,
|
||||
_("unsupported algorithm %d"),
|
||||
algorithm);
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("unsupported algorithm %d"),
|
||||
algorithm);
|
||||
}
|
||||
cmd = virCommandNew(SCRUB);
|
||||
virCommandAddArgList(cmd, "-f", "-p", alg_char,
|
||||
@ -1998,9 +1998,9 @@ storageVolumeWipePattern(virStorageVolPtr obj,
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (algorithm >= VIR_STORAGE_VOL_WIPE_ALG_LAST) {
|
||||
virStorageReportError(VIR_ERR_INVALID_ARG,
|
||||
_("wiping algorithm %d not supported"),
|
||||
algorithm);
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("wiping algorithm %d not supported"),
|
||||
algorithm);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2009,30 +2009,30 @@ storageVolumeWipePattern(virStorageVolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (vol == NULL) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vol->building) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2073,14 +2073,14 @@ storageVolumeDelete(virStorageVolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2090,22 +2090,22 @@ storageVolumeDelete(virStorageVolPtr obj,
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (!vol) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (vol->building) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume '%s' is still being allocated."),
|
||||
vol->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!backend->deleteVol) {
|
||||
virStorageReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("storage pool does not support vol deletion"));
|
||||
virReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("storage pool does not support vol deletion"));
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
@ -2154,23 +2154,23 @@ storageVolumeGetInfo(virStorageVolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (!vol) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2210,23 +2210,23 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
|
||||
storageDriverUnlock(driver);
|
||||
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (!vol) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -2257,23 +2257,23 @@ storageVolumeGetPath(virStorageVolPtr obj) {
|
||||
pool = virStoragePoolObjFindByName(&driver->pools, obj->pool);
|
||||
storageDriverUnlock(driver);
|
||||
if (!pool) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
virReportError(VIR_ERR_NO_STORAGE_POOL,
|
||||
"%s", _("no storage pool with matching uuid"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virStoragePoolObjIsActive(pool)) {
|
||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("storage pool is not active"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
vol = virStorageVolDefFindByName(pool, obj->name);
|
||||
|
||||
if (!vol) {
|
||||
virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
virReportError(VIR_ERR_NO_STORAGE_VOL,
|
||||
_("no storage vol with matching name '%s'"),
|
||||
obj->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user