Browse Source

Merge "Add support for different disk bus"

Jenkins 3 years ago
parent
commit
838fa15054
1 changed files with 12 additions and 9 deletions
  1. 12
    9
      magnum/templates/kubernetes/fragments/configure-docker-storage.sh

+ 12
- 9
magnum/templates/kubernetes/fragments/configure-docker-storage.sh View File

@@ -2,24 +2,27 @@
2 2
 
3 3
 . /etc/sysconfig/heat-params
4 4
 
5
-DOCKER_DEV=/dev/disk/by-id/virtio-${DOCKER_VOLUME:0:20}
6
-
7 5
 attempts=60
8
-while [[ ! -b $DOCKER_DEV && $attempts != 0 ]]; do
9
-    echo "waiting for disk $DOCKER_DEV"
6
+while [ ${attempts} -gt 0 ]; do
7
+    device_name=$(ls /dev/disk/by-id | grep ${DOCKER_VOLUME:0:20}$)
8
+    if [ -n "${device_name}" ]; then
9
+        break
10
+    fi   
11
+    echo "waiting for disk device"
10 12
     sleep 0.5
11 13
     udevadm trigger
12 14
     let attempts--
13 15
 done
14 16
 
15
-if ! [ -b $DOCKER_DEV ]; then
16
-    echo "ERROR: device $DOCKER_DEV does not exist" >&2
17
+if [ -z "${device_name}" ]; then
18
+    echo "ERROR: disk device does not exist" >&2
17 19
     exit 1
18 20
 fi
19 21
 
20
-pvcreate $DOCKER_DEV
21
-vgcreate docker $DOCKER_DEV
22
+device_path=/dev/disk/by-id/${device_name}
23
+pvcreate ${device_path}
24
+vgcreate docker ${device_path}
22 25
 
23
-cat > /etc/sysconfig/docker-storage-setup <<EOF
26
+cat > /etc/sysconfig/docker-storage-setup << EOF
24 27
 VG=docker
25 28
 EOF

Loading…
Cancel
Save