On 06/06/2012 06:12 AM, Osier Yang wrote:
On 2012年01月28日 08:28, Eric Blake wrote:
> From: "Zeeshan Ali (Khattak)"<zeeshanak(a)gnome.org>
>
> Add a new function to allow changing of capacity of storage volumes.
> Plan out several flags, even if not all of them will be implemented
> up front.
>
Late response, but it seems not good idea to expose the options
which are actually not implemented underlying yet. One would get
error like:
# virsh vol-resize /var/lib/libvirt/images/test.img 60 --shrink
error: invalid argument: storageVolumeResize: unsupported flags (0x4)
With the magic number "0x4", one'd never known what it is. It can
be improved roundabout, but it should be avoided in the beginning.
Improving the error message would indeed be nice, if you can find a way
to do it across the board for all APIs that call virCheckFlags(). But
your general objection to avoiding flag values that are not implemented
across all drivers is impossible - as we add new APIs and new flags to
existing APIs, we are stuck with the fact that not all hypervisors can
implement all those flags simultaneously (if even at all). I see no
problem with defining a libvirt API with flags that some drivers cannot
implement yet, only with the quality of an error message when a flag is
unsupported.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org