[libvirt] question about syntax of storage volume <target> element

John Ferlan jferlan at redhat.com
Mon Oct 1 22:57:53 UTC 2018



On 9/28/18 12:54 AM, Jim Fehlig wrote:
> I've attempted to use virt-manager to create a new VM that uses a volume
> from an rbd-based network pool, but have not been able to progress past
> step 4/5 where VM storage is selected. It appears virt-manager has
> problems properly detecting the volume as network-based storage, but
> before investigating those further I have a question about the syntax of
> the <target> element of a storage volume. The storage management page
> [0] of the website describing rbd volumes claims that the <path>
> subelement contains an 'rbd:rbd/' prefix in the volume path. But the
> page describing pool and volume format [1] syntax does not contain any
> info wrt specifying network URLs in the <path> subelement.

The [1] pool/vol page is meant to be a bit more "generic" with respect
to the general format of the <target>...<path>... field because some
fields can have different formats/expectations.

The [0] storage page should represent more details for each storage
backend's expectations over the format to be used. Although my
recollection is that it's modified/patched far less frequently than the
[1] page.

When in doubt though, I usually search "tests/*/*.{xml|args} and then of
course looking at the source code. If I must, I'll look at the RNG
files. In this case storagevol.rng says @path could be "anyURI" or
"absFilePath", nothing specific for RBD.

My git history search shows [0] seems to have been originally written
and intended as is seen now (commit 74951eade).

In the long run it doesn't matter if the <path> has the "rbd:" prefix
because virStorageSourceParseRBDColonString will strip it before
duplicating and then later qemuBuildNetworkDriveStr will slap it back
onto the command line.

How's that for a round-about way of saying - it doesn't seem to matter.

> 
> What is the expectation wrt the <path> subelement of the <target>
> element within rbd volume config? In general, should the <path>
> subelement encode the scheme (e.g. rbd://) of a network-based volume?
> And if so, should it be formatted in the traditional 'rbd://' vs
> 'rbd:rbd/' syntax?

I don't think "rbd:rbd/" is the prefix, just the "rbd:".  It just so
happens the example shows the RBD pool "source" name as "rbd" and the
"volume" as "myvol". If you look at the <key> that's more indicative of
path to the volume. The example when paired with the pool of source name
"rbdpool" probably should have shown "rbd:rbdpool/myvol" and the key
"rbdpool/myvol" (to be less confusing).

As for "expected" format - well being consistent would be "nice" -
probably depends on when the code was originally added though. Adding
new or consistent formats ends up being a coding and documenting
exercise and we never seem to be able to "lose" old formats and aren't
supposed to "rewrite" someone's files - so we're stuck.

John

> 
> Regards,
> Jim
> 
> [0] https://libvirt.org/storage.html#StorageBackendRBD
> [1] https://libvirt.org/formatstorage.html#StorageVolTarget
> 
> -- 
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list