Change in vdsm[ovirt-3.5-gluster]: gluster: fix AttributeError in exception.py

tjeyasin at redhat.com tjeyasin at redhat.com
Tue Aug 25 07:09:34 UTC 2015


Timothy Asir has uploaded a new change for review.

Change subject: gluster: fix AttributeError in exception.py
......................................................................

gluster: fix AttributeError in exception.py

Currently whenever an exception raised with extra arguments
apart from rc, out, err; the exception failed with
AttributeError due to base class member variables are not
initialized properly.

This patch fixes this AttributeError issue by calling the
ancestor's __init__ method explicitly to invoke base class
constructor which will initialize the base class member
variables like rc, out and err.

traceback:
Traceback (most recent call last):
  File "/usr/share/vdsm/vdsClient.py", line 2683, in <module>
    code, message = commands[command][0](commandArgs)
  File "/usr/share/vdsm/vdsClientGluster.py", line 394
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
Fault: <Fault 1: "<type 'exceptions.AttributeError'>:
'GlusterHookCheckSumMismatchException' object has no attribute 'out'">

Change-Id: Ic4c72daf30aee8f0024b1ef9ee064a205a500620
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1231722
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin at redhat.com>
---
M vdsm/gluster/exception.py
1 file changed, 17 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/45276/1

diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 17ad018..f45d249 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -84,6 +84,7 @@
     message = "Missing argument"
 
     def __init__(self, *args, **kwargs):
+        GlusterGeneralException.__init__(self)
         self.message = 'Missing argument: args=%s, kwargs=%s' % (args, kwargs)
 
 
@@ -369,6 +370,7 @@
     code = 4409
 
     def __init__(self, deviceList):
+        GlusterHostException.__init__(self)
         self.message = "Device(s) %s not found" % deviceList
 
 
@@ -376,6 +378,7 @@
     code = 4410
 
     def __init__(self, deviceList):
+        GlusterHostException.__init__(self)
         self.message = "Device(s) %s already in use" % deviceList
 
 
@@ -383,6 +386,7 @@
     code = 4411
 
     def __init__(self, device, mountPoint, fsType, mountOpts):
+        GlusterHostException.__init__(self)
         self.message = "Failed to mount device %s on mount point %s using " \
                        "fs-type %s with mount options %s" % (
                            device, mountPoint, fsType, mountOpts)
@@ -392,6 +396,7 @@
     code = 4412
 
     def __init__(self, device):
+        GlusterHostException.__init__(self)
         self.message = "fstab entry for device %s already exists" % device
 
 
@@ -429,23 +434,22 @@
 
 
 class GlusterHostStorageDeviceMakeDirsFailedException(GlusterHostException):
-    code = 4516
+    code = 4416
     message = "Make directories failed"
 
 
 class GlusterHostStorageMountPointInUseException(GlusterHostException):
-    code = 4517
+    code = 4417
 
     def __init__(self, mountPoint):
+        GlusterHostException.__init__(self)
         self.message = "Mount point %s is in use" % mountPoint
 
 
 class GlusterHostStorageDeviceVGCreateFailedException(GlusterHostException):
-    code = 4518
+    code = 4418
 
-    def __init__(self, name=None, devices=None,
-                 stripeSize=None, rc=0, out=(), err=()):
-        GlusterHostException.__init__(self)
+    def __init__(self, name, devices, stripeSize, rc=0, out=(), err=()):
         self.rc = rc
         self.out = out
         self.err = err
@@ -454,7 +458,7 @@
 
 
 class GlusterHostStorageDeviceVGScanFailedException(GlusterHostException):
-    code = 4519
+    code = 4419
     message = "vgscan failed"
 
 
@@ -482,7 +486,8 @@
 class GlusterHookNotFoundException(GlusterHookException):
     code = 4504
 
-    def __init__(self, glusterCmd=None, level=None, hookName=None):
+    def __init__(self, glusterCmd, level, hookName):
+        GlusterHookException.__init__(self)
         self.glusterCmd = glusterCmd
         self.level = level
         self.hookName = hookName
@@ -504,7 +509,8 @@
 class GlusterHookAlreadyExistException(GlusterHookException):
     code = 4507
 
-    def __init__(self, glusterCmd=None, level=None, hookName=None):
+    def __init__(self, glusterCmd, level, hookName):
+        GlusterHookException.__init__(self)
         self.glusterCmd = glusterCmd
         self.level = level
         self.hookName = hookName
@@ -517,6 +523,7 @@
     code = 4508
 
     def __init__(self, computedMd5Sum, expectedMd5Sum):
+        GlusterHookException.__init__(self)
         self.computedMd5Sum = computedMd5Sum
         self.expectedMd5Sum = expectedMd5Sum
         self.message = 'Hook file check sum:%s mismatch %s' % (computedMd5Sum,
@@ -542,6 +549,7 @@
     code = 4551
 
     def __init__(self, action=''):
+        GlusterServiceException.__init__(self)
         prefix = "%s: " % (action)
         self.message = prefix + "Service action is not supported"
         self.err = [self.message]


-- 
To view, visit https://gerrit.ovirt.org/45276
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4c72daf30aee8f0024b1ef9ee064a205a500620
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5-gluster
Gerrit-Owner: Timothy Asir <tjeyasin at redhat.com>


More information about the vdsm-patches mailing list