Discussion:
[Libstoragemgmt-devel] [RFC] 'flags' parameter in all existing python API methods.
Gris Ge
2015-02-16 12:49:53 UTC
Permalink
Hey Guys,

I am planning to utilize 'flags' argument of lsm.Client.disks() for
querying free disk only. But I might need some clarification on this.

All the plugins in current code tree simply __ignore__ 'flags'
parameter which means even we pass something to 'flags', unimplemented plugin
will still do the identical task like we set flags as 0(Client.FLAG_RSVD).

I think 'wrong data is worse than no data'.
To achieve that, all public methods of plugins should have codes like this:

if flags != Client.FLAG_RSVD:
raise LsmError(
ErrorNumber.NO_SUPPORT,
"Got unsupported flags from argument")

In this case, 'flags' is optional for client, but mandatory for plugin.

Any ideas?

Best regards.
--
Gris Ge
Tony Asleson
2015-02-16 15:16:01 UTC
Permalink
Post by Gris Ge
Hey Guys,
I am planning to utilize 'flags' argument of lsm.Client.disks() for
querying free disk only. But I might need some clarification on this.
All the plugins in current code tree simply __ignore__ 'flags'
parameter which means even we pass something to 'flags', unimplemented plugin
will still do the identical task like we set flags as 0(Client.FLAG_RSVD).
I think 'wrong data is worse than no data'.
raise LsmError(
ErrorNumber.NO_SUPPORT,
"Got unsupported flags from argument")
The C code actually does check for this in the framework. There is a
macro LSM_FLAG_UNUSED_CHECK that is ensuring that the value is 0. If it
isn't zero we return LSM_ERR_INVALID_ARGUMENT (101).
Post by Gris Ge
In this case, 'flags' is optional for client, but mandatory for plugin.
Any ideas?
Lets add the check to python to make it consistent with the C code. We
need to ensure that an old plugin or client works with a new version of
the library, but not the other way around.

Regards,
Tony

Loading...