[libvirt] [PATCH] esx: Remove 1000 lines of generated but unused code

Matthias Bolte matthias.bolte at googlemail.com
Sat May 14 10:00:14 UTC 2011


2011/5/13 Eric Blake <eblake at redhat.com>:
> On 05/01/2011 01:57 PM, Matthias Bolte wrote:
>> Don't make all object and enum types (de)serializable by default.
>> Detect this from the input file instead.
>> ---
>>  src/esx/esx_vi_generator.py |  167 +++++++++++++++++++++++++++++++-----------
>>  1 files changed, 123 insertions(+), 44 deletions(-)
>
> Too bad generated files don't show up in the diffstat :)
>
>> +# there are two directions to spread features:
>> +# 1) up and down the inheritance chain
>> +# 2) from object types to their member property types
>> +# spreading needs to be done alternating on both directions because they can
>> +# affect each other
>> +features_have_changed = True
>> +
>> +while features_have_changed:
>> +    features_have_changed = False
>> +
>> +    for obj in objects_by_name.values():
>> +        propagate_feature(obj, Object.FEATURE__DEEP_COPY)
>> +        propagate_feature(obj, Object.FEATURE__SERIALIZE)
>> +        propagate_feature(obj, Object.FEATURE__DESERIALIZE)
>> +
>> +    for obj in objects_by_name.values():
>> +        inherit_features(obj)
>
> If I'm reading this correctly, this looks like the core of the algorithm
> - compute a closure of all features, and then only generate for where
> the features were needed, rather than the old code that generated
> features for everything whether it was needed or not.

Yes, that's correct :)

> My python is not very strong, but what you did was fairly readable and
> seems to make sense.  At any rate, it compiles.
>
> ACK.
>

Thanks, pushed.

Matthias




More information about the libvir-list mailing list