diff mbox

Chage disk serial length from 20 to 36

Message ID 1472457138-23386-1-git-send-email-ronyweng@synology.com
State New
Headers show

Commit Message

ronyweng@synology.com Aug. 29, 2016, 7:52 a.m. UTC
From: ronyweng <ronyweng@synology.com>

Openstack Cinder assigns volume a 36 characters uuid as serial.
Qemu will shrinks the uuid to 20 characters,
missmatch with original uuid.

Signed-off-by: Rony Weng <ronyweng@synology.com>
---
 hw/scsi/scsi-disk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini Aug. 29, 2016, 8:25 a.m. UTC | #1
On 29/08/2016 09:52, ronyweng@synology.com wrote:
> From: ronyweng <ronyweng@synology.com>
> 
> Openstack Cinder assigns volume a 36 characters uuid as serial.
> Qemu will shrinks the uuid to 20 characters,
> missmatch with original uuid.
> 
> Signed-off-by: Rony Weng <ronyweng@synology.com>
> ---
>  hw/scsi/scsi-disk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index 836a155..0e1bb68 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -599,8 +599,8 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
>              }
>  
>              l = strlen(s->serial);
> -            if (l > 20) {
> -                l = 20;
> +            if (l > 36) {
> +                l = 36;
>              }
>  
>              DPRINTF("Inquiry EVPD[Serial number] "
> 

Cc: qemu-stable@nongnu.org

Thanks, queued for 2.8 and 2.7.1

Paolo
Markus Armbruster Aug. 30, 2016, 12:08 p.m. UTC | #2
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 29/08/2016 09:52, ronyweng@synology.com wrote:
>> From: ronyweng <ronyweng@synology.com>
>> 
>> Openstack Cinder assigns volume a 36 characters uuid as serial.
>> Qemu will shrinks the uuid to 20 characters,
>> missmatch with original uuid.
>> 
>> Signed-off-by: Rony Weng <ronyweng@synology.com>
>> ---
>>  hw/scsi/scsi-disk.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
>> index 836a155..0e1bb68 100644
>> --- a/hw/scsi/scsi-disk.c
>> +++ b/hw/scsi/scsi-disk.c
>> @@ -599,8 +599,8 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
>>              }
>>  
>>              l = strlen(s->serial);
>> -            if (l > 20) {
>> -                l = 20;
>> +            if (l > 36) {
>> +                l = 36;
>>              }
>>  
>>              DPRINTF("Inquiry EVPD[Serial number] "
>> 
>
> Cc: qemu-stable@nongnu.org
>
> Thanks, queued for 2.8 and 2.7.1
>
> Paolo

Pointing to the applicable SCSI spec chapter & verse in the commit
message would be nice.  As is, 36 looks as arbitrary as 20.
Paolo Bonzini Aug. 30, 2016, 12:19 p.m. UTC | #3
On 30/08/2016 14:08, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> On 29/08/2016 09:52, ronyweng@synology.com wrote:
>>> From: ronyweng <ronyweng@synology.com>
>>>
>>> Openstack Cinder assigns volume a 36 characters uuid as serial.
>>> Qemu will shrinks the uuid to 20 characters,
>>> missmatch with original uuid.
>>>
>>> Signed-off-by: Rony Weng <ronyweng@synology.com>
>>> ---
>>>  hw/scsi/scsi-disk.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
>>> index 836a155..0e1bb68 100644
>>> --- a/hw/scsi/scsi-disk.c
>>> +++ b/hw/scsi/scsi-disk.c
>>> @@ -599,8 +599,8 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
>>>              }
>>>  
>>>              l = strlen(s->serial);
>>> -            if (l > 20) {
>>> -                l = 20;
>>> +            if (l > 36) {
>>> +                l = 36;
>>>              }
>>>  
>>>              DPRINTF("Inquiry EVPD[Serial number] "
>>>
>>
>> Cc: qemu-stable@nongnu.org
>>
>> Thanks, queued for 2.8 and 2.7.1
>>
>> Paolo
> 
> Pointing to the applicable SCSI spec chapter & verse in the commit
> message would be nice.  As is, 36 looks as arbitrary as 20.

There is no limit in the SCSI spec.  20 was copy-pasted from virtio-blk
which in turn was copy-pasted from ATA.  So 36 is even more arbitrary,
but bumping it up too much might cause issues (e.g. who knows there's no
off-by-one somewhere if I make it 252, so that 256 is the maximum amount
of returned data).

Thanks,

Paolo
Markus Armbruster Aug. 30, 2016, 12:44 p.m. UTC | #4
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 30/08/2016 14:08, Markus Armbruster wrote:
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>> 
>>> On 29/08/2016 09:52, ronyweng@synology.com wrote:
>>>> From: ronyweng <ronyweng@synology.com>
>>>>
>>>> Openstack Cinder assigns volume a 36 characters uuid as serial.
>>>> Qemu will shrinks the uuid to 20 characters,
>>>> missmatch with original uuid.
>>>>
>>>> Signed-off-by: Rony Weng <ronyweng@synology.com>
>>>> ---
>>>>  hw/scsi/scsi-disk.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
>>>> index 836a155..0e1bb68 100644
>>>> --- a/hw/scsi/scsi-disk.c
>>>> +++ b/hw/scsi/scsi-disk.c
>>>> @@ -599,8 +599,8 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
>>>>              }
>>>>  
>>>>              l = strlen(s->serial);
>>>> -            if (l > 20) {
>>>> -                l = 20;
>>>> +            if (l > 36) {
>>>> +                l = 36;
>>>>              }
>>>>  
>>>>              DPRINTF("Inquiry EVPD[Serial number] "
>>>>
>>>
>>> Cc: qemu-stable@nongnu.org
>>>
>>> Thanks, queued for 2.8 and 2.7.1
>>>
>>> Paolo
>> 
>> Pointing to the applicable SCSI spec chapter & verse in the commit
>> message would be nice.  As is, 36 looks as arbitrary as 20.
>
> There is no limit in the SCSI spec.  20 was copy-pasted from virtio-blk
> which in turn was copy-pasted from ATA.  So 36 is even more arbitrary,
> but bumping it up too much might cause issues (e.g. who knows there's no
> off-by-one somewhere if I make it 252, so that 256 is the maximum amount
> of returned data).

This paragraph would make a nice addition to the commit message :)
Paolo Bonzini Aug. 30, 2016, 3:35 p.m. UTC | #5
On 30/08/2016 14:44, Markus Armbruster wrote:
>> > There is no limit in the SCSI spec.  20 was copy-pasted from virtio-blk
>> > which in turn was copy-pasted from ATA.  So 36 is even more arbitrary,
>> > but bumping it up too much might cause issues (e.g. who knows there's no
>> > off-by-one somewhere if I make it 252, so that 256 is the maximum amount
>> > of returned data).
> This paragraph would make a nice addition to the commit message :)

Will do!

Paolo
diff mbox

Patch

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 836a155..0e1bb68 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -599,8 +599,8 @@  static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
             }
 
             l = strlen(s->serial);
-            if (l > 20) {
-                l = 20;
+            if (l > 36) {
+                l = 36;
             }
 
             DPRINTF("Inquiry EVPD[Serial number] "