[Libosinfo] [osinfo-db PATCH v2 1/6] schema: Add 'inherit' attribute to resources element

Fabiano Fidêncio fidencio at redhat.com
Wed Nov 14 11:25:41 UTC 2018


By adding this attribute we'll start having a way to allow resources
inheritance between OSes and its absence will be considered as "false".

An example of how it'll look like is:
foo:
  <resources arch="all">
    <minimum>
      <n_cpus>1</n_cpus>
      <storage>123456789</storage>
    </minimum>
  </resources>

bar (which derives-from/clones foo):
  <resources arch="all" inherit="true">
    <minimum>
      <n_cpus>3</n_cpus>
      <ram>12345678</ram>
    </minimum>
  </resources>

When querying for bar' minimum resources we should get:
n_cpus: 3
cpu: -1 (not set)
ram: 12345678
storage: 123456789

It means, basically all value *non* set for bar, will inherit the value
that's set for foo (in case we have any).

For the cases where we don't want to inherit something, we should do:
foo:
  <resources arch="all">
    <minimum>
      <n_cpus>1</n_cpus>
      <storage>123456789</storage>
    </minimum>
  </resources>

bar (which derives-from/clones foo):
  <resources arch="all" inherit="false">
    <minimum>
      <n_cpus>3</n_cpus>
      <ram>12345678</ram>
    </minimum>
  </resources>

When querying for bar' minimum resources we should get:
n_cpus: 3
cpu: -1 (not set)
ram: 12345678
storage: -1 (not set)

https://gitlab.com/libosinfo/osinfo-db/issues/15

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 data/schema/osinfo.rng.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/data/schema/osinfo.rng.in b/data/schema/osinfo.rng.in
index 6693391..fef7d01 100644
--- a/data/schema/osinfo.rng.in
+++ b/data/schema/osinfo.rng.in
@@ -287,6 +287,11 @@
       <attribute name='arch'>
         <ref name='archnamesorwildcard'/>
       </attribute>
+      <optional>
+        <attribute name='inherit'>
+          <ref name='bool'/>
+        </attribute>
+      </optional>
       <interleave>
         <optional>
           <element name='minimum'>
-- 
2.19.1




More information about the Libosinfo mailing list