[libvirt] incorrect VIR_DOMAIN_NONE usage

Daniel P. Berrange berrange at redhat.com
Tue Jul 8 17:50:19 UTC 2008


On Tue, Jul 01, 2008 at 10:04:58PM +0200, T?th Istv?n wrote:
> As I was trying to understand exact semantics of the libvirt flags api,
> I found an error in the xs_internal.c file.
> When it wants to indicate that it cannot report the state of the domain,
> it user VIR_DOMAIN_NONE as a return value, which does not, in fact,
> refer to a domain state at all, but is a dummy flag for creating
> domains, instead of VIR_DOMAIN_NOSTATE.
> 
> This patch does not affect the compiled code, only the readability.

Thanks, I've comitted this changed.

> On a related note, the defined enum flags seem inconstent to me, half of
> them have explicitly named 0 default values, and half of them don't,
> it's a bit confusing.
> 
> If
> 
> enum virStorageVolDeleteFlags {
> VIR_STORAGE_VOL_DELETE_NORMAL    =     0    : Delete metadata only (fast)
> VIR_STORAGE_VOL_DELETE_ZEROED    =     1    : Clear all data to zeros (slow)
> }
> 
> then why not
> 
> enum virConnectFlags {
> VIR_CONNECT_RW    =    0    : A read-write connection
> VIR_CONNECT_RO    =     1    : A readonly connection
> }
> 
> ?
> It would not affect existing code, and would make the library more
> consistent.

That sounds like a reasonable idea to me - if anyone wants to fix
this please send patches.

Regards,
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 :|




More information about the libvir-list mailing list