Skip to content

Commit

Permalink
Fix multiple mount options not recognized
Browse files Browse the repository at this point in the history
### What changes are proposed in this pull request?

Fix multiple mount options specified by `-o` not recognized by Alluxio Fuse.
The `-o` option can be specified multiple times, and each time it can take a comma separated list of `key=value` mount options.

### Why are the changes needed?

Fuse mounting with `bin/alluxio-fuse mount hdfs://10.10.1.2:9000/ /work/alluxio_fuse -o kernel_cache -o attr_timeout=6000 -o entry_timeout=6000` errors with

```
Exception in thread "main" com.beust.jcommander.ParameterException: "-o": couldn't convert "kernel_cache,attr_timeout=6000,entry_timeout=6000" to a `key=value` pair because contains more than 1 `=`
	at alluxio.fuse.options.MountCliOptions$KvPairsConverter.convert(MountCliOptions.java:74)
	at alluxio.fuse.options.MountCliOptions$KvPairsConverter.convert(MountCliOptions.java:50)
	at com.beust.jcommander.JCommander.convertValue(JCommander.java:1333)
	at com.beust.jcommander.ParameterDescription.addValue(ParameterDescription.java:249)
```

The bash scripts concatenates the multiple occurrences of `-o` into a comma-separated list and passes it to the Java program. The PR does the other way around, preserving them and splitting the kv pair list in a `-o` option into multiple options.

### Does this PR introduce any user facing changes?

No.

			pr-link: #18026
			change-id: cid-d9b5dcf65ba3de1bd9324ed01f74944171d5ef30
  • Loading branch information
dbw9580 authored Aug 22, 2023
1 parent 07f0dfb commit 0cb89b7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dora/integration/fuse/bin/alluxio-fuse
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ launch_fuse_process() {
while getopts "o:hf" opt > /dev/null 2>&1; do
case "${opt}" in
o)
mount_options+="${OPTARG},"
KV_PAIRS=(${OPTARG//,/ }) # split OPTARG by `,` into array
for pair in "${KV_PAIRS[@]}"; do
if [[ -n "$pair" ]]; then
mount_options+=" -o $pair"
fi
done
;;
f)
foreground='true'
Expand All @@ -199,19 +204,14 @@ launch_fuse_process() {
;;
esac
done
readonly mount_options
readonly foreground

if fuse_mounted "${mount_point}"; then
err "mount: ${mount_point} is already mounted"
return 1
fi

mount_options="$(echo "${mount_options}" | sed -E 's/,*$//g')" # remove trailing comma
if [[ -n "${mount_options}" ]]; then
mount_options="-o ${mount_options}"
fi
readonly mount_options

if [[ "${foreground}" == 'true' ]]; then
ALLUXIO_FUSE_JAVA_OPTS+=" -Dalluxio.logger.type=FUSE_LOGGER,Console"
fi
Expand Down

0 comments on commit 0cb89b7

Please sign in to comment.