diff --git a/lib/bdev.py b/lib/bdev.py
index 8ae50e8faaa84230b010b66cac575464b66ad119..d5e711c557cb985f436456eeb5e10932bca9c4e2 100644
--- a/lib/bdev.py
+++ b/lib/bdev.py
@@ -2024,7 +2024,13 @@ class DRBD8(BaseDRBD):
       # even though we were passed some children at init time
       if match_r and "local_dev" not in info:
         break
-      if match_l and not match_r and "local_addr" in info:
+
+      # this case must be considered only if we actually have local
+      # storage, i.e. not in diskless mode, because all diskless
+      # devices are equal from the point of view of local
+      # configuration
+      if (match_l and "local_dev" in info and
+          not match_r and "local_addr" in info):
         # strange case - the device network part points to somewhere
         # else, even though its local storage is ours; as we own the
         # drbd space, we try to disconnect from the remote peer and