From 60bca04acdabf9d9e4bba47ce19fb2f4516f1dc0 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sun, 26 Jul 2009 17:27:49 +0200
Subject: [PATCH] bdev: allow ignoring of size in Assemble()

This patch changes the DRBD8 class (the only one to use the size in
Assemble) to ignore the size in Assemble when a zero size is passed.
This will allow activation of disks even when the size recorded in the
configuration is wrong.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/bdev.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/bdev.py b/lib/bdev.py
index e5ae92225..2d7c969af 100644
--- a/lib/bdev.py
+++ b/lib/bdev.py
@@ -1129,9 +1129,10 @@ class DRBD8(BaseDRBD):
     """
     args = ["drbdsetup", cls._DevPath(minor), "disk",
             backend, meta, "0",
-            "-d", "%sm" % size,
             "-e", "detach",
             "--create-device"]
+    if size:
+      args.extend(["-d", "%sm" % size])
     result = utils.RunCmd(args)
     if result.failed:
       _ThrowError("drbd%d: can't attach local disk: %s", minor, result.output)
-- 
GitLab