[libvirt] [PATCH 1/3] Introduce flag representing if MAC address of interface was generated or not.

Eric Blake eblake at redhat.com
Fri Feb 25 16:42:36 UTC 2011


On 02/24/2011 07:56 AM, Michal Privoznik wrote:
> ---
>  src/conf/domain_conf.c |    2 ++
>  src/conf/domain_conf.h |    1 +
>  2 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b97c1f0..454f631 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2593,8 +2593,10 @@ virDomainNetDefParseXML(virCapsPtr caps,
>                                   (const char *)macaddr);
>              goto error;
>          }
> +        def->mac_generated = false;
>      } else {
>          virCapabilitiesGenerateMac(caps, def->mac);
> +        def->mac_generated = true;
>      }

Rather than sticking the flag into the domain definition, I'd rather
pass it via the flags argument to
virDomainDeviceDefParse/virDomainNetDefParseXML - that is, most callers
will want:

virDomainDeviceDefParse(..., 0)

but qemuDomainDetachDevice (in qemu_driver.c) will want:

virDomainDeviceDefParse(..., VIR_DOMAIN_PARSE_NO_GENERATE)

(or maybe VIR_DOMAIN_XML_INACTIVE vs.
VIR_DOMAIN_XML_INACTIVE|VIR_DOMAIN_PARSE_NO_GENERATE)

That is, it's more than just detaching an interface mac addresses that
has an issue.  It's anywhere that parsing a device XML snippet to be
used to match an existing device that we want to suppress generation of
additional items in the parse (this includes generating a random mac for
an interface, but may include other generated items).  So adding a new
flag that can be used to tell ALL parse routines to avoid generating
extra data is more useful than changing the domain definition to say
whether one piece of information was generated.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110225/3750104e/attachment-0001.sig>


More information about the libvir-list mailing list