[libvirt] [PATCH] network: don't even call networkRunHook if there is no network

Laine Stump laine at laine.org
Wed Feb 26 11:14:19 UTC 2014


On 02/26/2014 12:42 PM, Michal Privoznik wrote:
> On 25.02.2014 16:46, Laine Stump wrote:
>> [...]
>> This patch refactors that code a slight bit so that networkRunHook()
>> doesn't get called if netdef is NULL (i.e. type != network) and to
>> place the conditional increment of dev->connections inside the "if
>> (netdef)" as well - dev can never be non-null if netdef is null
>> (because "dev" is the pointer to a device in a network's pool of
>> devices), so this doesn't have any functional effect, it just makes
>> the code clearer.
>> ---
>>
>>
>
> I thought this problem was solved by 83c404ff. I wonder what went
> wrong. Or maybe nothing is actually wrong, and this is merely just a
> refactoring.

Just refactoring to make it clearer what was happening (although it also
makes that fix unnecessary); I coincidentally found it while working on
the "unplug bandwidth and call networkRunHook only when appropriate"
patch. I spent time figuring out exactly when dev and netdef
would/wouldn't be NULL, and decided to make the code reflect my findings
so that the next person to come along wouldn't need to go through the
same investigation.




More information about the libvir-list mailing list