docs/about/deprecated.rst | 13 ++++ hw/block/virtio-blk.c | 18 +++-- tests/qtest/virtio-blk-test.c | 119 ++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 4 deletions(-)
QEMU has allowed the user to specify serials of arbitrary length for virtio-blk devices, even though the virtio-blk protocol can only communicate 20 characters of the serial to the guest. This means that a longer serial number on the command line is silently truncated to 20 characters from the guest perspective. As a first step to fix this, deprecate the silent truncation and turn it into a warning; we can later make this a hard error. While touching GET_ID, let's make it more spec compliant and clean up the internal state. Another part is planned that will actually enable users to use longer serials and additional device identifiers. This will need spec changes and would take more time than we have until the QEMU 11.2 freeze anyway, so I'll address this later. For now, the important thing is to get the deprecation period started. v2: - Drop truncation of qdev property for now [Stefan] - Add test case for exactly 20 characters [Stefan] - Fix missing guest_free() [Stefan] - Pass pattern_byte to get_id_request() instead of hardcoding it [Stefan] Kevin Wolf (4): virtio-blk: Implement full NUL padding for GET_ID virtio-blk-test: Add a basic GET_ID test case virtio-blk: Deprecate silent truncation of serial virtio-blk-test: Test truncated serial docs/about/deprecated.rst | 13 ++++ hw/block/virtio-blk.c | 18 +++-- tests/qtest/virtio-blk-test.c | 119 ++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 4 deletions(-) -- 2.56.0
Am 30.10.26 um 00:09 schrieb Kevin Wolf via Devel: > QEMU has allowed the user to specify serials of arbitrary length for > virtio-blk devices, even though the virtio-blk protocol can only > communicate 20 characters of the serial to the guest. This means that a > longer serial number on the command line is silently truncated to 20 > characters from the guest perspective. > > As a first step to fix this, deprecate the silent truncation and turn it > into a warning; we can later make this a hard error. While touching > GET_ID, let's make it more spec compliant and clean up the internal > state. > > Another part is planned that will actually enable users to use longer > serials and additional device identifiers. This will need spec changes > and would take more time than we have until the QEMU 11.2 freeze anyway, > so I'll address this later. For now, the important thing is to get the > deprecation period started. Consider me interested for future extensions. Additional information via virtio-blk would be really helpful. e.g. when forwarding a scsi LUN having the WWID visible for virtio-blk would be really nice. One usecase is that the guest visible WWID can be used to talk to the storage server to create snapshots without having to have a translation table from guest virtio-blk device to WWID. This was actually a real ask from a customer. virtio SCSI LUN passthru has that but it is significantly slower (factors) and that was also real feedback from that customer. > > v2: > - Drop truncation of qdev property for now [Stefan] > - Add test case for exactly 20 characters [Stefan] > - Fix missing guest_free() [Stefan] > - Pass pattern_byte to get_id_request() instead of hardcoding it > [Stefan] > > Kevin Wolf (4): > virtio-blk: Implement full NUL padding for GET_ID > virtio-blk-test: Add a basic GET_ID test case > virtio-blk: Deprecate silent truncation of serial > virtio-blk-test: Test truncated serial > > docs/about/deprecated.rst | 13 ++++ > hw/block/virtio-blk.c | 18 +++-- > tests/qtest/virtio-blk-test.c | 119 ++++++++++++++++++++++++++++++++++ > 3 files changed, 146 insertions(+), 4 deletions(-) >
On Fri, Oct 30, 2026 at 12:09:57AM +0100, Kevin Wolf wrote: > QEMU has allowed the user to specify serials of arbitrary length for > virtio-blk devices, even though the virtio-blk protocol can only > communicate 20 characters of the serial to the guest. This means that a > longer serial number on the command line is silently truncated to 20 > characters from the guest perspective. > > As a first step to fix this, deprecate the silent truncation and turn it > into a warning; we can later make this a hard error. While touching > GET_ID, let's make it more spec compliant and clean up the internal > state. > > Another part is planned that will actually enable users to use longer > serials and additional device identifiers. This will need spec changes > and would take more time than we have until the QEMU 11.2 freeze anyway, > so I'll address this later. For now, the important thing is to get the > deprecation period started. > > v2: > - Drop truncation of qdev property for now [Stefan] > - Add test case for exactly 20 characters [Stefan] > - Fix missing guest_free() [Stefan] > - Pass pattern_byte to get_id_request() instead of hardcoding it > [Stefan] > > Kevin Wolf (4): > virtio-blk: Implement full NUL padding for GET_ID > virtio-blk-test: Add a basic GET_ID test case > virtio-blk: Deprecate silent truncation of serial > virtio-blk-test: Test truncated serial > > docs/about/deprecated.rst | 13 ++++ > hw/block/virtio-blk.c | 18 +++-- > tests/qtest/virtio-blk-test.c | 119 ++++++++++++++++++++++++++++++++++ > 3 files changed, 146 insertions(+), 4 deletions(-) > > -- > 2.56.0 > Thanks, applied to my block tree: https://gitlab.com/stefanha/qemu/commits/block Stefan
© 2016 - 2026 Red Hat, Inc.