On 06/24/2016 03:27 PM, Laine Stump wrote:
On 06/23/2016 05:59 PM, John Ferlan wrote:
>
> On 06/22/2016 01:37 PM, Laine Stump wrote:
>> in qemuConnectDomainXMLToNative. This function was only accounting for
>> about 1/10 of all the allocated items in the NetDef prior to memseting
>> it to all 0's. On top of that, it was going to great pains to learn
>> the name of the bridge device, but then never doing anything useful
>> with it (just putting it into data.ethernet.dev, which is *never* used
>> when building a qemu commandline). (I think this again all started off
>> as code with good intentions, but it was never completed, and instead
>> was just Frankensteinically cargo-culted into the odd mish mash we
>> have today).
>>
>> The resulting code is much simpler, produces exactly the same output,
>> and doesn't leak memory.
>> ---
>> src/qemu/qemu_driver.c | 56
>> ++++++--------------------------------------------
>> 1 file changed, 6 insertions(+), 50 deletions(-)
>>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index 517d0b8..4a8cb7a 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -6987,62 +6987,18 @@ static char
>> *qemuConnectDomainXMLToNative(virConnectPtr conn,
>> unsigned int bootIndex = net->info.bootIndex;
>> char *model = net->model;
>> virMacAddr mac = net->mac;
>> + char *script = net->script;
> Based on 3 spots below where net->script was set to NULL, should this
> only be set when "(net->type == VIR_DOMAIN_NET_TYPE_BRIDGE)" ?
Actually I think that since it's in the common part of the object (and
not in the bridge-specific part) that it should just *always* be saved
and re-set. I'll do that before I push.
derp. That's the way I'd already done it, I just forgot and didn't look
carefully.
So the reason I think this way is that it's a valid pointer no matter
what the value of net->type (since it's set to NULL for those types that
don't allow it), so it doesn't hurt anything to do it in all cases, and
it could always be an advantage if some other network type starts
supporting script (which is *never* going to happen).