qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio-blk: add default serial id


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: add default serial id
Date: Thu, 20 Sep 2012 14:57:39 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/20/2012 01:17 AM, Dave Young wrote:
> For virtio block device, if user does not specify the serial attribute,
> There will be not serial availabe, this is not convinient for identify

s/not serial availabe/no serial available/
s/convinient/convenient/
s/identify/identifying/

> the disk.
> 
> Doing something similar to ide disks, add a "VD0000?" default serial
> number if user does not specify it.
> 
> Signed-off-by: Dave Young <address@hidden>
> ---

>  
> +#define DEFAULT_VIRTIO_BLK_SERIAL_LEN 8

> +    char serial[DEFAULT_VIRTIO_BLK_SERIAL_LEN];
>  
>      if (req->elem.out_num < 1 || req->elem.in_num < 1) {
>          error_report("virtio-blk missing headers");
> @@ -388,12 +391,14 @@ static void virtio_blk_handle_request(Vi
>      } else if (type & VIRTIO_BLK_T_GET_ID) {
>          VirtIOBlock *s = req->dev;
>  
> +        snprintf(serial, DEFAULT_VIRTIO_BLK_SERIAL_LEN,
> +                 "VD%05d", s->drive_serial);

So if I cycle through hotplug and unplug for 100000 times, my string
will now be silently truncated, and I can end up with disks with shared
serial numbers?

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]