Skip to contentSkip to conversation

block-drbd: Fix block-drbd remove command

PATCH In review Nick Wang 2 participants 3 messages Aug 11, 2017 DRBD driver

lore
Share & tools
lore

Nick Wang

author
#0 lore raw

PATCH 1/1 block-drbd: Fix block-drbd remove command

Similar to a previous fix for the add command, strip any 'drbd:' prefix from the resource identifier read from xenstore. Otherwise the remove command can fail, leaving the resource in Primary role. This presents a data hazard if a VM is migrated to another host, where the resource will also be placed in Primary role.

---
 scripts/block-drbd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/block-drbd +1 -1
index 11ec057f..23364cd6 100755
@@ -284,7 +284,7 @@ case "$command" in
     case $t in 
       drbd|phy)
         p=$(xenstore_read "$XENBUS_PATH/params")
-        drbd_resource=$p
+        drbd_resource=${p#drbd:}
         drbd_role="$(drbdadm role $drbd_resource)"
         drbd_lrole="${drbd_role%%/*}"
         drbd_dev="$(drbdadm sh-dev $drbd_resource)"
Signature · 1 line
2.12.0
#1 lore raw
Quoted 21 lines · Nick Wang

Similar to a previous fix for the add command, strip any 'drbd:' prefix from the resource identifier read from xenstore. Otherwise the remove command can fail, leaving the resource in Primary role. This presents a data hazard if a VM is migrated to another host, where the resource will also be placed in Primary role.

---
 scripts/block-drbd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/block-drbd +0 -0
index 11ec057f..23364cd6 100755

scripts/block-drbd case "$command" in · line 290

Quoted 8 lines
scripts/block-drbd +1 -1
@@ -284,7 +284,7 @@ case "$command" in
     case $t in 
       drbd|phy)
         p=$(xenstore_read "$XENBUS_PATH/params")
-        drbd_resource=$p
+        drbd_resource=${p#drbd:}
         drbd_role="$(drbdadm role $drbd_resource)"
         drbd_lrole="${drbd_role%%/*}"
         drbd_dev="$(drbdadm sh-dev $drbd_resource)"

I squashed that with your previous one.

Thanks, rck

author
#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 2017-8-11 at 15:45, in message <[email protected]>, Roland

Quoted 17 lines · Kammerer
Quoted 16 lines · Nick Wang

Similar to a previous fix for the add command, strip any 'drbd:' prefix from the resource identifier read from xenstore. Otherwise the remove command can fail, leaving the resource in Primary role. This presents a data hazard if a VM is migrated to another host, where the resource will also be placed in Primary role.

---
 scripts/block-drbd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

scripts/block-drbd case "$command" in · line 290

Quoted 13 lines
scripts/block-drbd +1 -1
index 11ec057f..23364cd6 100755
@@ -284,7 +284,7 @@ case "$command" in
     case $t in 
       drbd|phy)
         p=$(xenstore_read "$XENBUS_PATH/params")
-        drbd_resource=$p
+        drbd_resource=${p#drbd:}
         drbd_role="$(drbdadm role $drbd_resource)"
         drbd_lrole="${drbd_role%%/*}"
         drbd_dev="$(drbdadm sh-dev $drbd_resource)"

I squashed that with your previous one.

Sorry for the miss in the previous patch and thanks for the help.

Best regards,
Nick