#define VIR_FROM_THIS VIR_FROM_SECRET
-#define virSecretReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_SECRET, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
enum { SECRET_MAX_XML_FILE = 10*1024*1024 };
\f /* Internal driver state */
virUUIDFormat(def->uuid, uuidstr);
if (!virFileMatchesNameSuffix(xml_basename, uuidstr, ".xml")) {
- virSecretReportError(VIR_ERR_INTERNAL_ERROR,
- _("<uuid> does not match secret file name '%s'"),
- xml_basename);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("<uuid> does not match secret file name '%s'"),
+ xml_basename);
return -1;
}
goto cleanup;
}
if ((size_t)st.st_size != st.st_size) {
- virSecretReportError(VIR_ERR_INTERNAL_ERROR,
- _("'%s' file does not fit in memory"), filename);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("'%s' file does not fit in memory"), filename);
goto cleanup;
}
VIR_FORCE_CLOSE(fd);
if (!base64_decode_alloc(contents, st.st_size, &value, &value_size)) {
- virSecretReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid base64 in '%s'"), filename);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid base64 in '%s'"), filename);
goto cleanup;
}
if (value == NULL) {
if (secret == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(uuid, uuidstr);
- virSecretReportError(VIR_ERR_NO_SECRET,
- _("no secret with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_SECRET,
+ _("no secret with matching uuid '%s'"), uuidstr);
goto cleanup;
}
secret = secretFindByUsage(driver, usageType, usageID);
if (secret == NULL) {
- virSecretReportError(VIR_ERR_NO_SECRET,
- _("no secret with matching usage '%s'"), usageID);
+ virReportError(VIR_ERR_NO_SECRET,
+ _("no secret with matching usage '%s'"), usageID);
goto cleanup;
}
if (secret) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(secret->def->uuid, uuidstr);
- virSecretReportError(VIR_ERR_INTERNAL_ERROR,
- _("a secret with UUID %s already defined for use with %s"),
- uuidstr, usageID);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("a secret with UUID %s already defined for use with %s"),
+ uuidstr, usageID);
goto cleanup;
}
if (STRNEQ(oldUsageID, newUsageID)) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(secret->def->uuid, uuidstr);
- virSecretReportError(VIR_ERR_INTERNAL_ERROR,
- _("a secret with UUID %s is already defined for use with %s"),
- uuidstr, oldUsageID);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("a secret with UUID %s is already defined for use with %s"),
+ uuidstr, oldUsageID);
goto cleanup;
}
if (secret->def->private && !new_attrs->private) {
- virSecretReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot change private flag on existing secret"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot change private flag on existing secret"));
goto cleanup;
}
} else {
/* "secret" was added to the head of the list above */
if (listUnlink(&driverState->secrets) != secret)
- virSecretReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("list of secrets is inconsistent"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("list of secrets is inconsistent"));
else
secretFree(secret);
}
if (secret == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(obj->uuid, uuidstr);
- virSecretReportError(VIR_ERR_NO_SECRET,
- _("no secret with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_SECRET,
+ _("no secret with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (secret == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(obj->uuid, uuidstr);
- virSecretReportError(VIR_ERR_NO_SECRET,
- _("no secret with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_SECRET,
+ _("no secret with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (secret == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(obj->uuid, uuidstr);
- virSecretReportError(VIR_ERR_NO_SECRET,
- _("no secret with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_SECRET,
+ _("no secret with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (secret->value == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(obj->uuid, uuidstr);
- virSecretReportError(VIR_ERR_NO_SECRET,
- _("secret '%s' does not have a value"), uuidstr);
+ virReportError(VIR_ERR_NO_SECRET,
+ _("secret '%s' does not have a value"), uuidstr);
goto cleanup;
}
if ((internalFlags & VIR_SECRET_GET_VALUE_INTERNAL_CALL) == 0 &&
secret->def->private) {
- virSecretReportError(VIR_ERR_OPERATION_DENIED, "%s",
- _("secret is private"));
+ virReportError(VIR_ERR_OPERATION_DENIED, "%s",
+ _("secret is private"));
goto cleanup;
}
if (secret == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(obj->uuid, uuidstr);
- virSecretReportError(VIR_ERR_NO_SECRET,
- _("no secret with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_SECRET,
+ _("no secret with matching uuid '%s'"), uuidstr);
goto cleanup;
}