Change in vdsm[master]: getIsoList() returns dict with files metadata

nsoffer at redhat.com nsoffer at redhat.com
Tue Oct 1 21:43:27 UTC 2013


Nir Soffer has posted comments on this change.

Change subject: getIsoList() returns dict with files metadata
......................................................................


Patch Set 6:

(10 comments)

Looks very good - but need to emphasize the difference between the old isolist and new fileStats. It is little confusing that one collection include only usable files and the other all files; hopefully more precise documentation will mitigate this confusion.

....................................................
Commit Message
Line 5: CommitDate: 2013-10-01 22:45:50 +0300
Line 6: 
Line 7: getIsoList() returns dict with files metadata
Line 8: 
Line 9: Previously getIsoList() returned only list of file names although it has
More correct:
    Previously getIsoList() returned only list of usable file names although it has
Line 10: additional information such as file size.  Absence of this information
Line 11: prevented Engine to display correct data.
Line 12: 
Line 13: Now this API returns all available information about these files


Line 13: Now this API returns all available information about these files
Line 14: including files with wrong permissions, so Engine can display correct
Line 15: sizes and files that previously were hidden. It also returns
Line 16: the information in the old format in order to support old Engine
Line 17: versions.
Good description!
Line 18: 
Line 19: Change-Id: I0b28488a81cec756188ed763e4489b8a39b2b05d
Line 20: Bug-Url: https://bugzilla.redhat.com/1005889


....................................................
File vdsm/storage/hsm.py
Line 2240:     @public
Line 2241:     def getIsoList(self, spUUID, extension='iso', options=None):
Line 2242:         """
Line 2243:         Gets a dict of ISO files in a storage pool. For backward
Line 2244:         compatibility also return a list of file names.
More correct:
    Gets a dict of all iso files in a storage pool. For backward
    compatibility also return a list of usable file names.
Line 2245: 
Line 2246:         :param spUUID: The UUID of the storage pool you want to query.
Line 2247:         :type spUUID: UUID
Line 2248:         :param extension: ?


Line 2256:         vars.task.getSharedLock(STORAGE, spUUID)
Line 2257:         isoDom = self.getPool(spUUID).getIsoDomain()
Line 2258:         if not isoDom:
Line 2259:             raise se.GetIsoListError(spUUID)
Line 2260: 
Explain why do not filter fileStats:

    # Return all files stats including those with wrong permissions,
    # so client can tell why file is not usable and display more helpful
    # information.
Line 2261:         filesDict = isoDom.getFileList(pattern='*.' + extension,
Line 2262:                                        caseSensitive=False)
Line 2263:         # Get list of iso file names with proper permissions only
Line 2264:         fileNames = [key for key, value in filesDict.items()


Line 2257:         isoDom = self.getPool(spUUID).getIsoDomain()
Line 2258:         if not isoDom:
Line 2259:             raise se.GetIsoListError(spUUID)
Line 2260: 
Line 2261:         filesDict = isoDom.getFileList(pattern='*.' + extension,
Rename to fileStats
Line 2262:                                        caseSensitive=False)
Line 2263:         # Get list of iso file names with proper permissions only
Line 2264:         fileNames = [key for key, value in filesDict.items()
Line 2265:                      if value['status'] == 0]


Line 2259:             raise se.GetIsoListError(spUUID)
Line 2260: 
Line 2261:         filesDict = isoDom.getFileList(pattern='*.' + extension,
Line 2262:                                        caseSensitive=False)
Line 2263:         # Get list of iso file names with proper permissions only
Replace comment that explain what the code does with comment that explain why it does that:

    # Older clients expected list of file names with correct permissions.
Line 2264:         fileNames = [key for key, value in filesDict.items()
Line 2265:                      if value['status'] == 0]
Line 2266: 
Line 2267:         return {'isolist': fileNames, 'fileStats': filesDict}


Line 2260: 
Line 2261:         filesDict = isoDom.getFileList(pattern='*.' + extension,
Line 2262:                                        caseSensitive=False)
Line 2263:         # Get list of iso file names with proper permissions only
Line 2264:         fileNames = [key for key, value in filesDict.items()
Rename fileNames to usableFileNames
Line 2265:                      if value['status'] == 0]
Line 2266: 
Line 2267:         return {'isolist': fileNames, 'fileStats': filesDict}
Line 2268: 


Line 2269:     @public
Line 2270:     def getFloppyList(self, spUUID, options=None):
Line 2271:         """
Line 2272:         Gets a dict of floppy files in a storage pool. For backward
Line 2273:         compatibility also return a list of file names.
More correct:
    Gets a dict of all floppy files in a storage pool. For backward
    compatibility also return a list of usable file names.
Line 2274: 
Line 2275:         :param spUUID: The UUID of the storage pool you want to query.
Line 2276:         :type spUUID: UUID
Line 2277:         :param options: ?


....................................................
File vdsm_api/vdsmapi-schema.json
Line 3794: # @StorageDomainFileInfoMap:
Line 3795: #
Line 3796: # Mapping with information about files contained within a Storage Domain.
Line 3797: #
Line 3798: # @isolist: List of file names (for backward compatibility)
More correct:

    # @isolist: List of usable file names (for backward compatibility)
Line 3799: #
Line 3800: # @fileStats: Mapping with file information
Line 3801: #
Line 3802: # Since: 4.12.2


Line 3796: # Mapping with information about files contained within a Storage Domain.
Line 3797: #
Line 3798: # @isolist: List of file names (for backward compatibility)
Line 3799: #
Line 3800: # @fileStats: Mapping with file information
More correct:

    # @fileStats: Mapping with all file information, including unusable files
Line 3801: #
Line 3802: # Since: 4.12.2
Line 3803: ##
Line 3804: {'type': 'StorageDomainFileInfoMap',


-- 
To view, visit http://gerrit.ovirt.org/19544
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I0b28488a81cec756188ed763e4489b8a39b2b05d
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Sergey Gotliv <sgotliv at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgotliv at redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list