As we know that Libvirt translates a device name of the form (regex) /^[fhv]d[a-z]+[0-9]*$/ into the corresponding index (e.g. sda => 0, hdz => 25, vdaa => 26) such that any trailing string of digits is simply ignored. Thus disk names like vda2 after attaching vda1 will error out like this:
2017-02-16 10:31:05.214+0000: 10668: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'device_add': Duplicate ID 'virtio-disk7' for device
error: Failed to attach disk
error: internal error: unable to execute QEMU command 'device_add': Duplicate ID 'virtio-disk7' for device
Thus, should we document this (trailing digits are ignored) in virsh manpage for attach-disk or is the user expected to know?2017-02-16 10:31:05.214+0000: 10668: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'device_add': Duplicate ID 'virtio-disk7' for device
error: Failed to attach disk
error: internal error: unable to execute QEMU command 'device_add': Duplicate ID 'virtio-disk7' for device
On Thu, Feb 16, 2017 at 2:30 PM, Michal Privoznik <mprivozn@xxxxxxxxxx> wrote:
On 02/15/2017 12:14 PM, Nitesh Konkar wrote:
> Currently disk names do not follow the
> (regex) /^[fhv]d[a-z]+[0-9]*$/ completely
> and hence one can assign disk names like
> vd2 etc. This patch ensures that the
> disk names follow the regex mentioned.
> This patch also adds a testcase.
>
> Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
> ---
> src/util/virutil.c | 2 +-
> tests/utiltest.c | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
ACKed and pushed.
Michal
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list