[libvirt] [PATCH v2] Ensure disk names follow the disk name regex

Nitesh Konkar niteshkonkar.libvirt at gmail.com
Thu Feb 16 10:57:51 UTC 2017


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?
Also shd the error message reported be better in such cases or this one is
fine?

Thanks,
Nitesh.




On Thu, Feb 16, 2017 at 2:30 PM, Michal Privoznik <mprivozn at redhat.com>
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 at linux.vnet.ibm.com>
> > ---
> >  src/util/virutil.c | 2 +-
> >  tests/utiltest.c   | 3 ++-
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >
>
> ACKed and pushed.
>
> Michal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170216/122d78cd/attachment-0001.htm>


More information about the libvir-list mailing list