File: 1001_fix-export-script-for-non-block-devices.patch

package info (click to toggle)
ganeti-os-noop 0.2-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 100 kB
  • sloc: sh: 10; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 538 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Description: Fix size detection for non-block devices
Author: Bastian Blank <bastian.blank@credativ.de>

--- a/ganeti/os/noop/export
+++ b/ganeti/os/noop/export
@@ -28,7 +28,11 @@
 # https://bugs.launchpad.net/ubuntu/+source/dash/+bug/249620
 
 if test -n "$EXP_SIZE_FD"; then
-  blockdev --getsize64 "$EXPORT_DEVICE" >&"$EXP_SIZE_FD"
+  if [ -f "$EXPORT_DEVICE" ]; then
+    stat -c '%s' "$EXPORT_DEVICE" >&"$EXP_SIZE_FD"
+  else
+    blockdev --getsize64 "$EXPORT_DEVICE" >&"$EXP_SIZE_FD"
+  fi
 fi
 
 dd if="$EXPORT_DEVICE" bs=1048576