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