The code for managing config files in /etc/xen assumed that the filename of
the config matched the name of the guest defined inside. One might thing
this a reasonable assumption, but in the wild I've had reports from users
whom have various config files for the same guest, but with different
settings. This caused some really wierd behaviour in the current code base.
virt-manager display would alternate displaying each config upon refresh!
Now, our API requires that there is only one config per name, so we can't
expose this to the UI. The attached patch, thus simply detects when we
have more than one config with same named guest, and hides the duplicates.
The way it does this is to change the way we cache configs. Previously we
had a single hash table mapping relative filenames to virConfPtr objects,
with the implicit assumption that relative filename == guest name. With
the attached patch we now maintain two hash tables. The first maps fully
qualified pathnames to virConfPtr objects, the second maps guest names
to the first filename found for that name. Thus when querying details for
a guest, we first resolve the guest name to its filename, and then lookup
the virConfPtr object associated with this filename.
This isn't perfect, but its a hell of alot better than current code, so
I want to commit it as is and figure out more improvement later. There is
no ABI issue here, so we can iterate over impl at will.
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|