[libvirt] [PATCH 1/5] Print SCSI logical unit as a positive integer

Eric Farman farman at linux.vnet.ibm.com
Thu Jun 18 18:01:24 UTC 2015



On 06/18/2015 12:47 PM, John Ferlan wrote:
> On 06/16/2015 11:29 PM, Eric Farman wrote:
>> A logical unit address is a positive integer, so it would be wise
>> to reject any negative inputs.
>>
>> Signed-off-by: Eric Farman <farman at linux.vnet.ibm.com>
>> ---
>>   src/conf/domain_conf.c | 2 +-
>>   tools/virsh-domain.c   | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
> While we're at it - why not bus and target as well?  That's doable in
> one patch...  I'll adjust this in order

The linux kernel/qemu code have some more confusion in how the bus and 
target are printed, but that's certainly not the responsibility of this 
patch series.  The LUN is always printed as %llu in the other layers of 
the stack, so I just wanted to get them in sync.

So yes, I'm fine with cleaning up bus and target in both these patches.

Thanks!

- Eric

>
> Looking back through history it seems commit id '5c811dce' added this
> functionality to domain.conf.c and commit id 'e962a579' added address
> parsing for the attach-disk command.
>
> I also peeked at the review cycle of the domain_conf.c change and found
> my name, but at the time I didn't notice that we were expecting a non
> negative value storing as unsigned, but printing as signed... In my
> defense I was newer to the group though ;-)
>
> So, I'll add bus/target as _uip and then adjust the title/commit message
> appropriately when I push the changes.
>
> John
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index ca55981..9e77b87 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -4954,7 +4954,7 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
>>                       goto cleanup;
>>                   }
>>   
>> -                if (virStrToLong_ui(unit, NULL, 0, &scsihostsrc->unit) < 0) {
>> +                if (virStrToLong_uip(unit, NULL, 0, &scsihostsrc->unit) < 0) {
>>                       virReportError(VIR_ERR_INTERNAL_ERROR,
>>                                      _("cannot parse unit '%s'"), unit);
>>                       goto cleanup;
>> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
>> index 4c47473..0bea462 100644
>> --- a/tools/virsh-domain.c
>> +++ b/tools/virsh-domain.c
>> @@ -488,7 +488,7 @@ static int str2SCSIAddress(const char *str, struct SCSIAddress *scsiAddr)
>>           return -1;
>>   
>>       unit++;
>> -    if (virStrToLong_ui(unit, NULL, 0, &scsiAddr->unit) != 0)
>> +    if (virStrToLong_uip(unit, NULL, 0, &scsiAddr->unit) != 0)
>>           return -1;
>>   
>>       return 0;
>>




More information about the libvir-list mailing list