Browse Source

enable and start service + manage slave

tags/pkg/staging/eole-2.7.0/0.1.0-0
Emmanuel Garette 4 months ago
parent
commit
44b499a55e
2 changed files with 9 additions and 4 deletions
  1. 0
    0
      dicos/20_drbd.xml
  2. 9
    4
      posttemplate/90-drbd

dicos/00_drbd.xml → dicos/20_drbd.xml View File


+ 9
- 4
posttemplate/90-drbd View File

@@ -2,8 +2,14 @@
2 2
 
3 3
 set -e
4 4
 mount_drdb() {
5
-    echo "/dev/drbd0 $(CreoleGet drbd_mountpoint) $(CreoleGet drbd_filetype) rw,noatime,nodiratime,_netdev 0 0" >> /etc/fstab
6
-    mount -a
5
+    systemctl enable drbd.service
6
+    systemctl start drbd.service
7
+    if [ $(CreoleGet drbd_primary non) = 'oui' ] || [ $(CreoleGet drbd_filetype) = 'ocfs2' ]; then
8
+        echo "/dev/drbd0 $(CreoleGet drbd_mountpoint) $(CreoleGet drbd_filetype) rw,noatime,nodiratime,_netdev 0 0" >> /etc/fstab
9
+        mount -a
10
+    else
11
+        echo "/dev/drbd0 $(CreoleGet drbd_mountpoint) $(CreoleGet drbd_filetype) rw,noatime,nodiratime,noauto 0 0" >> /etc/fstab
12
+    fi
7 13
 }
8 14
 
9 15
 init_o2cb() {
@@ -26,7 +32,6 @@ init_drdb() {
26 32
             init_o2cb
27 33
         fi
28 34
         mkfs.$(CreoleGet drbd_filetype) -N 8 -L "drbd cluster" /dev/drbd0
29
-        grep -q ^/dev/drbd0 /etc/fstab || mount_drdb
30 35
     elif [ $(CreoleGet drbd_filetype) = 'ocfs2' ]; then
31 36
         iptables -I INPUT -p tcp -m tcp --dport 7789 --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
32 37
         systemctl stop drbd
@@ -38,7 +43,6 @@ init_drdb() {
38 43
         done
39 44
         drbdadm primary $RES
40 45
         init_o2cb
41
-        grep -q ^/dev/drbd0 /etc/fstab || mount_drdb
42 46
     fi
43 47
 }
44 48
 
@@ -46,4 +50,5 @@ init_drdb() {
46 50
 if [ $(CreoleGet activer_drbd non) = 'oui' ]; then
47 51
     RES=$(CreoleGet drbd_res_name)
48 52
     drbdadm show-gi $RES &> /dev/null || init_drdb
53
+    grep -q ^/dev/drbd0 /etc/fstab || mount_drdb
49 54
 fi

Loading…
Cancel
Save