[Drbd-dev] [PATCH] block-drbd: Fix block-drbd remove command

Nick Wang nwang at suse.com
Fri Aug 11 06:26:10 CEST 2017


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.

Signed-off-by: Jim Fehlig <jfehlig at suse.com>
Signed-off-by: Nick Wang <nwang at suse.com>
CC: Lars Ellenberg <lars.ellenberg at linbit.com>
CC: Roland Kammerer <roland.kammerer at linbit.com>
CC: drbd-dev at lists.linbit.com

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

diff --git a/scripts/block-drbd b/scripts/block-drbd
index 11ec057f..23364cd6 100755
--- a/scripts/block-drbd
+++ b/scripts/block-drbd
@@ -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)"
-- 
2.12.0



More information about the drbd-dev mailing list