Change in vdsm[master]: Fail create NFS domain with correct exception upon ENOSPC

nsoffer at redhat.com nsoffer at redhat.com
Tue Aug 25 17:56:18 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: Fail create NFS domain with correct exception upon ENOSPC
......................................................................


Patch Set 2:

(2 comments)

https://gerrit.ovirt.org/#/c/45302/2/vdsm/storage/nfsSD.py
File vdsm/storage/nfsSD.py:

Line 84:             cls._prepareMetadata(domainDir, sdUUID, domainName, domClass,
Line 85:                                  remotePath, storageType, version)
Line 86:         except OSError as e:
Line 87:             if e.errno == errno.ENOSPC:
Line 88:                 raise se.StorageServerNoSpaceLeftError
You hide all other errors

Lets do it like this - first raise any error you cannot handle, then handle what you can.

And, when you raise, include the original error, so we can see it in the log.

    except OSError as e:
        if e.errno != ENOSPC:
            raise
        raise se.StorageServerNoSpaceLeftError(e)

I'm also not sure this is the right place to handle this error. What if there was enough space to prepare the meta data, but not for initializing the spm lease (see line 100).

Better handle this in a higher level, so any ENOSPC error will be reported correctly in the engine side.
Line 89: 
Line 90:         # create domain images folder
Line 91:         imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES)
Line 92:         oop.getProcessPool(sdUUID).fileUtils.createdir(imagesDir)


https://gerrit.ovirt.org/#/c/45302/2/vdsm/storage/storage_exception.py
File vdsm/storage/storage_exception.py:

Line 1203:     def __init__(self, replicaCount):
Line 1204:         self.value = "replica count = %s" % replicaCount
Line 1205: 
Line 1206: 
Line 1207: class StorageServerNoSpaceLeftError(StorageException):
> The StorageServer prefix does not help, lets remove it:
Also, it nice to include some context from the original error.

Lets do this:

    class NoSpaceLeftError(StorageException):
        code = ...
        message = ...
 
        def __init__(self, error):
            self.value = "%s: %s" % (self.message, error)

This will show error when we log this exception.
Line 1208:     message = "No space left on path"
Line 1209:     code = 481
Line 1210: 
Line 1211: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idf0342687668ee0c9339df17f017315acd72b1b9
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list