xmlStrEqual(cur->name, BAD_CAST "auth")) {
if (!(authdef = virStorageAuthDefParse(node->doc, cur)))
goto error;
+ /* Shared processing code with storage pools can leave
+ * this empty, but disk formatting uses it as does command
+ * creation - so use the secretType to attempt to fill it in.
+ */
+ if (!authdef->secrettype) {
+ const char *secrettype =
+ virSecretUsageTypeToString(authdef->secretType);
+ if (VIR_STRDUP(authdef->secrettype, secrettype) < 0)
+ goto error;
+ }
if ((auth_secret_usage =
virSecretUsageTypeFromString(authdef->secrettype)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
cur = cur->next;
}
- if (auth_secret_usage != -1 && auth_secret_usage != expected_secret_usage) {
+ /* Disk volume types will have authentication information handled in
+ * virStorageTranslateDiskSourcePool
+ */
+ if (def->src->type != VIR_STORAGE_TYPE_VOLUME &&
+ auth_secret_usage != -1 && auth_secret_usage != expected_secret_usage) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid secret type '%s'"),
virSecretUsageTypeToString(auth_secret_usage));
&pooldef->source) < 0)
goto cleanup;
+ /* Source pool may not fill in the secrettype field,
+ * so we need to do so here
+ */
+ if (def->src->auth && !def->src->auth->secrettype) {
+ const char *secrettype =
+ virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI);
+ if (VIR_STRDUP(def->src->auth->secrettype, secrettype) < 0)
+ goto cleanup;
+ }
+
if (virStorageAddISCSIPoolSourceHost(def, pooldef) < 0)
goto cleanup;
break;