| Summary: | Drive serial number gets truncated | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Markus Armbruster <armbru> |
| Component: | qemu-kvm | Assignee: | jason wang <jasowang> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.1 | CC: | ehabkost, juzhang, mkenneth, shu, tburke, virt-maint |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | qemu-kvm-0.12.1.2-2.153.el6 | Doc Type: | Bug Fix |
| Doc Text: |
Cause: bug in the serial number setting code inside qemu-kvm.
Consequence: drive serial number got truncated to 8 characters.
Fix: Fix serial number assignment code.
Result: drive serial number not truncated anymore.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-05-19 11:21:11 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
can reproduce this bug with qemu-kvm-0.12.1.2-2.150.el6.x86_64 using comment0 step.so mark qa_ack+ flag. Reproduce on qemu-kvm-0.12.1.2-2.150.el6.x86_64: Steps to Reproduce: 1. Boot guest with: -drive file=/dev/vg_shutest2/lv_test,cache=none,format=raw,rerror=stop,werror=stop,id=test,if=none,serial=0123456789abcdefg -device ide-drive,drive=test,id=test-device,bootindex=2 2. In the guest, run hdparm -i /dev/sdb Actual results: hdparm shows "SerialNo=01234567" Verify on qemu-kvm-0.12.1.2-2.153.el6.x86_64: Actual results: hdparm shows "SerialNo=0123456789abcdefg" Conclusion: According to result above, this bug has been fixed. According to commnet7,set this issue status as verified.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Cause: bug in the serial number setting code inside qemu-kvm.
Consequence: drive serial number got truncated to 8 characters.
Fix: Fix serial number assignment code.
Result: drive serial number not truncated anymore.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0534.html An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0534.html |
Description of problem: The serial number defined with -drive is truncated to sizeof(char *) characters. How reproducible: Always Steps to Reproduce: 1. Give a disk a long serial number. I use an existing VM with one IDE disk for testing, to which I add a second IDE disk with my test serial number, like this: -drive if=none,id=foo,file=tmp.qcow2,serial=0123456789abcdef -device ide-drive,drive=foo 2. In the guest, run hdparm -i /dev/sdb Actual results: hdparm shows "SerialNo=01234567" Expected results: SerialNo=0123456789abcdef Additional info: Fix is a one-liner: diff --git a/vl.c b/vl.c index cda2d96..f66c05c 100644 --- a/vl.c +++ b/vl.c @@ -2475,7 +2475,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, dinfo->on_write_error = on_write_error; dinfo->opts = opts; if (serial) - strncpy(dinfo->serial, serial, sizeof(serial)); + strncpy(dinfo->serial, serial, sizeof(dinfo->serial)); QTAILQ_INSERT_TAIL(&drives, dinfo, next); if (is_extboot) { extboot_drive = dinfo;