From d3da87b8739dbf94b3a9c4d7d5f9d64bb0ab0f60 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 9 Feb 2009 09:24:38 +0000 Subject: [PATCH] backend.DrbdAttachNet: don't ignore Open() errors Currently the return value or errors from the block device Open() method are ignored. This patch catches any BlockDeviceErrors and returns a well-formatted result. Reviewed-by: ultrotter --- lib/backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/backend.py b/lib/backend.py index 8b19138df..e7558a5cf 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -2335,7 +2335,10 @@ def DrbdAttachNet(nodes_ip, disks, instance_name, multimaster): if multimaster: # change to primary mode for rd in bdevs: - rd.Open() + try: + rd.Open() + except errors.BlockDeviceError, err: + return (False, "Can't change to primary mode: %s" % str(err)) if multimaster: msg = "multi-master and primary" else: -- GitLab