[Libosinfo] Resources inheritance for OSes, I need some help/feedback!

Fabiano Fidêncio fidencio at redhat.com
Tue Nov 13 09:10:17 UTC 2018


People,

I'm working on making OsinfoResources inherited for OSes that derives-
from/clones another OSes. The inheritance, IMO, should work like:
- os1 has:
  <resources arch="all">
    <minimum>
      <cpu>1000000000</cpu>
      <ram>1073741824</ram>
    </minimum>
  </resources>

- os2, which inherits the values from os1, has:
  <resources arch="all">
    <minimum>
      <n-cpus>2</n-cpus>
    </minimum>
  </resources>

- When calling osinfo_resources_get_cpu(os2), I'd expect to get:
1000000000.


In order to achieve so, we'll need a few more changes in the way
resources are added to OSes:
- Do *not* have duplicated resources for the same OS;
  - This can be easily done in osinfo_os_add_*_resources() + tests to
catch this situation;
- Do *not* have more than one resources with the same arch for the same
OS;
  - Although this can be easily done  in osinfo_os_add_*_resources() as
well, I'd go only for tests to catch this situation;
- Have a way to specify that a resource field shouldn't be inherited;
  - Here I can basically see two different approaches, and my personal
preference would be the former:
    - A specific value to be set to the field that will just be checked
when merging the resources' content when doing the inheritance
(suggestions are welcome and remember we can't use -1);
    - Add an extra attribute to the elements and have a new structure
(similar to DeviceLinks) and play with it in the same way I proposed
for removed devices*.


Daniel,

Is there something that I'm missing here? Is there something that
doesn't make sense in the described items?

*: 
https://www.redhat.com/archives/libosinfo/2018-November/msg00078.html

Best Regards,
-- 
Fabiano Fidêncio




More information about the Libosinfo mailing list