goto cleanup;
}
- /* Not using O_CREAT because the file is required to
- * already exist at this point */
- if (virFDStreamOpenFile(stream,
- vol->target.path,
- offset, length,
- O_WRONLY) < 0)
+ switch ((enum virStoragePoolType) pool->def->type) {
+ case VIR_STORAGE_POOL_DIR:
+ case VIR_STORAGE_POOL_FS:
+ case VIR_STORAGE_POOL_NETFS:
+ case VIR_STORAGE_POOL_LOGICAL:
+ case VIR_STORAGE_POOL_DISK:
+ case VIR_STORAGE_POOL_ISCSI:
+ case VIR_STORAGE_POOL_SCSI:
+ case VIR_STORAGE_POOL_MPATH:
+ /* Not using O_CREAT because the file is required to already exist at
+ * this point */
+ if (virFDStreamOpenFile(stream, vol->target.path,
+ offset, length, O_WRONLY) < 0)
+ goto cleanup;
+
+ break;
+
+ case VIR_STORAGE_POOL_SHEEPDOG:
+ case VIR_STORAGE_POOL_RBD:
+ case VIR_STORAGE_POOL_GLUSTER:
+ case VIR_STORAGE_POOL_LAST:
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("volume upload is not supported with pools of type %s"),
+ virStoragePoolTypeToString(pool->def->type));
goto cleanup;
+ }
ret = 0;