On 02/07/2013 12:37 PM, Michael Hanselmann wrote:
<snip>
>> +  @classmethod
>> +  def _VolumeToBlockdev(cls, pool, volume_name):
>> +    try:
>> +      return cls._ParseRbdShowmappedJson(pool, volume_name)
>> +    except RbdShowmappedJsonError:
>> +      return cls._ParseRbdShowmappedPlain(pool, volume_name)
> This is somewhat ugly. You're first trying to run the JSON version and
> if that doesn't work the plain-text one. Can't you detect beforehand
> if JSON is available?

This was discussed in previous mails with Iustin and Guido, and I think
the conclusion was that the alternative ways to detect if JSON
formatting is supported are too fragile.

The alternatives were parsing the rbd --version or rbd --help output, to
check if JSON formatting is supported. I'm not sure if there's a better
way to do it.

Thanks,
Stratos

-- 
Stratos Psomadakis
<[email protected]>


Reply via email to