Hi, All

    The patch will fix error message "UnboundLocalError: local variable
'path' referenced before assignment" when running vm.

    thanks.

>From 1f99c4f5b04100231c8712f2caf97d11dcc9eb37 Mon Sep 17 00:00:00 2001
From: "jarod.w" <work.iec23...@gmail.com>
Date: Tue, 6 Dec 2011 14:00:58 +0800
Subject: [PATCH] Fix error message "UnboundLocalError: local variable 'path'
 referenced before assignment" when running vm.

When the drive argument can't be parsed in _prepareVolumePath function, the
self.log.info statement will report the error in the /var/log/vdsm/vdsm.log
because the local variable 'path' isn't assigned. The patch adds the else
statement to assign the local variable.
---
 vdsm/clientIF.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 9d6b942..10e3a24 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -590,6 +590,9 @@ class clientIF:
             path = drive
         elif os.path.exists(drive):
             path = drive
+        else:
+            self.log.info("invaild drive : %s" % str(drive) )
+            path = ''
         self.log.info("prepared volume path: %s" % path)
         return path

-- 
1.7.7.3
From 1f99c4f5b04100231c8712f2caf97d11dcc9eb37 Mon Sep 17 00:00:00 2001
From: "jarod.w" <work.iec23...@gmail.com>
Date: Tue, 6 Dec 2011 14:00:58 +0800
Subject: [PATCH] Fix error message "UnboundLocalError: local variable 'path'
 referenced before assignment" when running vm.

When the drive argument can't be parsed in _prepareVolumePath function, the self.log.info statement will report the error in the /var/log/vdsm/vdsm.log because the local variable 'path' isn't assigned. The patch adds the else statement to assign the local variable.
---
 vdsm/clientIF.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 9d6b942..10e3a24 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -590,6 +590,9 @@ class clientIF:
             path = drive
         elif os.path.exists(drive):
             path = drive
+        else:
+            self.log.info("invaild drive : %s" % str(drive) )
+            path = ''
         self.log.info("prepared volume path: %s" % path)
         return path
 
-- 
1.7.7.3

_______________________________________________
vdsm-devel mailing list
vdsm-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/vdsm-devel

Reply via email to