CA-355401: make post attach scan best effort and report errors

From: Mark Syms <mark.syms@citrix.com>

Signed-off-by: Mark Syms <mark.syms@citrix.com>
---
 drivers/SR.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/SR.py b/drivers/SR.py
index feb606b..ff5723a 100755
--- a/drivers/SR.py
+++ b/drivers/SR.py
@@ -283,7 +283,15 @@ class SR(object):
         Return:
           None
         """
-        self.scan(uuid)
+        try:
+            self.scan(uuid)
+        except Exception as e:
+            util.SMlog("Error in SR.after_master_attach %s" % e)
+            msg_name = "POST_ATTACH_SCAN_FAILED"
+            msg_body = "Failed to scan SR %s after attaching, " \
+                "error %s" % (uuid, e)
+            self.session.xenapi.message.create(
+                msg_name, 2, "SR", uuid, msg_body)
 
     def detach(self, uuid):
         """Remove local access to the SR. Destroys any device 
