On Thu, May 21, 2009 at 03:57:28PM +0900, Ryota Ozaki wrote:
Hi,
I've found a problem that a 'format' element in storage-{pool,vol} XML
doesn't behave as described in the document.
The document says that a format of {pool,vol} is specified as the value of
a format element, like:
<target>
<path>/var/lib/virt/images/sparse.img</path>
<format>qcow2</format>
<permissions>
However, the implementation doesn't follow this:
if (options->formatFromString) {
char *format = virXPathString(conn,
"string(/volume/target/format/@type)", ctxt);
if (format == NULL)
ret->target.format = options->defaultFormat;
else
ret->target.format = (options->formatFromString)(format);
if (ret->target.format < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
_("unknown volume format type %s"), format);
VIR_FREE(format);
goto cleanup;
}
VIR_FREE(format);
}
The implementation assumes that a format of {pool,vol} is specified as
the attribute of a format element, like:
<target>
<path>/var/lib/virt/images/sparse.img</path>
<format type='qcow2' />
<permissions>
Thus, we need to fix either the document or the implementation.
(I guess the implementation is correct, right?)
Yes, the code is always correct :-P If only because people will be using
it in the way it works, rather than the way its documented.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|