[libvirt] [PATCH 1/6] virsh: Print cephx and iscsi usage

John Ferlan jferlan at redhat.com
Mon Aug 19 20:33:54 UTC 2013


On 08/16/2013 09:46 AM, Ján Tomko wrote:
> On 08/08/2013 02:43 AM, John Ferlan wrote:
...
>> diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
>> index 9d34c1a..30027fe 100644
>> --- a/tools/virsh-secret.c
>> +++ b/tools/virsh-secret.c
...
>> +        int usageType = virSecretGetUsageType(sec);
>> +        const char *usageStr = virSecretUsageTypeTypeToString(usageType);
>>          char uuid[VIR_UUID_STRING_BUFLEN];
>> +
>>          if (virSecretGetUUIDString(list->secrets[i], uuid) < 0) {
>>              vshError(ctl, "%s", _("Failed to get uuid of secret"));
>>              goto cleanup;
>>          }
>>  
>> -        if (usageType) {
>> +        if (usageType > VIR_SECRET_USAGE_TYPE_NONE &&
> 
>> +            usageType < VIR_SECRET_USAGE_TYPE_LAST) {
> 
> This condition seems redundant.
> 

Hmm. right. Don't think the range check is necessary at all since NONE
is zero, then "if (usageType) {" should be sufficient.  I've removed the
extraneous check.

John




More information about the libvir-list mailing list