File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed
Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -243,22 +243,22 @@ attach_nbd_device() {
243243 fi
244244
245245 # Connecting the device
246- (
247- export PATH=$( dirname $NBD_CLIENT )
246+ PATH=" $( dirname $NBD_CLIENT ) :$PATH " \
248247 run $( basename $NBD_CLIENT ) \
249- --blocksize 4096 \
250- --retry=$retries \
251- $nbd_host $nbd_port \
252- /dev/nbd${device} 2> /dev/null
253- )
254- local nbd_pid=$$
255- run sh -ec " echo -1000 > /proc/$nbd_pid /oom_score_adj"
256- run mkdir -p /run/sendsigs.omit.d
257- run sh -ec " echo {$nbd_pid } > /run/sendsigs.omit.d/nbd{$device }"
248+ --blocksize 4096 \
249+ --retry=$retries \
250+ ${nbd_host} ${nbd_port} \
251+ /dev/nbd${device}
252+
253+ # Checking device connection
254+ local nbd_pid=$( $NBD_CLIENT --check /dev/nbd${device} 2> /dev/null)
255+ if [ $? -ne 0 ]; then
256+ log_fatal_msg " Device connection failed." && return ;
257+ fi
258258
259- # Checking if device is already attached
260- run $NBD_CLIENT -c /dev/nbd ${device} > /dev/null 2> /dev/null || \
261- log_fatal_msg " Device connection failed. "
259+ run sh -ec " echo -1000 > /proc/ ${nbd_pid} /oom_score_adj "
260+ run mkdir -p /run/sendsigs.omit.d
261+ run sh -ec " echo ${nbd_pid} > /run/sendsigs.omit.d/nbd ${device} .pid "
262262
263263 # Fixing IO scheduler
264264 if grep -q ' \[cfq\]' /sys/block/nbd${device} /queue/scheduler
You can’t perform that action at this time.
0 commit comments