Sergey Gotliv has posted comments on this change.
Change subject: getIsoList() returns dict with files metadata
......................................................................
Patch Set 6:
(9 comments)
....................................................
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
Done
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
....................................................
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.
Done
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:
I respect your opinion but don't agree with it.
# Return all files stats including those with wrong permissions
You can see it from the code
# so client can tell why file is
not usable and display more helpful
# information.
This is a good sentence for patch description but not for the code. I
don't have to explain what client can do with that API. It has input an output...
I don't need to explain the natural behavior, code should do that. The natural
behavior of "getIsoList" is returning the iso list.
What is really needs explanation is why name list is filtered, because as a code reader I
don't expect the method with name "getIsoList" will filter something.
For example, getFileList doesn't filter anything, so according to you it has to defend
itself.
I am going with you and trying better explain "usable" side, but let's leave
new behavior as clean as possible.
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,
Done
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
Done
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()
I prefer it that way. The thing of "usable" is documented good enough.
You always can provide another patch with that rename.
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.
Done
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)
No problem, but I rephrased it.
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
See getFileList.
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(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgotliv(a)redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes