On 07/05/2011 01:45 AM, Laine Stump wrote:
The virDomainActualNetDef will only be parsed/formatted if the
parse/format function is called with the VIR_DOMAIN_XML_ACTUAL_NET
flags set (which is only needed when saving/loading a running domain's
state info to the stateDir). To prevent this flag bit from
accidentally being used in the public API, a "RESERVED" placeholder
was put into the public flags enum (at the same time, I noticed there
was another private flag that hadn't been reserved, so I added that
one, making both of these flags #defined from the public RESERVED
flags, and since it was also only used in domain_conf.c, I unpolluted
domain_conf.h, putting both #defines in domain_conf.c.
It turns out that we've used internal-use flags before. See how
libvirt.c filters out flags in both virDomainGetXMLDesc and
virSecretGetValue if the flags are larger than 0xffff, so that it can
start internal flags at 1<<16. Regarding the networking code and our
discussions on whether we should split out a second internalFlags
argument rather than cramming internal and external flags into a single
parameter, I think we should be consistent.
That is, either the existing uses of VIR_SECRET_GET_VALUE_INTERNAL_CALL
and VIR_DOMAIN_XML_INTERNAL_STATUS should be factored into internalFlags
arguments, or your new patches for virtual switches should define
VIR_DOMAIN_XML_ACTUAL_NET to be placed alongside
VIR_DOMAIN_XML_INTERNAL_STATUS
+++ b/include/libvirt/libvirt.h.in
@@ -1112,6 +1112,8 @@ typedef enum {
VIR_DOMAIN_XML_SECURE = (1 << 0), /* dump security sensitive information
too */
VIR_DOMAIN_XML_INACTIVE = (1 << 1), /* dump inactive domain information
*/
VIR_DOMAIN_XML_UPDATE_CPU = (1 << 2), /* update guest CPU requirements
according to host CPU */
+ VIR_DOMAIN_XML_RESERVED1 = (1 << 30), /* reserved for internal used */
+ VIR_DOMAIN_XML_RESERVED2 = (1 << 31), /* reserved for internal used */
} virDomainXMLFlags;
-/* Private component of virDomainXMLFlags */
-typedef enum {
- VIR_DOMAIN_XML_INTERNAL_STATUS = (1<<16), /* dump internal domain status
information */
-} virDomainXMLInternalFlags;
-
Meanwhile, I've got a patch to libvirt.c; I think virDomainGetXMLDesc
should reject an attempt to pass 1<<16, rather than silently ignore it.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org