From fidencio at redhat.com Thu Jan 3 10:10:52 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 11:10:52 +0100 Subject: [Libosinfo] [osinfo-db PATCH] centos7: adjust "clones" to 7.6 Message-ID: <20190103101052.2735-1-fidencio@redhat.com> Latest CentOS7 clones the Latest RHEL7, which is 7.6 (instead of 7.5). Signed-off-by: Fabiano Fid?ncio --- data/os/centos.org/centos-7.0.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/os/centos.org/centos-7.0.xml.in b/data/os/centos.org/centos-7.0.xml.in index 0971c22..abca580 100644 --- a/data/os/centos.org/centos-7.0.xml.in +++ b/data/os/centos.org/centos-7.0.xml.in @@ -10,7 +10,7 @@ linux centos - + 2014-07-07 -- 2.19.2 From fidencio at redhat.com Thu Jan 3 13:09:05 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 14:09:05 +0100 Subject: [Libosinfo] [libosinfo PATCH 0/6] Update README for all projects Message-ID: <20190103130911.29711-1-fidencio@redhat.com> Let's point to pagure and also re-word a little bit the paragraph that mention the libosinfo list as the place to submit any patch. libosinfo: Fabiano Fid?ncio (2): README: Update download link README: Reword the patch submission paragraph README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) osinfo-db: Fabiano Fid?ncio (2): README: Update download link README: Reword the patch submission paragraph README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) osinfo-db-tools: Fabiano Fid?ncio (2): README: Update download link README: Reword the patch submission paragraph README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.19.2 From fidencio at redhat.com Thu Jan 3 13:09:06 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 14:09:06 +0100 Subject: [Libosinfo] [libosinfo PATCH 1/6] README: Update download link In-Reply-To: <20190103130911.29711-1-fidencio@redhat.com> References: <20190103130911.29711-1-fidencio@redhat.com> Message-ID: <20190103130911.29711-2-fidencio@redhat.com> Let's point to pagure instead of referring to the already sunset fedorahosted. Signed-off-by: Fabiano Fid?ncio --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 1a0fa2e..b7bffb6 100644 --- a/README +++ b/README @@ -13,7 +13,7 @@ libosinfo is Free Software and licenced under LGPLv2+. The latest official releases can be found at: - https://fedorahosted.org/releases/l/i/libosinfo/ + https://releases.pagure.org/libosinfo/ Dependencies ============ -- 2.19.2 From fidencio at redhat.com Thu Jan 3 13:09:07 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 14:09:07 +0100 Subject: [Libosinfo] [libosinfo PATCH 2/6] README: Reword the patch submission paragraph In-Reply-To: <20190103130911.29711-1-fidencio@redhat.com> References: <20190103130911.29711-1-fidencio@redhat.com> Message-ID: <20190103130911.29711-3-fidencio@redhat.com> Just mention that the libosinfo's mailing list is the *preferred* way to send patches. More info, as the one about the project accepting Merge Request, can be find in the project's website. Signed-off-by: Fabiano Fid?ncio --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index b7bffb6..e27990f 100644 --- a/README +++ b/README @@ -33,8 +33,8 @@ Patch submissions ================= Patch submissions are welcomed from any interested contributor. Please -use the libosinfo list for any patch submissions, or discussions about -the code: +use the libosinfo list as the preferred way for patch submissions, or +discussions about the code: https://www.redhat.com/mailman/listinfo/libosinfo -- 2.19.2 From fidencio at redhat.com Thu Jan 3 13:09:08 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 14:09:08 +0100 Subject: [Libosinfo] [osinfo-db PATCH 3/6] README: Update download link In-Reply-To: <20190103130911.29711-1-fidencio@redhat.com> References: <20190103130911.29711-1-fidencio@redhat.com> Message-ID: <20190103130911.29711-4-fidencio@redhat.com> Let's point to pagure instead of referring to the already sunset fedorahosted. Signed-off-by: Fabiano Fid?ncio --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 9f2f3af..e233d26 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ osinfo-db is Free Software and licenced under GPLv2+. The latest official releases can be found at: - https://fedorahosted.org/releases/l/i/libosinfo/ + https://releases.pagure.org/libosinfo/ Dependencies ============ -- 2.19.2 From fidencio at redhat.com Thu Jan 3 13:09:09 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 14:09:09 +0100 Subject: [Libosinfo] [osinfo-db PATCH 4/6] README: Reword the patch submission paragraph In-Reply-To: <20190103130911.29711-1-fidencio@redhat.com> References: <20190103130911.29711-1-fidencio@redhat.com> Message-ID: <20190103130911.29711-5-fidencio@redhat.com> Just mention that the libosinfo's mailing list is the *preferred* way to send patches. More info, as the one about the project accepting Merge Request, can be find in the project's website. Signed-off-by: Fabiano Fid?ncio --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index e233d26..65804cf 100644 --- a/README +++ b/README @@ -37,8 +37,8 @@ Patch submissions ================= Patch submissions are welcomed from any interested contributor. Please -use the libosinfo list for any patch submissions, or discussions about -the code: +use the libosinfo list as the preferred way for patch submissions, or +discussions about the code: https://www.redhat.com/mailman/listinfo/libosinfo -- 2.19.2 From fidencio at redhat.com Thu Jan 3 13:09:10 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 14:09:10 +0100 Subject: [Libosinfo] [osinfo-db-tools PATCH 5/6] README: Update download link In-Reply-To: <20190103130911.29711-1-fidencio@redhat.com> References: <20190103130911.29711-1-fidencio@redhat.com> Message-ID: <20190103130911.29711-6-fidencio@redhat.com> Let's point to pagure instead of referring to the already sunset fedorahosted. Signed-off-by: Fabiano Fid?ncio --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 0368735..e2cf6df 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ osinfo-db-tools is Free Software and licenced under GPLv2+. The latest official releases can be found at: - https://fedorahosted.org/releases/l/i/libosinfo/ + https://releases.pagure.org/libosinfo Dependencies ============ -- 2.19.2 From fidencio at redhat.com Thu Jan 3 13:09:11 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 14:09:11 +0100 Subject: [Libosinfo] [osinfo-db-tools PATCH 6/6] README: Reword the patch submission paragraph In-Reply-To: <20190103130911.29711-1-fidencio@redhat.com> References: <20190103130911.29711-1-fidencio@redhat.com> Message-ID: <20190103130911.29711-7-fidencio@redhat.com> Just mention that the libosinfo's mailing list is the *preferred* way to send patches. More info, as the one about the project accepting Merge Request, can be find in the project's website. Signed-off-by: Fabiano Fid?ncio --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index e2cf6df..faeae52 100644 --- a/README +++ b/README @@ -27,8 +27,8 @@ Patch submissions ================= Patch submissions are welcomed from any interested contributor. Please -use the libosinfo list for any patch submissions, or discussions about -the code: +use the libosinfo list as the preferred way for patch submissions, or +discussions about the code: https://www.redhat.com/mailman/listinfo/libosinfo -- 2.19.2 From fidencio at redhat.com Thu Jan 3 14:56:27 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 15:56:27 +0100 Subject: [Libosinfo] [libosinfo PATCH] loader: refuse to load non-compliant named files Message-ID: <20190103145627.10330-1-fidencio@redhat.com> There was a period of grace needed for backwards compatibility. After 3+ years, we can safely remove the code instroduced as part of 09ae3cf09 (which was released on 0.3.0). Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_loader.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index 77ca5ea..372871e 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -523,6 +523,7 @@ static gboolean osinfo_loader_check_id(const gchar *relpath, gchar *reldir; gboolean extension; gsize i; + gboolean ret = FALSE; if (!relpath) return TRUE; @@ -555,17 +556,15 @@ static gboolean osinfo_loader_check_id(const gchar *relpath, if (!g_str_equal(extension ? reldir : relpath, name)) { g_warning("Entity %s should be in file %s not %s", id, name, extension ? reldir : relpath); - g_free(reldir); - g_free(name); - return TRUE; /* In future switch to FALSE to refuse - * to load non-compliant named files. - * Need a period of grace for backcompat - * first though... Switch ETA Jan 2017 - */ + goto cleanup; } + + ret = TRUE; + + cleanup: g_free(reldir); g_free(name); - return TRUE; + return ret; } -- 2.19.2 From fidencio at redhat.com Thu Jan 3 15:16:51 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 16:16:51 +0100 Subject: [Libosinfo] [osinfo-db PATCH] dragonflybsd: Comment out 5.4.0 ISO URL Message-ID: <20190103151651.11246-1-fidencio@redhat.com> DragonFlyBSD 5.4.1 has been released and the 5.4.0 ISO has been removed from their servers (as they just keep the compressed ISOs for old releases). Signed-off-by: Fabiano Fid?ncio --- Pushed as test-mediauris fix --- data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in b/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in index 3a7f8dc..fe0af87 100644 --- a/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in +++ b/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in @@ -13,7 +13,10 @@ 2018-12-02 - http://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-5.4.0_REL.iso + DragonFly DragonFly v5.4.0 -- 2.19.2 From fidencio at redhat.com Thu Jan 3 15:20:32 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 16:20:32 +0100 Subject: [Libosinfo] [osinfo-db PATCH 1/4] dragonflybsd: Fix release date Message-ID: <20190103152035.12611-1-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in b/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in index fe0af87..23e32c4 100644 --- a/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in +++ b/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in @@ -10,7 +10,7 @@ <_vendor>DragonFlyBSD Project - 2018-12-02 + 2018-12-03 + + dragonflybsd5.4.1 + <_name>DragonFlyBSD 5.4.1 + 5.4.1 + dragonflybsd + dragonflybsd + <_vendor>DragonFlyBSD Project + + + 2018-12-24 + + + http://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-5.4.1_REL.iso + + DragonFly + DragonFly v5.4.1 + + + + -- 2.19.2 From fidencio at redhat.com Thu Jan 3 15:20:35 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 3 Jan 2019 16:20:35 +0100 Subject: [Libosinfo] [libosinfo PATCH 4/4] dragonflybsd: Add 5.4.1 test data In-Reply-To: <20190103152035.12611-1-fidencio@redhat.com> References: <20190103152035.12611-1-fidencio@redhat.com> Message-ID: <20190103152035.12611-4-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .../dfly-x86_64-5.4.1_REL.iso.txt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/isodata/dragonflybsd/dragonflybsd5.4.1/dfly-x86_64-5.4.1_REL.iso.txt diff --git a/tests/isodata/dragonflybsd/dragonflybsd5.4.1/dfly-x86_64-5.4.1_REL.iso.txt b/tests/isodata/dragonflybsd/dragonflybsd5.4.1/dfly-x86_64-5.4.1_REL.iso.txt new file mode 100644 index 0000000..30aa5ee --- /dev/null +++ b/tests/isodata/dragonflybsd/dragonflybsd5.4.1/dfly-x86_64-5.4.1_REL.iso.txt @@ -0,0 +1,29 @@ +CD-ROM is in ISO 9660 format +System id: DragonFly +Volume id: DragonFly v5.4.1 +Volume set id: +Publisher id: +Data preparer id: +Application id: MKISOFS ISO9660/HFS/UDF FILESYSTEM BUILDER & CDRECORD CD/DVD/BluRay CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING +Copyright File id: +Abstract File id: +Bibliographic File id: +Volume set size is: 1 +Volume set sequence number is: 1 +Logical block size is: 2048 +Volume size is: 506430 +El Torito VD version 1 found, boot catalog is in sector 6319 +Joliet with UCS level 3 found +Rock Ridge signatures version 1 found +Eltorito validation header: + Hid 1 + Arch 0 (x86) + ID '' + Key 55 AA + Eltorito defaultboot header: + Bootid 88 (bootable) + Boot media 0 (No Emulation Boot) + Load segment 0 + Sys type 0 + Nsect 4 + Bootoff 18B0 6320 -- 2.19.2 From cfergeau at redhat.com Fri Jan 4 09:46:46 2019 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 4 Jan 2019 10:46:46 +0100 Subject: [Libosinfo] [libosinfo PATCH] loader: refuse to load non-compliant named files In-Reply-To: <20190103145627.10330-1-fidencio@redhat.com> References: <20190103145627.10330-1-fidencio@redhat.com> Message-ID: <20190104094646.GC20900@natto.ory.fergeau.eu> Hey, looks good to me, Acked-by: Christophe Fergeau On Thu, Jan 03, 2019 at 03:56:27PM +0100, Fabiano Fid?ncio wrote: > There was a period of grace needed for backwards compatibility. After 3+ > years, we can safely remove the code instroduced as part of 09ae3cf09 > (which was released on 0.3.0). > > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_loader.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c > index 77ca5ea..372871e 100644 > --- a/osinfo/osinfo_loader.c > +++ b/osinfo/osinfo_loader.c > @@ -523,6 +523,7 @@ static gboolean osinfo_loader_check_id(const gchar *relpath, > gchar *reldir; > gboolean extension; > gsize i; > + gboolean ret = FALSE; > > if (!relpath) > return TRUE; > @@ -555,17 +556,15 @@ static gboolean osinfo_loader_check_id(const gchar *relpath, > if (!g_str_equal(extension ? reldir : relpath, name)) { > g_warning("Entity %s should be in file %s not %s", > id, name, extension ? reldir : relpath); > - g_free(reldir); > - g_free(name); > - return TRUE; /* In future switch to FALSE to refuse > - * to load non-compliant named files. > - * Need a period of grace for backcompat > - * first though... Switch ETA Jan 2017 > - */ > + goto cleanup; > } > + > + ret = TRUE; > + > + cleanup: > g_free(reldir); > g_free(name); > - return TRUE; > + return ret; > } > > > -- > 2.19.2 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From cfergeau at redhat.com Fri Jan 4 09:52:39 2019 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 4 Jan 2019 10:52:39 +0100 Subject: [Libosinfo] [osinfo-db-tools PATCH 6/6] README: Reword the patch submission paragraph In-Reply-To: <20190103130911.29711-7-fidencio@redhat.com> References: <20190103130911.29711-1-fidencio@redhat.com> <20190103130911.29711-7-fidencio@redhat.com> Message-ID: <20190104095239.GD20900@natto.ory.fergeau.eu> On Thu, Jan 03, 2019 at 02:09:11PM +0100, Fabiano Fid?ncio wrote: > Just mention that the libosinfo's mailing list is the *preferred* way to > send patches. More info, as the one about the project accepting Merge > Request, can be find in the project's website. s/find/found/ in the commit log (and in the other patches where you reused that log). Apart from this, the series looks good to me. Christophe > > Signed-off-by: Fabiano Fid?ncio > --- > README | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/README b/README > index e2cf6df..faeae52 100644 > --- a/README > +++ b/README > @@ -27,8 +27,8 @@ Patch submissions > ================= > > Patch submissions are welcomed from any interested contributor. Please > -use the libosinfo list for any patch submissions, or discussions about > -the code: > +use the libosinfo list as the preferred way for patch submissions, or > +discussions about the code: > > https://www.redhat.com/mailman/listinfo/libosinfo > > -- > 2.19.2 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From cfergeau at redhat.com Fri Jan 4 09:54:08 2019 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 4 Jan 2019 10:54:08 +0100 Subject: [Libosinfo] [osinfo-db PATCH] centos7: adjust "clones" to 7.6 In-Reply-To: <20190103101052.2735-1-fidencio@redhat.com> References: <20190103101052.2735-1-fidencio@redhat.com> Message-ID: <20190104095408.GE20900@natto.ory.fergeau.eu> On Thu, Jan 03, 2019 at 11:10:52AM +0100, Fabiano Fid?ncio wrote: > Latest CentOS7 clones the Latest RHEL7, which is 7.6 (instead of 7.5). Ok, Reviewed-by: Christophe Fergeau Do upgrades from centos 6.5 to latest centos7 still work? :) Christophe > > Signed-off-by: Fabiano Fid?ncio > --- > data/os/centos.org/centos-7.0.xml.in | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/data/os/centos.org/centos-7.0.xml.in b/data/os/centos.org/centos-7.0.xml.in > index 0971c22..abca580 100644 > --- a/data/os/centos.org/centos-7.0.xml.in > +++ b/data/os/centos.org/centos-7.0.xml.in > @@ -10,7 +10,7 @@ > linux > centos > > - > + > > 2014-07-07 > > -- > 2.19.2 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From cfergeau at redhat.com Fri Jan 4 09:55:46 2019 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 4 Jan 2019 10:55:46 +0100 Subject: [Libosinfo] [osinfo-db PATCH 1/4] dragonflybsd: Fix release date In-Reply-To: <20190103152035.12611-1-fidencio@redhat.com> References: <20190103152035.12611-1-fidencio@redhat.com> Message-ID: <20190104095546.GF20900@natto.ory.fergeau.eu> for the series, Acked-by: Christophe Fergeau On Thu, Jan 03, 2019 at 04:20:32PM +0100, Fabiano Fid?ncio wrote: > Signed-off-by: Fabiano Fid?ncio > --- > data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in b/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in > index fe0af87..23e32c4 100644 > --- a/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in > +++ b/data/os/dragonflybsd.org/dragonflybsd-5.4.0.xml.in > @@ -10,7 +10,7 @@ > <_vendor>DragonFlyBSD Project > > > - 2018-12-02 > + 2018-12-03 > > > + + + + + + acpi + apic + cpu-hotplug + numa + pci-device-hotplug + + + + + + + + + + + @@ -601,6 +625,9 @@ + + + -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:21 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:21 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 02/12] osinfo: Introduce OsinfoFeature In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-3-fidencio@redhat.com> OsinfoFeature is a new type intended to represent *guest* features. Its XML representation is something towards the lines of: cpu-hotplug pci-device-hotplug numa Where supported is an optional attribute which has "true" as its default value. Signed-off-by: Fabiano Fid?ncio --- osinfo/Makefile.am | 2 + osinfo/libosinfo.syms | 4 + osinfo/osinfo.h | 1 + osinfo/osinfo_feature.c | 202 ++++++++++++++++++++++++++++++++ osinfo/osinfo_feature.h | 81 +++++++++++++ osinfo/osinfo_feature_private.h | 36 ++++++ po/POTFILES.in | 1 + 7 files changed, 327 insertions(+) create mode 100644 osinfo/osinfo_feature.c create mode 100644 osinfo/osinfo_feature.h create mode 100644 osinfo/osinfo_feature_private.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index b43e32b..d553ecc 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -80,6 +80,7 @@ libosinfo_impl_include_HEADERS = \ osinfo_device_driver.h \ osinfo_device_driverlist.h \ osinfo_entity.h \ + osinfo_feature.h \ osinfo_filter.h \ osinfo_install_config.h \ osinfo_install_config_param.h \ @@ -127,6 +128,7 @@ libosinfo_c_files = \ osinfo_devicelinkfilter.c \ osinfo_device_driver.c \ osinfo_device_driverlist.c \ + osinfo_feature.c \ osinfo_install_config.c \ osinfo_install_config_param.c \ osinfo_install_config_paramlist.c \ diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 56cf9a5..ef0db99 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -533,6 +533,10 @@ LIBOSINFO_1.3.0 { global: osinfo_error_quark; + osinfo_feature_get_name; + osinfo_feature_get_type; + osinfo_feature_new; + osinfo_image_get_architecture; osinfo_image_get_cloud_init; osinfo_image_get_format; diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index 81c0daf..ff7f2e5 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/osinfo/osinfo_feature.c b/osinfo/osinfo_feature.c new file mode 100644 index 0000000..520fa14 --- /dev/null +++ b/osinfo/osinfo_feature.c @@ -0,0 +1,202 @@ +/* + * libosinfo: A single guest feature + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include + +#include +#include + +#include "osinfo/osinfo_feature_private.h" + +G_DEFINE_TYPE(OsinfoFeature, osinfo_feature, OSINFO_TYPE_ENTITY); + +#define OSINFO_FEATURE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), OSINFO_TYPE_FEATURE, OsinfoFeaturePrivate)) + +/** + * SECTION:osinfo_feature + * @short_description: A guest feature + * @see_also: #OsinfoOs, #OsinfoPlatform + * + * #OsinfoFeature is an entity representing some kind of guest + * feature. Features can be associated with operating systems + * and platforms. + */ + +struct _OsinfoFeaturePrivate +{ + gboolean unsupported; +}; + +enum { + PROP_0, + + PROP_NAME +}; + +static void +osinfo_feature_set_property(GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + OsinfoFeature *feature = OSINFO_FEATURE(object); + + switch(property_id) { + case PROP_NAME: + osinfo_entity_set_param(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_NAME, + g_value_get_string(value)); + break; + + default: + /* We don't have any other property ... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + break; + } +} + +static void +osinfo_feature_get_property(GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + OsinfoFeature *feature = OSINFO_FEATURE(object); + + switch(property_id) { + case PROP_NAME: + g_value_set_string(value, osinfo_feature_get_name(feature)); + break; + + default: + /* We don't have any other property ... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + break; + } +} + +static void osinfo_feature_finalize(GObject *object); + +static void +osinfo_feature_finalize(GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS(osinfo_feature_parent_class)->finalize(object); +} + +/* Init functions */ +static void +osinfo_feature_class_init(OsinfoFeatureClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS(klass); + GParamSpec *pspec; + + g_klass->set_property = osinfo_feature_set_property; + g_klass->get_property = osinfo_feature_get_property; + + /** + * OsinfoFeature:name: + * + * The name of the feature + */ + pspec = g_param_spec_string("name", + "Name", + _("Feature name"), + NULL, + G_PARAM_WRITABLE | + G_PARAM_READABLE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, PROP_NAME, pspec); + + g_klass->finalize = osinfo_feature_finalize; + g_type_class_add_private(klass, sizeof(OsinfoFeaturePrivate)); +} + +static void +osinfo_feature_init(OsinfoFeature *feature) +{ + feature->priv = OSINFO_FEATURE_GET_PRIVATE(feature); +} + +OsinfoFeature *osinfo_feature_new(const gchar *name) +{ + return g_object_new(OSINFO_TYPE_FEATURE, + "id", name, + "name", name, + NULL); +} + +/** + * osinfo_feature_get_name: + * @feature: an #OsinfoFeature instance + * + * Return the name of the feature. + * + * Returns: (transfer none): the name of the feature + */ +const gchar *osinfo_feature_get_name(OsinfoFeature *feature) +{ + g_return_val_if_fail(OSINFO_IS_FEATURE(feature), NULL); + + return osinfo_entity_get_param_value(OSINFO_ENTITY(feature), OSINFO_FEATURE_PROP_NAME); +} + +/** + * osinfo_feature_get_supported: + * @feature: an #OsinfoFeature instance + * + * Mind that this method is *private*! + * + * Return whether the feature is supported or not. + */ +gboolean osinfo_feature_get_supported(OsinfoFeature *feature) +{ + g_return_val_if_fail(OSINFO_IS_FEATURE(feature), FALSE); + + return !feature->priv->unsupported; +} + +/** + * osinfo_feature_set_supported + * @feature: an #OsinfoFeature instance + * @supported: boolean value + * + * Mind that this method is *private*! + * + * Set whether a feature is supported or not. + */ +void osinfo_feature_set_supported(OsinfoFeature *feature, gboolean supported) +{ + g_return_if_fail(OSINFO_IS_FEATURE(feature)); + + feature->priv->unsupported = !supported; +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_feature.h b/osinfo/osinfo_feature.h new file mode 100644 index 0000000..c4fca30 --- /dev/null +++ b/osinfo/osinfo_feature.h @@ -0,0 +1,81 @@ +/* + * libosinfo: A single guest feature + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include +#include + +#ifndef __OSINFO_FEATURE_H__ +#define __OSINFO_FEATURE_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_FEATURE (osinfo_feature_get_type ()) +#define OSINFO_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_FEATURE, OsinfoFeature)) +#define OSINFO_IS_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_FEATURE)) +#define OSINFO_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_FEATURE, OsinfoFeatureClass)) +#define OSINFO_IS_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_FEATURE)) +#define OSINFO_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_FEATURE, OsinfoFeatureClass)) + +typedef struct _OsinfoFeature OsinfoFeature; + +typedef struct _OsinfoFeatureClass OsinfoFeatureClass; + +typedef struct _OsinfoFeaturePrivate OsinfoFeaturePrivate; + +#define OSINFO_FEATURE_PROP_NAME "name" + +/* object */ +struct _OsinfoFeature +{ + OsinfoEntity parent_instance; + + /* public */ + + /* private */ + OsinfoFeaturePrivate *priv; +}; + +/* class */ +struct _OsinfoFeatureClass +{ + /*< private >*/ + OsinfoEntityClass parent_class; + + /* class members */ +}; + +GType osinfo_feature_get_type(void); + +OsinfoFeature *osinfo_feature_new(const gchar *name); + +const gchar *osinfo_feature_get_name(OsinfoFeature *feature); + +#endif /* __OSINFO_FEATURE_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_feature_private.h b/osinfo/osinfo_feature_private.h new file mode 100644 index 0000000..132c661 --- /dev/null +++ b/osinfo/osinfo_feature_private.h @@ -0,0 +1,36 @@ +/* + * libosinfo: A single guest feature + * + * Copyright (C) 2019 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#ifndef __OSINFO_FEATURE_PRIVATE_H__ +#define __OSINFO_FEATURE_PRIVATE_H__ + +gboolean osinfo_feature_get_supported(OsinfoFeature *feature); +void osinfo_feature_set_supported(OsinfoFeature *feature, gboolean supported); + +#endif /* __OSINFO_FEATURE_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 2a714df..86f7090 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -3,6 +3,7 @@ osinfo/osinfo_deployment.c osinfo/osinfo_devicelink.c osinfo/osinfo_devicelinkfilter.c osinfo/osinfo_entity.c +osinfo/osinfo_feature.c osinfo/osinfo_image.c osinfo/osinfo_install_config_param.c osinfo/osinfo_install_script.c -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:22 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:22 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 03/12] tests: Add basic test for OsinfoFeature In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-4-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .gitignore | 1 + tests/Makefile.am | 5 ++++ tests/test-feature.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 tests/test-feature.c diff --git a/.gitignore b/.gitignore index b888b50..524d9a1 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ tests/test-list tests/test-db tests/test-devicelist tests/test-devicelinklist +tests/test-feature tests/test-filter tests/test-hypervisorlist tests/test-install-script diff --git a/tests/Makefile.am b/tests/Makefile.am index 45703df..6f3cdb4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,7 @@ check_PROGRAMS = \ test-list \ test-devicelist \ test-devicelinklist \ + test-feature \ test-filter \ test-media \ test-product \ @@ -54,6 +55,10 @@ test_device_LDADD = $(COMMON_LDADD) test_device_CFLAGS = $(COMMON_CFLAGS) test_device_SOURCES = test-device.c +test_feature_LDADD = $(COMMON_LDADD) +test_feature_CFLAGS = $(COMMON_CFLAGS) +test_feature_SOURCES = test-feature.c + test_filter_LDADD = $(COMMON_LDADD) test_filter_CFLAGS = $(COMMON_CFLAGS) test_filter_SOURCES = test-filter.c diff --git a/tests/test-feature.c b/tests/test-feature.c new file mode 100644 index 0000000..12a6944 --- /dev/null +++ b/tests/test-feature.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2018 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see + * + * Authors: + * Fabiano Fid?ncio + */ + +#include + +#include +#include "osinfo/osinfo_feature_private.h" + + +static void +test_basic(void) +{ + OsinfoFeature *feature = osinfo_feature_new("foo"); + + g_assert_true(OSINFO_IS_FEATURE(feature)); + g_assert_cmpstr(osinfo_entity_get_id(OSINFO_ENTITY(feature)), ==, "foo"); + g_assert_cmpstr(osinfo_feature_get_name(feature), ==, "foo"); + g_assert_true(osinfo_feature_get_supported(feature)); + + osinfo_feature_set_supported(feature, FALSE); + g_assert_false(osinfo_feature_get_supported(feature)); + + g_object_unref(feature); +} + + +int +main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/feature/basic", test_basic); + + /* Upfront so we don't confuse valgrind */ + osinfo_feature_get_type(); + + return g_test_run(); +} +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:23 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:23 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 04/12] osinfo: Introduce OsinfoFeatureList In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-5-fidencio@redhat.com> OsinfoFeatureList is a list of guest OS features. Signed-off-by: Fabiano Fid?ncio --- osinfo/Makefile.am | 2 + osinfo/libosinfo.syms | 3 ++ osinfo/osinfo.h | 1 + osinfo/osinfo_featurelist.c | 91 +++++++++++++++++++++++++++++++++++++ osinfo/osinfo_featurelist.h | 78 +++++++++++++++++++++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 osinfo/osinfo_featurelist.c create mode 100644 osinfo/osinfo_featurelist.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index d553ecc..07ea5de 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -81,6 +81,7 @@ libosinfo_impl_include_HEADERS = \ osinfo_device_driverlist.h \ osinfo_entity.h \ osinfo_feature.h \ + osinfo_featurelist.h \ osinfo_filter.h \ osinfo_install_config.h \ osinfo_install_config_param.h \ @@ -129,6 +130,7 @@ libosinfo_c_files = \ osinfo_device_driver.c \ osinfo_device_driverlist.c \ osinfo_feature.c \ + osinfo_featurelist.c \ osinfo_install_config.c \ osinfo_install_config_param.c \ osinfo_install_config_paramlist.c \ diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index ef0db99..28b229f 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -537,6 +537,9 @@ LIBOSINFO_1.3.0 { osinfo_feature_get_type; osinfo_feature_new; + osinfo_featurelist_get_type; + osinfo_featurelist_new; + osinfo_image_get_architecture; osinfo_image_get_cloud_init; osinfo_image_get_format; diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index ff7f2e5..00cfed5 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/osinfo/osinfo_featurelist.c b/osinfo/osinfo_featurelist.c new file mode 100644 index 0000000..76c6201 --- /dev/null +++ b/osinfo/osinfo_featurelist.c @@ -0,0 +1,91 @@ +/* + * libosinfo: + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include + +#include +#include + +G_DEFINE_TYPE(OsinfoFeatureList, osinfo_featurelist, OSINFO_TYPE_LIST); + +#define OSINFO_FEATURELIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), OSINFO_TYPE_FEATURELIST, OsinfoFeatureListPrivate)) + +/** + * SECTION:osinfo_featurelist + * @short_description: A list of guest features + * @see_also: #OsinfoList, #OsinfoFeature + * + * #OsinfoFeatureList is a list specialization that stores + * only #OsinfoFeature objects. + */ + +struct _OsinfoFeatureListPrivate +{ + gboolean unused; +}; + +static void +osinfo_featurelist_finalize(GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS(osinfo_featurelist_parent_class)->finalize(object); +} + +/* Init functions */ +static void +osinfo_featurelist_class_init(OsinfoFeatureListClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS(klass); + + g_klass->finalize = osinfo_featurelist_finalize; + g_type_class_add_private(klass, sizeof(OsinfoFeatureListPrivate)); +} + +static void +osinfo_featurelist_init(OsinfoFeatureList *list) +{ + list->priv = OSINFO_FEATURELIST_GET_PRIVATE(list); +} + + +/** + * osinfo_featurelist_new: + * + * Construct a new feature list that is initially empty. + * + * Returns: (transfer full): an empty feature list + */ +OsinfoFeatureList *osinfo_featurelist_new(void) +{ + return g_object_new(OSINFO_TYPE_FEATURELIST, + "element-type", OSINFO_TYPE_FEATURE, + NULL); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_featurelist.h b/osinfo/osinfo_featurelist.h new file mode 100644 index 0000000..34384ba --- /dev/null +++ b/osinfo/osinfo_featurelist.h @@ -0,0 +1,78 @@ +/* + * libosinfo: a list of features + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include +#include +#include + +#ifndef __OSINFO_FEATURELIST_H__ +#define __OSINFO_FEATURELIST_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_FEATURELIST (osinfo_featurelist_get_type ()) +#define OSINFO_FEATURELIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_FEATURELIST, OsinfoFeatureList)) +#define OSINFO_IS_FEATURELIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_FEATURELIST)) +#define OSINFO_FEATURELIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_FEATURELIST, OsinfoFeatureListClass)) +#define OSINFO_IS_FEATURELIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_FEATURELIST)) +#define OSINFO_FEATURELIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_FEATURELIST, OsinfoFeatureListClass)) + +typedef struct _OsinfoFeatureList OsinfoFeatureList; + +typedef struct _OsinfoFeatureListClass OsinfoFeatureListClass; + +typedef struct _OsinfoFeatureListPrivate OsinfoFeatureListPrivate; + +/* object */ +struct _OsinfoFeatureList +{ + OsinfoList parent_instance; + + /* public */ + + /* private */ + OsinfoFeatureListPrivate *priv; +}; + +/* class */ +struct _OsinfoFeatureListClass +{ + /*< private >*/ + OsinfoListClass parent_class; + + /* class members */ +}; + +GType osinfo_featurelist_get_type(void); + +OsinfoFeatureList *osinfo_featurelist_new(void); + +#endif /* __OSINFO_FEATURELIST_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:24 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:24 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 05/12] tests: Add basic test for OsinfoListFeature In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-6-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .gitignore | 1 + tests/Makefile.am | 5 + tests/test-featurelist.c | 221 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+) create mode 100644 tests/test-featurelist.c diff --git a/.gitignore b/.gitignore index 524d9a1..4980eac 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ tests/test-db tests/test-devicelist tests/test-devicelinklist tests/test-feature +tests/test-featurelist tests/test-filter tests/test-hypervisorlist tests/test-install-script diff --git a/tests/Makefile.am b/tests/Makefile.am index 6f3cdb4..d57e2e1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,6 +8,7 @@ check_PROGRAMS = \ test-devicelist \ test-devicelinklist \ test-feature \ + test-featurelist \ test-filter \ test-media \ test-product \ @@ -59,6 +60,10 @@ test_feature_LDADD = $(COMMON_LDADD) test_feature_CFLAGS = $(COMMON_CFLAGS) test_feature_SOURCES = test-feature.c +test_featurelist_LDADD = $(COMMON_LDADD) +test_featurelist_CFLAGS = $(COMMON_CFLAGS) +test_featurelist_SOURCES = test-featurelist.c + test_filter_LDADD = $(COMMON_LDADD) test_filter_CFLAGS = $(COMMON_CFLAGS) test_filter_SOURCES = test-filter.c diff --git a/tests/test-featurelist.c b/tests/test-featurelist.c new file mode 100644 index 0000000..a0d9432 --- /dev/null +++ b/tests/test-featurelist.c @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2018 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see + * + * Authors: + * Fabiano Fid?ncio + */ + +#include + +#include + + +static void +test_union(void) +{ + OsinfoFeatureList *list1 = osinfo_featurelist_new(); + OsinfoFeatureList *list2 = osinfo_featurelist_new(); + OsinfoFeatureList *list3; + OsinfoFeature *ent1 = osinfo_feature_new("cpu-hotplug"); + OsinfoFeature *ent2 = osinfo_feature_new("numa"); + OsinfoFeature *ent3 = osinfo_feature_new("pci-device-hotplug"); + OsinfoFeature *ent4 = osinfo_feature_new("acpi"); + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4)); + + list3 = OSINFO_FEATURELIST(osinfo_list_new_union(OSINFO_LIST(list1), OSINFO_LIST(list2))); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list3)), ==, 4); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list3)); i++) { + OsinfoFeature *ent = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(list3), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_true(has2); + g_assert_true(has3); + g_assert_true(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(list1); + g_object_unref(list2); + g_object_unref(list3); +} + + +static void +test_intersect(void) +{ + OsinfoFeatureList *list1 = osinfo_featurelist_new(); + OsinfoFeatureList *list2 = osinfo_featurelist_new(); + OsinfoFeatureList *list3; + OsinfoFeature *ent1 = osinfo_feature_new("cpu-hotplug"); + OsinfoFeature *ent2 = osinfo_feature_new("numa"); + OsinfoFeature *ent3 = osinfo_feature_new("pci-device-hotplug"); + OsinfoFeature *ent4 = osinfo_feature_new("acpi"); + + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent3)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4)); + + list3 = OSINFO_FEATURELIST(osinfo_list_new_intersection(OSINFO_LIST(list1), OSINFO_LIST(list2))); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list3)), ==, 2); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list3)); i++) { + OsinfoFeature *ent = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(list3), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_false(has2); + g_assert_true(has3); + g_assert_false(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(list1); + g_object_unref(list2); + g_object_unref(list3); +} + + +static void +test_filter(void) +{ + OsinfoFeatureList *list1 = osinfo_featurelist_new(); + OsinfoFeatureList *list2; + OsinfoFilter *filter = osinfo_filter_new(); + OsinfoFeature *ent1 = osinfo_feature_new("cpu-hotplug"); + OsinfoFeature *ent2 = osinfo_feature_new("numa"); + OsinfoFeature *ent3 = osinfo_feature_new("pci-device-hotplug"); + OsinfoFeature *ent4 = osinfo_feature_new("acpi"); + + osinfo_filter_add_constraint(filter, "name", "numa"); + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent4)); + + list2 = OSINFO_FEATURELIST(osinfo_list_new_filtered(OSINFO_LIST(list1), filter)); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list2)), ==, 1); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list2)); i++) { + OsinfoFeature *ent = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(list2), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_false(has1); + g_assert_true(has2); + g_assert_false(has3); + g_assert_false(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(filter); + g_object_unref(list1); + g_object_unref(list2); +} + + +int +main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/featurelist/union", test_union); + g_test_add_func("/featurelist/intersect", test_intersect); + g_test_add_func("/featurelist/filter", test_filter); + + /* Upfront so we don't confuse valgrind */ + osinfo_feature_get_type(); + osinfo_featurelist_get_type(); + osinfo_filter_get_type(); + + return g_test_run(); +} +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:25 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:25 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 06/12] os: Make os aware of Guest Features In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-7-fidencio@redhat.com> This commit adds the whole machinery needed for dealing with Guest Features for an Os object. Signed-off-by: Fabiano Fid?ncio --- osinfo/libosinfo.syms | 2 + osinfo/osinfo_os.c | 107 ++++++++++++++++++++++++++++++++++++++++++ osinfo/osinfo_os.h | 6 ++- 3 files changed, 114 insertions(+), 1 deletion(-) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 28b229f..1f1000f 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -558,9 +558,11 @@ LIBOSINFO_1.3.0 { osinfo_media_supports_installer_script; + osinfo_os_add_feature; osinfo_os_add_image; osinfo_os_add_maximum_resources; osinfo_os_get_all_device_links; + osinfo_os_get_feature_list; osinfo_os_get_image_list; osinfo_os_get_maximum_resources; diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 01d2e01..a082ec2 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -29,6 +29,7 @@ #include "osinfo/osinfo_product_private.h" #include "osinfo/osinfo_os_private.h" #include "osinfo/osinfo_resources_private.h" +#include "osinfo/osinfo_feature_private.h" #include G_DEFINE_TYPE(OsinfoOs, osinfo_os, OSINFO_TYPE_PRODUCT); @@ -59,6 +60,7 @@ struct _OsinfoOsPrivate OsinfoResourcesList *minimum; OsinfoResourcesList *recommended; OsinfoResourcesList *maximum; + OsinfoFeatureList *features; OsinfoInstallScriptList *scripts; @@ -119,6 +121,7 @@ osinfo_os_finalize(GObject *object) g_object_unref(os->priv->minimum); g_object_unref(os->priv->recommended); g_object_unref(os->priv->maximum); + g_object_unref(os->priv->features); g_object_unref(os->priv->scripts); @@ -186,6 +189,7 @@ osinfo_os_init(OsinfoOs *os) os->priv->minimum = osinfo_resourceslist_new(); os->priv->recommended = osinfo_resourceslist_new(); os->priv->maximum = osinfo_resourceslist_new(); + os->priv->features = osinfo_featurelist_new(); os->priv->scripts = osinfo_install_scriptlist_new(); os->priv->device_drivers = osinfo_device_driverlist_new(); } @@ -553,6 +557,109 @@ OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoDevice *dev) return devlink; } +struct GetAllFeaturesData { + OsinfoOs *os; + OsinfoFeatureList *feature_list; + OsinfoFeatureList *unsupported_list; +}; + +static void get_all_features_cb(OsinfoProduct *product, gpointer user_data) +{ + OsinfoFeatureList *filtered_out; + OsinfoFeatureList *unsupported_list; + OsinfoFeatureList *new_list; + OsinfoFeatureList *new_unsupported_list; + OsinfoOs *os; + struct GetAllFeaturesData *foreach_data = (struct GetAllFeaturesData *)user_data; + gsize featurelist_len; + gsize i; + + g_return_if_fail(OSINFO_IS_OS(product)); + os = OSINFO_OS(product); + + filtered_out = osinfo_featurelist_new(); + unsupported_list = osinfo_featurelist_new(); + + featurelist_len = osinfo_list_get_length(OSINFO_LIST(os->priv->features)); + for (i = 0; i < featurelist_len; i++) { + OsinfoFeature *feature = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(os->priv->features), i)); + + if (!osinfo_feature_get_supported(feature)) { + osinfo_list_add(OSINFO_LIST(unsupported_list), OSINFO_ENTITY(feature)); + continue; + } + + if (foreach_data->unsupported_list != NULL && + osinfo_list_find_by_id(OSINFO_LIST(foreach_data->unsupported_list), + osinfo_feature_get_name(feature)) != NULL) + continue; + + osinfo_list_add(OSINFO_LIST(filtered_out), OSINFO_ENTITY(feature)); + } + + if (os == foreach_data->os) { + foreach_data->feature_list = filtered_out; + foreach_data->unsupported_list = unsupported_list; + return; + } + + new_list = OSINFO_FEATURELIST(osinfo_list_new_union(OSINFO_LIST(foreach_data->feature_list), + OSINFO_LIST(filtered_out))); + + new_unsupported_list = OSINFO_FEATURELIST(osinfo_list_new_union(OSINFO_LIST(foreach_data->unsupported_list), + OSINFO_LIST(unsupported_list))); + + g_object_unref(filtered_out); + g_object_unref(foreach_data->feature_list); + g_object_unref(foreach_data->unsupported_list); + foreach_data->feature_list = new_list; + foreach_data->unsupported_list = new_unsupported_list; +} + +/** + * osinfo_os_get_feature_list: + * @os: an operating system + * + * Get all features matching a given filter and taking into consideration + * all features previous set in all OSes from which @os derived and/or cloned. + * + * Returns: (transfer full): A list of OsinfoFeature + */ +OsinfoFeatureList *osinfo_os_get_feature_list(OsinfoOs *os) +{ + struct GetAllFeaturesData foreach_data = { + .os = os, + .feature_list = NULL, + .unsupported_list = NULL, + }; + + g_return_val_if_fail(OSINFO_IS_OS(os), NULL); + + osinfo_product_foreach_related(OSINFO_PRODUCT(os), + OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM | + OSINFO_PRODUCT_FOREACH_FLAG_CLONES, + get_all_features_cb, + &foreach_data); + + if (foreach_data.unsupported_list != NULL) + g_object_unref(foreach_data.unsupported_list); + return foreach_data.feature_list; +} + +/** osinfo_os_add_feature: + * @os: an operating system + * @feature: (transfer none): the feature to associate with + * + * Adds @feature to list of features of operating system @os. + */ +void osinfo_os_add_feature(OsinfoOs *os, OsinfoFeature *feature) +{ + g_return_if_fail(OSINFO_IS_OS(os)); + g_return_if_fail(OSINFO_IS_FEATURE(feature)); + + osinfo_list_add(OSINFO_LIST(os->priv->features), OSINFO_ENTITY(feature)); +} + /** * osinfo_os_get_family: * @os: an #OsinfoOs diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h index 4eb4b1b..5a3127c 100644 --- a/osinfo/osinfo_os.h +++ b/osinfo/osinfo_os.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -110,8 +111,8 @@ OsinfoDeviceList *osinfo_os_get_devices_by_property(OsinfoOs *os, gboolean inherited); OsinfoDeviceLinkList *osinfo_os_get_device_links(OsinfoOs *os, OsinfoFilter *filter); OsinfoDeviceLinkList *osinfo_os_get_all_device_links(OsinfoOs *os, OsinfoFilter *filter); - OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoDevice *dev); + const gchar *osinfo_os_get_family(OsinfoOs *os); const gchar *osinfo_os_get_distro(OsinfoOs *os); int osinfo_os_get_release_status(OsinfoOs *os); @@ -137,6 +138,9 @@ void osinfo_os_add_install_script(OsinfoOs *os, OsinfoInstallScript *script); OsinfoDeviceDriverList *osinfo_os_get_device_drivers(OsinfoOs *os); void osinfo_os_add_device_driver(OsinfoOs *os, OsinfoDeviceDriver *driver); +OsinfoFeatureList *osinfo_os_get_feature_list(OsinfoOs *os); +void osinfo_os_add_feature(OsinfoOs *os, OsinfoFeature *feature); + #endif /* __OSINFO_OS_H__ */ /* * Local variables: -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:26 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:26 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 07/12] loader: Make loader aware of Guest Features In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-8-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_loader.c | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index 8f7b2bf..aca3b4c 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -39,6 +39,7 @@ #include "osinfo_install_script_private.h" #include "osinfo_device_driver_private.h" #include "osinfo_resources_private.h" +#include "osinfo_feature_private.h" #ifndef USB_IDS #define USB_IDS PKG_DATA_DIR "/usb.ids" @@ -658,6 +659,47 @@ static void osinfo_loader_device_link(OsinfoLoader *loader, g_free(related); } +static void osinfo_loader_features(OsinfoLoader *loader, + OsinfoEntity *entity, + const gchar *xpath, + xmlXPathContextPtr ctxt, + xmlNodePtr root, + GError **err) +{ + xmlNodePtr *nodes = NULL; + int nnodes = osinfo_loader_nodeset(xpath, loader, ctxt, &nodes, err); + int i; + if (error_is_set(err)) + return; + + for (i = 0; i < nnodes; i++) { + if (!nodes[i]->children || + nodes[i]->children->type != XML_TEXT_NODE || + !g_str_equal((const gchar *)nodes[i]->name, "feature")) + continue; + + const gchar *name = (const gchar *)nodes[i]->children->content; + OsinfoFeature *feature = osinfo_feature_new(name); + osinfo_os_add_feature(OSINFO_OS(entity), feature); + + gchar *supported = (gchar *)xmlGetProp(nodes[i], BAD_CAST "supported"); + if (supported != NULL) { + osinfo_feature_set_supported(feature, + g_str_equal(supported, "true") ? TRUE : FALSE); + xmlFree(supported); + } + + xmlNodePtr saved = ctxt->node; + ctxt->node = nodes[i]; + ctxt->node = saved; + if (error_is_set(err)) + goto cleanup; + } + + cleanup: + g_free(nodes); +} + static void osinfo_loader_product_relshp(OsinfoLoader *loader, OsinfoProduct *product, OsinfoProductRelationship relshp, @@ -1515,6 +1557,11 @@ static void osinfo_loader_os(OsinfoLoader *loader, if (error_is_set(err)) goto cleanup; + osinfo_loader_features(loader, OSINFO_ENTITY(os), + "./features/feature", ctxt, root, err); + if (error_is_set(err)) + goto cleanup; + nnodes = osinfo_loader_nodeset("./media", loader, ctxt, &nodes, err); if (error_is_set(err)) goto cleanup; -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:27 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:27 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 08/12] test-os: Add basic tests for Guest Features In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-9-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- tests/test-os.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test-os.c b/tests/test-os.c index 45598bb..5ce3cfa 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -61,6 +61,29 @@ test_devices(void) } +static void +test_features(void) +{ + OsinfoOs *os = osinfo_os_new("awesome"); + OsinfoFeature *feature1 = osinfo_feature_new("cpu-hotplug"); + OsinfoFeature *feature2 = osinfo_feature_new("numa"); + + osinfo_os_add_feature(os, feature1); + osinfo_os_add_feature(os, feature2); + + OsinfoFeatureList *features = osinfo_os_get_feature_list(os); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(features)), ==, 2); + g_assert_true(osinfo_list_get_nth(OSINFO_LIST(features), 0) == OSINFO_ENTITY(feature1)); + g_assert_true(osinfo_list_get_nth(OSINFO_LIST(features), 1) == OSINFO_ENTITY(feature2)); + + g_object_unref(features); + g_object_unref(feature1); + g_object_unref(feature2); + g_object_unref(os); +} + + static void test_loader(void) { @@ -947,6 +970,7 @@ main(int argc, char *argv[]) test_devices_inheritance_basic); g_test_add_func("/os/devices/inheritance/removal", test_devices_inheritance_removal); + g_test_add_func("/os/features", test_features); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:48:28 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:48:28 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 09/12] test-os: Add test_duplication_helper() In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190111144828.31489-10-fidencio@redhat.com> By creating this, we can re-use it for testing Guest Features duplication. Signed-off-by: Fabiano Fid?ncio --- tests/test-os.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test-os.c b/tests/test-os.c index 5ce3cfa..8c3a86c 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -550,17 +550,7 @@ static void check_duplicated_devices_cb(OsinfoProduct *product, } -static void check_duplicated_devices(OsinfoOs *os) -{ - osinfo_product_foreach_related(OSINFO_PRODUCT(os), - OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM | - OSINFO_PRODUCT_FOREACH_FLAG_CLONES, - check_duplicated_devices_cb, - os); -} - - -static void test_devices_duplication(void) +static void test_duplication_helper(void (check_duplicated_cb)(OsinfoProduct *, gpointer)) { OsinfoLoader *loader = osinfo_loader_new(); OsinfoDb *db = osinfo_loader_get_db(loader); @@ -591,7 +581,11 @@ static void test_devices_duplication(void) for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(oslist)); i++) { OsinfoOs *os = OSINFO_OS(osinfo_list_get_nth(OSINFO_LIST(oslist), i)); - check_duplicated_devices(os); + osinfo_product_foreach_related(OSINFO_PRODUCT(os), + OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM | + OSINFO_PRODUCT_FOREACH_FLAG_CLONES, + check_duplicated_cb, + os); } g_object_unref(filter); @@ -604,6 +598,12 @@ static void test_devices_duplication(void) } +static void test_devices_duplication(void) +{ + test_duplication_helper(check_duplicated_devices_cb); +} + + static void devices_inheritance_basic_check(OsinfoDb *db, const gchar *os_id) -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:49:27 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:49:27 +0100 Subject: [Libosinfo] [libosinfo PATCH 10/12] test-os: Add test_features_duplication() Message-ID: <20190111144929.31646-1-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- tests/test-os.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/tests/test-os.c b/tests/test-os.c index 8c3a86c..f9fe381 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -550,6 +550,73 @@ static void check_duplicated_devices_cb(OsinfoProduct *product, } +static void check_duplicated_features_cb(OsinfoProduct *product, + gpointer user_data) +{ + OsinfoOs *os = OSINFO_OS(user_data); + OsinfoOs *foreach_os = OSINFO_OS(product); + OsinfoFeatureList *features_os, *features_foreach_os; + GList *list_features = NULL, *list_foreach_features = NULL, *list_duplicated = NULL; + GList *l; + + if (os == foreach_os) + return; + + features_os = osinfo_os_get_feature_list(os); + features_foreach_os = osinfo_os_get_feature_list(foreach_os); + + if (osinfo_list_get_length(OSINFO_LIST(features_os)) == 0 || + osinfo_list_get_length(OSINFO_LIST(features_foreach_os)) == 0) + goto done; + + list_features = osinfo_list_get_elements(OSINFO_LIST(features_os)); + list_foreach_features = osinfo_list_get_elements(OSINFO_LIST(features_foreach_os)); + + for (l = list_features; l != NULL; l = l->next) { + OsinfoFeature *d = OSINFO_FEATURE(l->data); + GList *ll; + + for (ll = list_foreach_features; ll != NULL; ll = ll->next) { + OsinfoFeature *dd = OSINFO_FEATURE(ll->data); + if (g_str_equal(osinfo_feature_get_name(d), osinfo_feature_get_name(dd))) + list_duplicated = g_list_prepend(list_duplicated, d); + } + } + + if (list_duplicated != NULL) { + gchar *string = NULL; + for (l = list_duplicated; l != NULL; l = l->next) { + gchar *tmp = NULL; + if (string != NULL) + tmp = g_strdup_printf("%s\n - %s\n", + string, + osinfo_feature_get_name(OSINFO_FEATURE(l->data))); + else + tmp = g_strdup_printf("\n - %s", + osinfo_feature_get_name(OSINFO_FEATURE(l->data))); + + g_free(string); + string = tmp; + } + + g_printerr("\nTesting \"%s\" against \"%s\" and found the following duplicated features: %s\n", + osinfo_product_get_short_id(OSINFO_PRODUCT(os)), + osinfo_product_get_short_id(product), + string); + g_free(string); + + g_test_fail(); + } + + done: + g_list_free(list_duplicated); + g_list_free(list_features); + g_list_free(list_foreach_features); + g_object_unref(features_os); + g_object_unref(features_foreach_os); +} + + static void test_duplication_helper(void (check_duplicated_cb)(OsinfoProduct *, gpointer)) { OsinfoLoader *loader = osinfo_loader_new(); @@ -604,6 +671,12 @@ static void test_devices_duplication(void) } +static void test_features_duplication(void) +{ + test_duplication_helper(check_duplicated_features_cb); +} + + static void devices_inheritance_basic_check(OsinfoDb *db, const gchar *os_id) @@ -971,6 +1044,7 @@ main(int argc, char *argv[]) g_test_add_func("/os/devices/inheritance/removal", test_devices_inheritance_removal); g_test_add_func("/os/features", test_features); + g_test_add_func("/os/features/duplication", test_features_duplication); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:49:28 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:49:28 +0100 Subject: [Libosinfo] [libosinfo PATCH 11/12] test-os: Add test_features_inheritance_basic() In-Reply-To: <20190111144929.31646-1-fidencio@redhat.com> References: <20190111144929.31646-1-fidencio@redhat.com> Message-ID: <20190111144929.31646-2-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .../test-os-features-basic-1.xml | 13 +++++ .../test-os-features-basic-2-clone.xml | 10 ++++ .../test-os-features-basic-2.xml | 10 ++++ tests/test-os.c | 58 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml b/tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml new file mode 100644 index 0000000..b34bbf3 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml @@ -0,0 +1,13 @@ + + + + features-basic-1 + Features Basic 1 + libosinfo.org + test + + + cpu-hotplug + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml new file mode 100644 index 0000000..cf65ea7 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml @@ -0,0 +1,10 @@ + + + + features-basic-2-clone + Features Basic 2 Clone + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml new file mode 100644 index 0000000..d3af204 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml @@ -0,0 +1,10 @@ + + + + features-basic-2 + Features Basic 2 + libosinfo.org + test + + + diff --git a/tests/test-os.c b/tests/test-os.c index f9fe381..4e8694a 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -733,6 +733,62 @@ test_devices_inheritance_basic(void) } +static void +features_inheritance_basic_check(OsinfoDb *db, + const gchar *os_id) +{ + OsinfoOs *os; + OsinfoFeatureList *feature_list; + OsinfoFeature *feature; + + g_debug("Testing \"%s\"", os_id); + + os = osinfo_db_get_os(db, os_id); + g_assert(OSINFO_IS_OS(os)); + + feature_list = osinfo_os_get_feature_list(os); + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(feature_list)), ==, 1); + + feature = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(feature_list), 0)); + g_assert(OSINFO_IS_FEATURE(feature)); + + g_object_unref(feature_list); +} + + +static void +test_features_inheritance_basic(void) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + GError *error = NULL; + + osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error); + g_assert_no_error(error); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + /* + * "http://libosinfo.org/test/os/features/basic/1 has one feature set + */ + features_inheritance_basic_check(db, "http://libosinfo.org/test/os/features/basic/1"); + + /* + * http://libosinfo.org/test/os/features/basic/2 derives-from + * http://libosinfo.org/test/os/features/basic/1 + */ + features_inheritance_basic_check(db, "http://libosinfo.org/test/os/features/basic/2"); + + /* + * http://libosinfo.org/test/os/features/basic/2-clone clones + * http://libosinfo.org/test/os/features/basic/2 + */ + features_inheritance_basic_check(db, "http://libosinfo.org/test/os/features/basic/2-clone"); + + g_object_unref(db); +} + + static void devices_inheritance_removal_check_devs(OsinfoDb *db, const gchar *os_id, @@ -1045,6 +1101,8 @@ main(int argc, char *argv[]) test_devices_inheritance_removal); g_test_add_func("/os/features", test_features); g_test_add_func("/os/features/duplication", test_features_duplication); + g_test_add_func("/os/features/inheritance/basic", + test_features_inheritance_basic); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 2.19.2 From fidencio at redhat.com Fri Jan 11 14:49:29 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 11 Jan 2019 15:49:29 +0100 Subject: [Libosinfo] [libosinfo PATCH 12/12] test-os: Add test_features_inheritance_removal() In-Reply-To: <20190111144929.31646-1-fidencio@redhat.com> References: <20190111144929.31646-1-fidencio@redhat.com> Message-ID: <20190111144929.31646-3-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .../test-os-features-removed-1.xml | 14 +++ .../test-os-features-removed-2-clone.xml | 10 ++ .../test-os-features-removed-2.xml | 10 ++ .../test-os-features-removed-3.xml | 14 +++ .../test-os-features-removed-4-clone.xml | 10 ++ .../test-os-features-removed-4.xml | 10 ++ tests/test-os.c | 95 +++++++++++++++++++ 7 files changed, 163 insertions(+) create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml new file mode 100644 index 0000000..44f6cce --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml @@ -0,0 +1,14 @@ + + + + features-removed-1 + Features Removed 1 + libosinfo.org + test + + + + cpu-hotplug + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml new file mode 100644 index 0000000..d6d2088 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml @@ -0,0 +1,10 @@ + + + + features-removed-2-clone + Features Removed 2 Clone + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml new file mode 100644 index 0000000..7939e98 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml @@ -0,0 +1,10 @@ + + + + features-removed-2 + Features Removed 2 + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml new file mode 100644 index 0000000..b582739 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml @@ -0,0 +1,14 @@ + + + + features-removed-3 + Features Removed 3 + libosinfo.org + test + + + + cpu-hotplug + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml new file mode 100644 index 0000000..cb638e6 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml @@ -0,0 +1,10 @@ + + + + features-removed-4-clone + Features Removed 4 Clone + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml new file mode 100644 index 0000000..7f5b7cb --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml @@ -0,0 +1,10 @@ + + + + features-removed-4 + Features Removed 4 + libosinfo.org + test + + + diff --git a/tests/test-os.c b/tests/test-os.c index 4e8694a..14642e4 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -898,6 +898,99 @@ test_devices_inheritance_removal(void) } +static void +features_inheritance_removal_check_features(OsinfoDb *db, + const gchar *os_id, + gint feature_list_len) +{ + OsinfoOs *os; + OsinfoFeatureList *feature_list; + + g_test_message("Testing \"%s\"\n", os_id); + + os = osinfo_db_get_os(db, os_id); + g_assert(OSINFO_IS_OS(os)); + + feature_list = osinfo_os_get_feature_list(os); + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(feature_list)), ==, feature_list_len); + g_object_unref(feature_list); +} + + +static void +test_features_inheritance_removal(void) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + GError *error = NULL; + + osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error); + g_assert_no_error(error); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + /* + * "http://libosinfo.org/test/os/features/basic/1 has one feature set + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/basic/1", + 1); + + /* + * http://libosinfo.org/test/os/features/removed/1 derives-from + * http://libosinfo.org/test/os/features/basic/1 ... + * And the feature is marked as removed + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/1", + 0); + + /* + * http://libosinfo.org/test/os/features/removed/2 derives-from + * http://libosinfo.org/test/os/features/removed/1 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/2", + 0); + + /* + * http://libosinfo.org/test/os/features/removed/2-clone clones + * http://libosinfo.org/test/os/features/removed/2 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/2-clone", + 0); + + /* + * http://libosinfo.org/test/os/features/removed/3 derives-from + * http://libosinfo.org/test/os/features/removed/2 + * And the feature is not marked as removed anymore + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/3", + 1); + + /* + * http://libosinfo.org/test/os/features/removed/4 derives-from + * http://libosinfo.org/test/os/features/removed/3 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/4", + 1); + + + /* + * http://libosinfo.org/test/os/features/removed/4-clone clones + * http://libosinfo.org/test/os/features/removed/4 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/4-clone", + 1); + + g_object_unref(db); +} + + static void check_resources(OsinfoDb *db, const gchar *os_id, @@ -1103,6 +1196,8 @@ main(int argc, char *argv[]) g_test_add_func("/os/features/duplication", test_features_duplication); g_test_add_func("/os/features/inheritance/basic", test_features_inheritance_basic); + g_test_add_func("/os/features/inheritance/removal", + test_features_inheritance_removal); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 2.19.2 From fidencio at redhat.com Mon Jan 14 16:08:10 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 14 Jan 2019 17:08:10 +0100 Subject: [Libosinfo] [libosinfo PATCH 0/1] Fix test-install-script on Fedora Rawhide Message-ID: <20190114160811.32434-1-fidencio@redhat.com> Although I still don't understand the root cause of the issue on Fedora Rawhide*, we should *never* be testing a media that has *no* info as it'd just match whatever is passed due to how match_regex() works. The following patch solves the issues on Fedora Rawhide. A big thanks to Andrea Bolognani for giving me access to a machine where the issue could be reproduced. *: Why exactly the OSes are loaded in a different order depending on the system/machine is something that I don't understand properly. Fabiano Fid?ncio (1): db: improve _guess_os_from_media() checks osinfo/osinfo_db.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.19.2 From fidencio at redhat.com Mon Jan 14 16:08:11 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 14 Jan 2019 17:08:11 +0100 Subject: [Libosinfo] [libosinfo PATCH 1/1] db: improve _guess_os_from_media() checks In-Reply-To: <20190114160811.32434-1-fidencio@redhat.com> References: <20190114160811.32434-1-fidencio@redhat.com> Message-ID: <20190114160811.32434-2-fidencio@redhat.com> Do not check against a distro which doesn't have *any* of the values we use to check as match_regex() would just match whatever we compare to it. Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_db.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c index a12cee8..5696279 100644 --- a/osinfo/osinfo_db.c +++ b/osinfo/osinfo_db.c @@ -577,6 +577,13 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db, const gchar *os_application = osinfo_media_get_application_id(os_media); gint64 os_vol_size = osinfo_media_get_volume_size(os_media); + if (os_volume == NULL && + os_system == NULL && + os_publisher == NULL && + os_application == NULL && + os_vol_size <= 0) + continue; + if (os_vol_size <= 0) os_vol_size = media_vol_size; -- 2.19.2 From fidencio at redhat.com Tue Jan 15 19:22:07 2019 From: fidencio at redhat.com (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Tue, 15 Jan 2019 20:22:07 +0100 Subject: [Libosinfo] [libosinfo PATCH v2 00/12] Add support for Guest Features In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: On Fri, Jan 11, 2019 at 3:48 PM Fabiano Fid?ncio wrote: > > Add basic support for Guest Features such as: > - acpi > - apic > - cpu-hotplug > - numa > - pci-device-hotplug > > The Guest Features are, by default, inherited by systems which either > clone or derive-from another systems. > > This series adds the machinery needed for: > https://gitlab.com/libosinfo/osinfo-db/issues/12 More issues have been found "offline". Please, do not consider nor review this series. From fabiano at fidencio.org Tue Jan 15 20:02:38 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 15 Jan 2019 21:02:38 +0100 Subject: [Libosinfo] [osinfo-db PATCH] silverblue, ks: quote keyboard's argument Message-ID: <1547582558-29037-1-git-send-email-fabiano@fidencio.org> keyboard command (from kickstart) receives a single parameter as argument, thus whatever we receive as l10n-keyboard must be quoted as applications may just set things as 'in (eng)'. The same approach is already taken on Fedora kickstarts. https://bugzilla.redhat.com/show_bug.cgi?id=1666320 Signed-off-by: Fabiano Fid?ncio --- .../fedoraproject.org/silverblue-kickstart-desktop.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in b/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in index c38f17f..71cd40e 100644 --- a/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in +++ b/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in @@ -41,7 +41,7 @@ # Install script for profile install -keyboard +keyboard '' lang network --onboot yes --bootproto dhcp --noipv6 --hostname= rootpw dummyPa55w0rd # Actual password set (or unset) in %post below -- 1.8.3.1 From crobinso at redhat.com Tue Jan 15 20:13:02 2019 From: crobinso at redhat.com (Cole Robinson) Date: Tue, 15 Jan 2019 15:13:02 -0500 Subject: [Libosinfo] [libosinfo PATCH 1/1] db: improve _guess_os_from_media() checks In-Reply-To: <20190114160811.32434-2-fidencio@redhat.com> References: <20190114160811.32434-1-fidencio@redhat.com> <20190114160811.32434-2-fidencio@redhat.com> Message-ID: <8546b712-5c2a-b2a1-777f-f51a5815e8e0@redhat.com> On 01/14/2019 11:08 AM, Fabiano Fid?ncio wrote: > Do not check against a distro which doesn't have *any* of the values we > use to check as match_regex() would just match whatever we compare to > it. > > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_db.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c > index a12cee8..5696279 100644 > --- a/osinfo/osinfo_db.c > +++ b/osinfo/osinfo_db.c > @@ -577,6 +577,13 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db, > const gchar *os_application = osinfo_media_get_application_id(os_media); > gint64 os_vol_size = osinfo_media_get_volume_size(os_media); > > + if (os_volume == NULL && > + os_system == NULL && > + os_publisher == NULL && > + os_application == NULL && > + os_vol_size <= 0) > + continue; > + > if (os_vol_size <= 0) > os_vol_size = media_vol_size; > > Reviewed-by: Cole Robinson - Cole From crobinso at redhat.com Tue Jan 15 20:18:49 2019 From: crobinso at redhat.com (Cole Robinson) Date: Tue, 15 Jan 2019 15:18:49 -0500 Subject: [Libosinfo] [PATCH 0/5] Fixes for recently merged commits In-Reply-To: <20190109104234.3512-1-fidencio@redhat.com> References: <20190109104234.3512-1-fidencio@redhat.com> Message-ID: On 01/09/2019 05:42 AM, Fabiano Fid?ncio wrote: > This series has a few patches adapting/fixing/reverting issues caught by > Daniel after the patches being already merged. > > All of those are trivial enough to be pushed directly. > > osinfo-db-tools: > Fabiano Fid?ncio (1): > README: Update download information > > README | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > osinfo-db: > Fabiano Fid?ncio (2): > Revert "centos7: Remove "upgrades" field" > README: Update download information > > README | 4 ++-- > data/os/centos.org/centos-7.0.xml.in | 1 + > 2 files changed, 3 insertions(+), 2 deletions(-) > > libosinfo: > Fabiano Fid?ncio (2): > README: Update download information > loader: improve warning message from loader_check_id() > > README | 4 ++-- > osinfo/osinfo_loader.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > Reviewed-by: Cole Robinson - Cole From crobinso at redhat.com Tue Jan 15 20:41:17 2019 From: crobinso at redhat.com (Cole Robinson) Date: Tue, 15 Jan 2019 15:41:17 -0500 Subject: [Libosinfo] [osinfo-db PATCH] silverblue, ks: quote keyboard's argument In-Reply-To: <1547582558-29037-1-git-send-email-fabiano@fidencio.org> References: <1547582558-29037-1-git-send-email-fabiano@fidencio.org> Message-ID: <4038b7d1-e2f8-3f0c-f985-f2eea51c2e9b@redhat.com> On 01/15/2019 03:02 PM, Fabiano Fid?ncio wrote: > keyboard command (from kickstart) receives a single parameter as > argument, thus whatever we receive as l10n-keyboard must be quoted as > applications may just set things as 'in (eng)'. > > The same approach is already taken on Fedora kickstarts. > > https://bugzilla.redhat.com/show_bug.cgi?id=1666320 > > Signed-off-by: Fabiano Fid?ncio > --- > .../fedoraproject.org/silverblue-kickstart-desktop.xml.in | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in b/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in > index c38f17f..71cd40e 100644 > --- a/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in > +++ b/data/install-script/fedoraproject.org/silverblue-kickstart-desktop.xml.in > @@ -41,7 +41,7 @@ > > # Install script for profile > install > -keyboard > +keyboard '' > lang > network --onboot yes --bootproto dhcp --noipv6 --hostname= > rootpw dummyPa55w0rd # Actual password set (or unset) in %post below > Reviewed-by: Cole Robinson - Cole From berrange at redhat.com Wed Jan 16 11:05:07 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Wed, 16 Jan 2019 11:05:07 +0000 Subject: [Libosinfo] [libosinfo PATCH v2 00/12] Add support for Guest Features In-Reply-To: <20190111144828.31489-1-fidencio@redhat.com> References: <20190111144828.31489-1-fidencio@redhat.com> Message-ID: <20190116110507.GK20275@redhat.com> On Fri, Jan 11, 2019 at 03:48:19PM +0100, Fabiano Fid?ncio wrote: > Add basic support for Guest Features such as: > - acpi If the guest supports PCI, then it supports ACPI too. If the guest does not support ACPI there is no harm in exposing ACPI anyway, as the guest will just ignore it. If this were not the case, the x86 architecture would have broken all existing guest OS when it added ACPI support. > - apic I don't think you can even turn this off for KVM. It was something you could toggle with Xen but I can't remember when/why you would want to turn it off. > - cpu-hotplug This one feels useful. A mgmt app probably doesn't want to go to trouble to offering to allocate extra CPUs if it is impossible for guest to use them. > - numa Guest NUMA topology should be exposed if the guest is spread across more than one host NUMA node. If the guest chooses to ignore that topology, or simply doesn't know about reading NUMA topology, the guest still works in exactly the same way it would work if we didn't exposing NUMA topology at all. IOW, I dont really see what purpose/benefit this is giving. Guest NUMA can be used regardless of guest OS support for it. > - pci-device-hotplug I'm not convinced about this. Hotplug is a core feature of PCI. IOW pretty much any OS that has PCI support, will have hotplug support, unless their PCI support was crude-work-in-prgress. But even if they have hotplug support it doesn't imply it is going to work, as there are many ways to break it. noacpi kernel command line, no acpi property in guest XML, no acpid daemon running in guest, guest not finished booting up, device plugged into the wrong PCI bus and probably more. If we do need something here, it feels like we should have a more generic "pci" feature to indicate whether PCI is supported or not. Perhaps also a PCI-X feature flag, though even then it should be possible for a PCI-only guest to run a PCI-X machine IIUC, it just won't take advantage of PCI-X features. IOW, 'cpu-hotplug' is the only one here I see a strong compelling reason to support. > > The Guest Features are, by default, inherited by systems which either > clone or derive-from another systems. > > This series adds the machinery needed for: > https://gitlab.com/libosinfo/osinfo-db/issues/12 > > - Changes since v1: > https://www.redhat.com/archives/libosinfo/2018-November/msg00250.html > This is a totally *new* implementation as the v1 as *really* > *overcomplicated* and was adding pieces that were not needed at all > (as FeatureLinks and all the code refactoring done to accomodate > that). Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From fidencio at redhat.com Fri Jan 18 12:30:35 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:35 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 00/12] Add support for Guest Features Message-ID: <20190118123047.31007-1-fidencio@redhat.com> Add basic support for Guest Features such as: - cpu-hotplug - hyperv - hyperv-evmcs - hyperv-frequencies - hyperv-ipi - hyperv-reenlightenment - hyperv-relaxed - hyperv-reset - hyperv-runtime - hyperv-spinlocks - hyperv-synic - hyperv-tlbflush - hyperv-vapic - hyperv-vendor-id - hyperv-vpindex The Guest Features are, by default, inherited by systems which either clone or derive-from another systems. This series adds the machinery needed for: https://gitlab.com/libosinfo/osinfo-db/issues/12 - Changes since v1: https://www.redhat.com/archives/libosinfo/2018-November/msg00250.html This is a totally *new* implementation as the v1 as *really* *overcomplicated* and was adding pieces that were not needed at all (as FeatureLinks and all the code refactoring done to accomodate that). - Changes since v2: https://www.redhat.com/archives/libosinfo/2019-January/msg00037.html A cleanup has been done in the implementation proposed during v2 in order to make things even simplier. Also, Daniel's comment has been addressed about which features make or do not make sense to be present in the list. Fabiano Fid?ncio (11): osinfo: Introduce OsinfoFeature tests: Add basic test for OsinfoFeature osinfo: Introduce OsinfoFeatureList tests: Add basic test for OsinfoListFeature os: Make os aware of Guest Features loader: Make loader aware of Guest Features test-os: Add basic tests for Guest Features test-os: Add test_features_inheritance_basic() test-os: Add test_features_inheritance_removal() os: Add osinfo_os_is_feature_supported() test-os: Add test_features_supported() .gitignore | 2 + osinfo/Makefile.am | 4 + osinfo/libosinfo.syms | 15 + osinfo/osinfo.h | 2 + osinfo/osinfo_feature.c | 313 ++++++++++++++++++ osinfo/osinfo_feature.h | 90 +++++ osinfo/osinfo_feature_private.h | 38 +++ osinfo/osinfo_featurelist.c | 88 +++++ osinfo/osinfo_featurelist.h | 75 +++++ osinfo/osinfo_loader.c | 71 ++++ osinfo/osinfo_os.c | 171 ++++++++++ osinfo/osinfo_os.h | 5 + po/POTFILES.in | 1 + tests/Makefile.am | 10 + .../test-os-features-basic-1.xml | 21 ++ .../test-os-features-basic-2-clone.xml | 10 + .../test-os-features-basic-2.xml | 10 + .../test-os-features-removed-1.xml | 14 + .../test-os-features-removed-2-clone.xml | 10 + .../test-os-features-removed-2.xml | 10 + .../test-os-features-removed-3.xml | 15 + .../test-os-features-removed-4-clone.xml | 10 + .../test-os-features-removed-4.xml | 10 + .../test-os-features-supported.xml | 21 ++ tests/test-feature.c | 68 ++++ tests/test-featurelist.c | 219 ++++++++++++ tests/test-os.c | 209 ++++++++++++ 27 files changed, 1512 insertions(+) create mode 100644 osinfo/osinfo_feature.c create mode 100644 osinfo/osinfo_feature.h create mode 100644 osinfo/osinfo_feature_private.h create mode 100644 osinfo/osinfo_featurelist.c create mode 100644 osinfo/osinfo_featurelist.h create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-supported.xml create mode 100644 tests/test-feature.c create mode 100644 tests/test-featurelist.c -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:36 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:36 +0100 Subject: [Libosinfo] [osinfo-db PATCH v3 01/12] schema: Add support to Guest Features In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-2-fidencio@redhat.com> Let's add support to have the list of features supported by OS. It's quite important to note here that the feature being supported doesn't mean it'll automatically work out of the box as it may depend on also having whether QEMU or kernel have the right configuration. The features supported by now are: - cpu-hotplug - hyperv - hyperv-evmcs - hyperv-frequencies - hyperv-ipi - hyperv-reenlightenment - hyperv-relaxed - hyperv-reset - hyperv-runtime - hyperv-spinlocks - hyperv-synic - hyperv-tlbflush - hyperv-vapic - hyperv-vendor-id - hyperv-vpindex Signed-off-by: Fabiano Fid?ncio --- data/schema/osinfo.rng.in | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/data/schema/osinfo.rng.in b/data/schema/osinfo.rng.in index 3a42ac8..b342cb6 100644 --- a/data/schema/osinfo.rng.in +++ b/data/schema/osinfo.rng.in @@ -567,6 +567,48 @@ + + + + + + + + + + cpu-hotplug + hyperv + hyperv-evmcs + hyperv-frequencies + hyperv-ipi + hyperv-reenlightenment + hyperv-relaxed + hyperv-reset + hyperv-runtime + hyperv-spinlocks + hyperv-synic + hyperv-tlbflush + hyperv-vapic + hyperv-vendor-id + hyperv-vpindex + + + + + + + + + + + + + + + + @@ -601,6 +643,9 @@ + + + @@ -842,6 +887,15 @@ + + + + on|off + + + + + [0-9]+ -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:37 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:37 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 02/12] osinfo: Introduce OsinfoFeature In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-3-fidencio@redhat.com> OsinfoFeature is a new type intended to represent *guest* features. Its XML representation is something towards the lines of: cpu-hotplug hyperv-spinlocks hyperv-vapic cpu-hotplug Where supported is an optional attribute which has "true" as its default value. Signed-off-by: Fabiano Fid?ncio --- osinfo/Makefile.am | 2 + osinfo/libosinfo.syms | 8 + osinfo/osinfo.h | 1 + osinfo/osinfo_feature.c | 313 ++++++++++++++++++++++++++++++++ osinfo/osinfo_feature.h | 90 +++++++++ osinfo/osinfo_feature_private.h | 38 ++++ po/POTFILES.in | 1 + 7 files changed, 453 insertions(+) create mode 100644 osinfo/osinfo_feature.c create mode 100644 osinfo/osinfo_feature.h create mode 100644 osinfo/osinfo_feature_private.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index b43e32b..d553ecc 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -80,6 +80,7 @@ libosinfo_impl_include_HEADERS = \ osinfo_device_driver.h \ osinfo_device_driverlist.h \ osinfo_entity.h \ + osinfo_feature.h \ osinfo_filter.h \ osinfo_install_config.h \ osinfo_install_config_param.h \ @@ -127,6 +128,7 @@ libosinfo_c_files = \ osinfo_devicelinkfilter.c \ osinfo_device_driver.c \ osinfo_device_driverlist.c \ + osinfo_feature.c \ osinfo_install_config.c \ osinfo_install_config_param.c \ osinfo_install_config_paramlist.c \ diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 56cf9a5..0162081 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -533,6 +533,14 @@ LIBOSINFO_1.3.0 { global: osinfo_error_quark; + osinfo_feature_get_architecture; + osinfo_feature_get_name; + osinfo_feature_get_state; + osinfo_feature_get_type; + osinfo_feature_new; + osinfo_feature_set_state; + osinfo_feature_state_get_type; + osinfo_image_get_architecture; osinfo_image_get_cloud_init; osinfo_image_get_format; diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index 81c0daf..ff7f2e5 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/osinfo/osinfo_feature.c b/osinfo/osinfo_feature.c new file mode 100644 index 0000000..6d77dda --- /dev/null +++ b/osinfo/osinfo_feature.c @@ -0,0 +1,313 @@ +/* + * libosinfo: A single guest feature + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include +#include + +#include "osinfo/osinfo_feature_private.h" + +G_DEFINE_TYPE(OsinfoFeature, osinfo_feature, OSINFO_TYPE_ENTITY); + +#define OSINFO_FEATURE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), OSINFO_TYPE_FEATURE, OsinfoFeaturePrivate)) + +/** + * SECTION:osinfo_feature + * @short_description: A guest feature + * @see_also: #OsinfoOs, #OsinfoPlatform + * + * #OsinfoFeature is an entity representing some kind of guest + * feature. Features can be associated with operating systems + * and platforms. + */ + +struct _OsinfoFeaturePrivate +{ + gboolean unused; +}; + +enum { + PROP_0, + + PROP_ARCHITECTURE, + PROP_NAME, + PROP_STATE +}; + +static void +osinfo_feature_set_property(GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + OsinfoFeature *feature = OSINFO_FEATURE(object); + + switch(property_id) { + case PROP_ARCHITECTURE: + osinfo_entity_set_param(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_ARCHITECTURE, + g_value_get_string(value)); + break; + + case PROP_NAME: + osinfo_entity_set_param(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_NAME, + g_value_get_string(value)); + break; + + case PROP_STATE: + osinfo_entity_set_param_enum(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_STATE, + g_value_get_enum(value), + OSINFO_TYPE_FEATURE_STATE); + break; + + default: + /* We don't have any other property ... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + break; + } +} + +static void +osinfo_feature_get_property(GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + OsinfoFeature *feature = OSINFO_FEATURE(object); + + switch(property_id) { + case PROP_ARCHITECTURE: + g_value_set_string(value, osinfo_feature_get_architecture(feature)); + break; + + case PROP_NAME: + g_value_set_string(value, osinfo_feature_get_name(feature)); + break; + + case PROP_STATE: + g_value_set_enum(value, osinfo_feature_get_state(feature)); + break; + + default: + /* We don't have any other property ... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + break; + } +} + +static void osinfo_feature_finalize(GObject *object); + +static void +osinfo_feature_finalize(GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS(osinfo_feature_parent_class)->finalize(object); +} + +/* Init functions */ +static void +osinfo_feature_class_init(OsinfoFeatureClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS(klass); + GParamSpec *pspec; + + g_klass->set_property = osinfo_feature_set_property; + g_klass->get_property = osinfo_feature_get_property; + + /** + * OsinfoFeature:architecture: + * + * The target hardware architecture to which this feature applies. + */ + pspec = g_param_spec_string("architecture", + "CPU Architecture", + _("CPU Architecture"), + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, PROP_ARCHITECTURE, pspec); + + /** + * OsinfoFeature:name: + * + * The name of the feature + */ + pspec = g_param_spec_string("name", + "Name", + _("Feature's name"), + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, PROP_NAME, pspec); + + /** + * OsinfoFeature:state: + * + * The state of the feature, which is only valid for hyperv features. + */ + pspec = g_param_spec_enum("state", + "State", + _("Feature's state"), + OSINFO_TYPE_FEATURE_STATE, + OSINFO_FEATURE_STATE_ABSENT, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + g_object_class_install_property(g_klass, PROP_STATE, pspec); + + g_klass->finalize = osinfo_feature_finalize; + g_type_class_add_private(klass, sizeof(OsinfoFeaturePrivate)); +} + +static void +osinfo_feature_init(OsinfoFeature *feature) +{ + feature->priv = OSINFO_FEATURE_GET_PRIVATE(feature); +} + +OsinfoFeature *osinfo_feature_new(const gchar *id, + const gchar *name, + const gchar *architecture) +{ + return g_object_new(OSINFO_TYPE_FEATURE, + "id", id, + OSINFO_FEATURE_PROP_NAME, name, + OSINFO_FEATURE_PROP_ARCHITECTURE, architecture, + NULL); +} + +/** + * osinfo_feature_get_name: + * @feature: an #OsinfoFeature instance + * + * Return the name of the feature. + * + * Returns: (transfer none): the name of the feature. + */ +const gchar *osinfo_feature_get_name(OsinfoFeature *feature) +{ + g_return_val_if_fail(OSINFO_IS_FEATURE(feature), NULL); + + return osinfo_entity_get_param_value(OSINFO_ENTITY(feature), OSINFO_FEATURE_PROP_NAME); +} + +/** + * osinfo_feature_get_architecture: + * @feature: an #OsinfoFeature instance + * + * Retrieves the target hardware architecture to which the @feature applies. + * Some operating systems specify the same features for all architectures. In + * such cases, the string returned by this call will be + * #OSINFO_ARCHITECTURE_ALL. + * + * Returns: (transfer none): the hardware architecture. + */ +const gchar *osinfo_feature_get_architecture(OsinfoFeature *feature) +{ + g_return_val_if_fail(OSINFO_IS_FEATURE(feature), NULL); + + return osinfo_entity_get_param_value(OSINFO_ENTITY(feature), OSINFO_FEATURE_PROP_ARCHITECTURE); +} + +/** + * osinfo_feature_get_state: + * @feature: an #OsinfoFeature instance + * + * Returns: the state of the hyperv @feature + */ +OsinfoFeatureState osinfo_feature_get_state(OsinfoFeature *feature) +{ + g_return_val_if_fail(OSINFO_IS_FEATURE(feature), OSINFO_FEATURE_STATE_ABSENT); + + return osinfo_entity_get_param_value_enum(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_STATE, + OSINFO_TYPE_FEATURE_STATE, + OSINFO_FEATURE_STATE_ABSENT); +} + +/** + * osinfo_feature_set_state: + * @feature: an #OsinfoFeature instance + * @state: one of the possible states for the @feature: + * OSINFO_FEATURE_STATE_ABSENT + * OSINFO_FEATURE_STATE_ON + * OSINFO_FEATURE_STATE_OFF + * + * Note: @state only makes sense and only should be used with hyperv related + * features. + * + * Set the @state of a hyperv @feature. + */ +void osinfo_feature_set_state(OsinfoFeature *feature, OsinfoFeatureState state) +{ + g_return_if_fail(OSINFO_IS_FEATURE(feature)); + + osinfo_entity_set_param_enum(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_STATE, + state, + OSINFO_TYPE_FEATURE_STATE); +} + +/** + * osinfo_feature_get_supported: + * @feature: an #OsinfoFeature instance + * + * Mind that this method is *private*! + * + * Return whether the feature is supported or not. + */ +gboolean osinfo_feature_get_supported(OsinfoFeature *feature) +{ + g_return_val_if_fail(OSINFO_IS_FEATURE(feature), FALSE); + + return osinfo_entity_get_param_value_boolean_with_default(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_SUPPORTED, + TRUE); +} + +/** + * osinfo_feature_set_supported + * @feature: an #OsinfoFeature instance + * @supported: boolean value + * + * Mind that this method is *private*! + * + * Set whether a feature is supported or not. + */ +void osinfo_feature_set_supported(OsinfoFeature *feature, gboolean supported) +{ + g_return_if_fail(OSINFO_IS_FEATURE(feature)); + + osinfo_entity_set_param_boolean(OSINFO_ENTITY(feature), + OSINFO_FEATURE_PROP_SUPPORTED, + supported); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_feature.h b/osinfo/osinfo_feature.h new file mode 100644 index 0000000..c669574 --- /dev/null +++ b/osinfo/osinfo_feature.h @@ -0,0 +1,90 @@ +/* + * libosinfo: A single guest feature + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid?ncio + */ + +#include +#include + +#ifndef __OSINFO_FEATURE_H__ +#define __OSINFO_FEATURE_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_FEATURE (osinfo_feature_get_type ()) +#define OSINFO_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_FEATURE, OsinfoFeature)) +#define OSINFO_IS_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_FEATURE)) +#define OSINFO_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_FEATURE, OsinfoFeatureClass)) +#define OSINFO_IS_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_FEATURE)) +#define OSINFO_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_FEATURE, OsinfoFeatureClass)) + +typedef struct _OsinfoFeature OsinfoFeature; +typedef struct _OsinfoFeatureClass OsinfoFeatureClass; +typedef struct _OsinfoFeaturePrivate OsinfoFeaturePrivate; + +#define OSINFO_FEATURE_PROP_ARCHITECTURE "architecture" +#define OSINFO_FEATURE_PROP_NAME "name" +#define OSINFO_FEATURE_PROP_STATE "state" + +typedef enum { + OSINFO_FEATURE_STATE_ABSENT, + OSINFO_FEATURE_STATE_ON, + OSINFO_FEATURE_STATE_OFF, +} OsinfoFeatureState; + +/* object */ +struct _OsinfoFeature +{ + OsinfoEntity parent_instance; + + /* public */ + + /* private */ + OsinfoFeaturePrivate *priv; +}; + +/* class */ +struct _OsinfoFeatureClass +{ + /*< private >*/ + OsinfoEntityClass parent_class; + + /* class members */ +}; + +GType osinfo_feature_get_type(void); + +OsinfoFeature *osinfo_feature_new(const gchar *id, const gchar *name, const gchar *architecture); + +const gchar *osinfo_feature_get_architecture(OsinfoFeature *feature); +const gchar *osinfo_feature_get_name(OsinfoFeature *feature); +OsinfoFeatureState osinfo_feature_get_state(OsinfoFeature *feature); +void osinfo_feature_set_state(OsinfoFeature *feature, OsinfoFeatureState state); + +#endif /* __OSINFO_FEATURE_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_feature_private.h b/osinfo/osinfo_feature_private.h new file mode 100644 index 0000000..46dc16e --- /dev/null +++ b/osinfo/osinfo_feature_private.h @@ -0,0 +1,38 @@ +/* + * libosinfo: A single guest feature + * + * Copyright (C) 2019 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#ifndef __OSINFO_FEATURE_PRIVATE_H__ +#define __OSINFO_FEATURE_PRIVATE_H__ + +#define OSINFO_FEATURE_PROP_SUPPORTED "supported" + +gboolean osinfo_feature_get_supported(OsinfoFeature *feature); +void osinfo_feature_set_supported(OsinfoFeature *feature, gboolean supported); + +#endif /* __OSINFO_FEATURE_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 2a714df..86f7090 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -3,6 +3,7 @@ osinfo/osinfo_deployment.c osinfo/osinfo_devicelink.c osinfo/osinfo_devicelinkfilter.c osinfo/osinfo_entity.c +osinfo/osinfo_feature.c osinfo/osinfo_image.c osinfo/osinfo_install_config_param.c osinfo/osinfo_install_script.c -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:38 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:38 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 03/12] tests: Add basic test for OsinfoFeature In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-4-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .gitignore | 1 + tests/Makefile.am | 5 ++++ tests/test-feature.c | 68 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 tests/test-feature.c diff --git a/.gitignore b/.gitignore index b888b50..524d9a1 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ tests/test-list tests/test-db tests/test-devicelist tests/test-devicelinklist +tests/test-feature tests/test-filter tests/test-hypervisorlist tests/test-install-script diff --git a/tests/Makefile.am b/tests/Makefile.am index 45703df..6f3cdb4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,7 @@ check_PROGRAMS = \ test-list \ test-devicelist \ test-devicelinklist \ + test-feature \ test-filter \ test-media \ test-product \ @@ -54,6 +55,10 @@ test_device_LDADD = $(COMMON_LDADD) test_device_CFLAGS = $(COMMON_CFLAGS) test_device_SOURCES = test-device.c +test_feature_LDADD = $(COMMON_LDADD) +test_feature_CFLAGS = $(COMMON_CFLAGS) +test_feature_SOURCES = test-feature.c + test_filter_LDADD = $(COMMON_LDADD) test_filter_CFLAGS = $(COMMON_CFLAGS) test_filter_SOURCES = test-filter.c diff --git a/tests/test-feature.c b/tests/test-feature.c new file mode 100644 index 0000000..1a02a72 --- /dev/null +++ b/tests/test-feature.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2018 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see + */ + +#include + +#include +#include "osinfo/osinfo_feature_private.h" + + +static void +test_basic(void) +{ + OsinfoFeature *feature; + + feature = osinfo_feature_new("feature:0", "cpu-hotplug", "x86_64"); + g_assert_true(OSINFO_IS_FEATURE(feature)); + g_assert_cmpstr(osinfo_entity_get_id(OSINFO_ENTITY(feature)), ==, "feature:0"); + g_assert_cmpstr(osinfo_feature_get_name(feature), ==, "cpu-hotplug"); + g_assert_cmpstr(osinfo_feature_get_architecture(feature), ==, "x86_64"); + g_assert_cmpint(osinfo_feature_get_state(feature), ==, OSINFO_FEATURE_STATE_ABSENT); + g_assert_true(osinfo_feature_get_supported(feature)); + osinfo_feature_set_supported(feature, FALSE); + g_assert_false(osinfo_feature_get_supported(feature)); + + g_object_unref(feature); + + feature = osinfo_feature_new("feature:1", "hyperv-relaxed", "x86_64"); + g_assert_true(OSINFO_IS_FEATURE(feature)); + osinfo_feature_set_state(feature, OSINFO_FEATURE_STATE_ON); + g_assert_cmpint(osinfo_feature_get_state(feature), ==, OSINFO_FEATURE_STATE_ON); + + g_object_unref(feature); +} + + +int +main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/feature/basic", test_basic); + + /* Upfront so we don't confuse valgrind */ + osinfo_feature_get_type(); + + return g_test_run(); +} +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:39 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:39 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 04/12] osinfo: Introduce OsinfoFeatureList In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-5-fidencio@redhat.com> OsinfoFeatureList is a list of guest OS features. Signed-off-by: Fabiano Fid?ncio --- osinfo/Makefile.am | 2 + osinfo/libosinfo.syms | 3 ++ osinfo/osinfo.h | 1 + osinfo/osinfo_featurelist.c | 88 +++++++++++++++++++++++++++++++++++++ osinfo/osinfo_featurelist.h | 75 +++++++++++++++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 osinfo/osinfo_featurelist.c create mode 100644 osinfo/osinfo_featurelist.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index d553ecc..07ea5de 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -81,6 +81,7 @@ libosinfo_impl_include_HEADERS = \ osinfo_device_driverlist.h \ osinfo_entity.h \ osinfo_feature.h \ + osinfo_featurelist.h \ osinfo_filter.h \ osinfo_install_config.h \ osinfo_install_config_param.h \ @@ -129,6 +130,7 @@ libosinfo_c_files = \ osinfo_device_driver.c \ osinfo_device_driverlist.c \ osinfo_feature.c \ + osinfo_featurelist.c \ osinfo_install_config.c \ osinfo_install_config_param.c \ osinfo_install_config_paramlist.c \ diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 0162081..30bab43 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -541,6 +541,9 @@ LIBOSINFO_1.3.0 { osinfo_feature_set_state; osinfo_feature_state_get_type; + osinfo_featurelist_get_type; + osinfo_featurelist_new; + osinfo_image_get_architecture; osinfo_image_get_cloud_init; osinfo_image_get_format; diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index ff7f2e5..00cfed5 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/osinfo/osinfo_featurelist.c b/osinfo/osinfo_featurelist.c new file mode 100644 index 0000000..080ee80 --- /dev/null +++ b/osinfo/osinfo_featurelist.c @@ -0,0 +1,88 @@ +/* + * libosinfo: + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include +#include + +G_DEFINE_TYPE(OsinfoFeatureList, osinfo_featurelist, OSINFO_TYPE_LIST); + +#define OSINFO_FEATURELIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), OSINFO_TYPE_FEATURELIST, OsinfoFeatureListPrivate)) + +/** + * SECTION:osinfo_featurelist + * @short_description: A list of guest features + * @see_also: #OsinfoList, #OsinfoFeature + * + * #OsinfoFeatureList is a list specialization that stores + * only #OsinfoFeature objects. + */ + +struct _OsinfoFeatureListPrivate +{ + gboolean unused; +}; + +static void +osinfo_featurelist_finalize(GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS(osinfo_featurelist_parent_class)->finalize(object); +} + +/* Init functions */ +static void +osinfo_featurelist_class_init(OsinfoFeatureListClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS(klass); + + g_klass->finalize = osinfo_featurelist_finalize; + g_type_class_add_private(klass, sizeof(OsinfoFeatureListPrivate)); +} + +static void +osinfo_featurelist_init(OsinfoFeatureList *list) +{ + list->priv = OSINFO_FEATURELIST_GET_PRIVATE(list); +} + + +/** + * osinfo_featurelist_new: + * + * Construct a new feature list that is initially empty. + * + * Returns: (transfer full): an empty feature list + */ +OsinfoFeatureList *osinfo_featurelist_new(void) +{ + return g_object_new(OSINFO_TYPE_FEATURELIST, + "element-type", OSINFO_TYPE_FEATURE, + NULL); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_featurelist.h b/osinfo/osinfo_featurelist.h new file mode 100644 index 0000000..7902ca5 --- /dev/null +++ b/osinfo/osinfo_featurelist.h @@ -0,0 +1,75 @@ +/* + * libosinfo: a list of features + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include +#include +#include + +#ifndef __OSINFO_FEATURELIST_H__ +#define __OSINFO_FEATURELIST_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_FEATURELIST (osinfo_featurelist_get_type ()) +#define OSINFO_FEATURELIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_FEATURELIST, OsinfoFeatureList)) +#define OSINFO_IS_FEATURELIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_FEATURELIST)) +#define OSINFO_FEATURELIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_FEATURELIST, OsinfoFeatureListClass)) +#define OSINFO_IS_FEATURELIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_FEATURELIST)) +#define OSINFO_FEATURELIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_FEATURELIST, OsinfoFeatureListClass)) + +typedef struct _OsinfoFeatureList OsinfoFeatureList; + +typedef struct _OsinfoFeatureListClass OsinfoFeatureListClass; + +typedef struct _OsinfoFeatureListPrivate OsinfoFeatureListPrivate; + +/* object */ +struct _OsinfoFeatureList +{ + OsinfoList parent_instance; + + /* public */ + + /* private */ + OsinfoFeatureListPrivate *priv; +}; + +/* class */ +struct _OsinfoFeatureListClass +{ + /*< private >*/ + OsinfoListClass parent_class; + + /* class members */ +}; + +GType osinfo_featurelist_get_type(void); + +OsinfoFeatureList *osinfo_featurelist_new(void); + +#endif /* __OSINFO_FEATURELIST_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:40 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:40 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 05/12] tests: Add basic test for OsinfoListFeature In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-6-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .gitignore | 1 + tests/Makefile.am | 5 + tests/test-featurelist.c | 219 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 225 insertions(+) create mode 100644 tests/test-featurelist.c diff --git a/.gitignore b/.gitignore index 524d9a1..4980eac 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ tests/test-db tests/test-devicelist tests/test-devicelinklist tests/test-feature +tests/test-featurelist tests/test-filter tests/test-hypervisorlist tests/test-install-script diff --git a/tests/Makefile.am b/tests/Makefile.am index 6f3cdb4..d57e2e1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,6 +8,7 @@ check_PROGRAMS = \ test-devicelist \ test-devicelinklist \ test-feature \ + test-featurelist \ test-filter \ test-media \ test-product \ @@ -59,6 +60,10 @@ test_feature_LDADD = $(COMMON_LDADD) test_feature_CFLAGS = $(COMMON_CFLAGS) test_feature_SOURCES = test-feature.c +test_featurelist_LDADD = $(COMMON_LDADD) +test_featurelist_CFLAGS = $(COMMON_CFLAGS) +test_featurelist_SOURCES = test-featurelist.c + test_filter_LDADD = $(COMMON_LDADD) test_filter_CFLAGS = $(COMMON_CFLAGS) test_filter_SOURCES = test-filter.c diff --git a/tests/test-featurelist.c b/tests/test-featurelist.c new file mode 100644 index 0000000..e1efaf1 --- /dev/null +++ b/tests/test-featurelist.c @@ -0,0 +1,219 @@ +/* + * Copyright (C) 2018 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see + */ + +#include + +#include + + +static void +test_union(void) +{ + OsinfoFeatureList *list1 = osinfo_featurelist_new(); + OsinfoFeatureList *list2 = osinfo_featurelist_new(); + OsinfoFeatureList *list3; + OsinfoFeature *ent1 = osinfo_feature_new("feature:0", "cpu-hotplug", "x86_64"); + OsinfoFeature *ent2 = osinfo_feature_new("feature:1", "hyperv-relaxed", "x86_64"); + OsinfoFeature *ent3 = osinfo_feature_new("feature:2", "hyperv-vapic", "x86_64"); + OsinfoFeature *ent4 = osinfo_feature_new("feature:3", "hyperv-spinlocks", "x86_64"); + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4)); + + list3 = OSINFO_FEATURELIST(osinfo_list_new_union(OSINFO_LIST(list1), OSINFO_LIST(list2))); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list3)), ==, 4); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list3)); i++) { + OsinfoFeature *ent = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(list3), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_true(has2); + g_assert_true(has3); + g_assert_true(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(list1); + g_object_unref(list2); + g_object_unref(list3); +} + + +static void +test_intersect(void) +{ + OsinfoFeatureList *list1 = osinfo_featurelist_new(); + OsinfoFeatureList *list2 = osinfo_featurelist_new(); + OsinfoFeatureList *list3; + OsinfoFeature *ent1 = osinfo_feature_new("feature:0", "cpu-hotplug", "x86_64"); + OsinfoFeature *ent2 = osinfo_feature_new("feature:1", "hyperv-relaxed", "x86_64"); + OsinfoFeature *ent3 = osinfo_feature_new("feature:2", "hyperv-vapic", "x86_64"); + OsinfoFeature *ent4 = osinfo_feature_new("feature:3", "hyperv-spinlocks", "x86_64"); + + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent3)); + osinfo_list_add(OSINFO_LIST(list2), OSINFO_ENTITY(ent4)); + + list3 = OSINFO_FEATURELIST(osinfo_list_new_intersection(OSINFO_LIST(list1), OSINFO_LIST(list2))); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list3)), ==, 2); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list3)); i++) { + OsinfoFeature *ent = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(list3), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_false(has2); + g_assert_true(has3); + g_assert_false(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(list1); + g_object_unref(list2); + g_object_unref(list3); +} + + +static void +test_filter(void) +{ + OsinfoFeatureList *list1 = osinfo_featurelist_new(); + OsinfoFeatureList *list2; + OsinfoFilter *filter = osinfo_filter_new(); + OsinfoFeature *ent1 = osinfo_feature_new("feature:0", "cpu-hotplug", "x86_64"); + OsinfoFeature *ent2 = osinfo_feature_new("feature:1", "hyperv-relaxed", "x86_64"); + OsinfoFeature *ent3 = osinfo_feature_new("feature:2", "hyperv-vapic", "x86_64"); + OsinfoFeature *ent4 = osinfo_feature_new("feature:3", "hyperv-spinlocks", "x86_64"); + + + osinfo_filter_add_constraint(filter, "name", "cpu-hotplug"); + + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent1)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent2)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent3)); + osinfo_list_add(OSINFO_LIST(list1), OSINFO_ENTITY(ent4)); + + list2 = OSINFO_FEATURELIST(osinfo_list_new_filtered(OSINFO_LIST(list1), filter)); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(list2)), ==, 1); + + gboolean has1 = FALSE; + gboolean has2 = FALSE; + gboolean has3 = FALSE; + gboolean has4 = FALSE; + gboolean hasBad = FALSE; + int i; + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(list2)); i++) { + OsinfoFeature *ent = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(list2), i)); + if (ent == ent1) + has1 = TRUE; + else if (ent == ent2) + has2 = TRUE; + else if (ent == ent3) + has3 = TRUE; + else if (ent == ent4) + has4 = TRUE; + else + hasBad = TRUE; + } + g_assert_true(has1); + g_assert_false(has2); + g_assert_false(has3); + g_assert_false(has4); + g_assert_false(hasBad); + + g_object_unref(ent1); + g_object_unref(ent2); + g_object_unref(ent3); + g_object_unref(ent4); + g_object_unref(filter); + g_object_unref(list1); + g_object_unref(list2); +} + + +int +main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/featurelist/union", test_union); + g_test_add_func("/featurelist/intersect", test_intersect); + g_test_add_func("/featurelist/filter", test_filter); + + /* Upfront so we don't confuse valgrind */ + osinfo_feature_get_type(); + osinfo_featurelist_get_type(); + osinfo_filter_get_type(); + + return g_test_run(); +} +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:41 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:41 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 06/12] os: Make os aware of Guest Features In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-7-fidencio@redhat.com> This commit adds the whole machinery needed for dealing with Guest Features for an Os object. Signed-off-by: Fabiano Fid?ncio --- osinfo/libosinfo.syms | 2 + osinfo/osinfo_os.c | 140 ++++++++++++++++++++++++++++++++++++++++++ osinfo/osinfo_os.h | 4 ++ 3 files changed, 146 insertions(+) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 30bab43..99a7843 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -562,9 +562,11 @@ LIBOSINFO_1.3.0 { osinfo_media_supports_installer_script; + osinfo_os_add_feature; osinfo_os_add_image; osinfo_os_add_maximum_resources; osinfo_os_get_all_device_links; + osinfo_os_get_feature_list; osinfo_os_get_image_list; osinfo_os_get_maximum_resources; diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 01d2e01..c29ffd2 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -29,6 +29,7 @@ #include "osinfo/osinfo_product_private.h" #include "osinfo/osinfo_os_private.h" #include "osinfo/osinfo_resources_private.h" +#include "osinfo/osinfo_feature_private.h" #include G_DEFINE_TYPE(OsinfoOs, osinfo_os, OSINFO_TYPE_PRODUCT); @@ -59,6 +60,7 @@ struct _OsinfoOsPrivate OsinfoResourcesList *minimum; OsinfoResourcesList *recommended; OsinfoResourcesList *maximum; + OsinfoFeatureList *features; OsinfoInstallScriptList *scripts; @@ -119,6 +121,7 @@ osinfo_os_finalize(GObject *object) g_object_unref(os->priv->minimum); g_object_unref(os->priv->recommended); g_object_unref(os->priv->maximum); + g_object_unref(os->priv->features); g_object_unref(os->priv->scripts); @@ -186,6 +189,7 @@ osinfo_os_init(OsinfoOs *os) os->priv->minimum = osinfo_resourceslist_new(); os->priv->recommended = osinfo_resourceslist_new(); os->priv->maximum = osinfo_resourceslist_new(); + os->priv->features = osinfo_featurelist_new(); os->priv->scripts = osinfo_install_scriptlist_new(); os->priv->device_drivers = osinfo_device_driverlist_new(); } @@ -553,6 +557,142 @@ OsinfoDeviceLink *osinfo_os_add_device(OsinfoOs *os, OsinfoDevice *dev) return devlink; } +static gboolean feature_exists_in_list(const gchar *name, + OsinfoList *list) +{ + gssize len, i; + + if (list == NULL) + return FALSE; + + len = osinfo_list_get_length(list); + for (i = 0; i < len; i++) { + OsinfoFeature *f; + + f = OSINFO_FEATURE(osinfo_list_get_nth(list, i)); + + if (g_str_equal(name, osinfo_feature_get_name(f))) + return TRUE; + } + + return FALSE; +} + +struct GetAllFeaturesData { + OsinfoOs *os; + OsinfoFilter *filter; + OsinfoFeatureList *feature_list; + OsinfoFeatureList *unsupported_list; +}; + +static void get_all_features_cb(OsinfoProduct *product, gpointer user_data) +{ + OsinfoFeatureList *filtered; + OsinfoFeatureList *filtered_arch; + OsinfoFeatureList *filtered_all; + OsinfoOs *os; + OsinfoFilter *filter; + struct GetAllFeaturesData *foreach_data = (struct GetAllFeaturesData *)user_data; + gsize featurelist_len; + gsize i; + + g_return_if_fail(OSINFO_IS_OS(product)); + os = OSINFO_OS(product); + + filter = osinfo_filter_new(); + osinfo_filter_add_constraint(filter, OSINFO_FEATURE_PROP_ARCHITECTURE, "all"); + filtered_all = OSINFO_FEATURELIST(osinfo_list_new_filtered(OSINFO_LIST(os->priv->features), + filter)); + filtered_arch = OSINFO_FEATURELIST(osinfo_list_new_filtered(OSINFO_LIST(os->priv->features), + foreach_data->filter)); + + filtered = OSINFO_FEATURELIST(osinfo_list_new_union(OSINFO_LIST(filtered_arch), + OSINFO_LIST(filtered_all))); + + featurelist_len = osinfo_list_get_length(OSINFO_LIST(filtered)); + + for (i = 0; i < featurelist_len; i++) { + OsinfoFeature *feature; + const gchar *name; + + feature = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(filtered), i)); + name = osinfo_feature_get_name(feature); + + if (!osinfo_feature_get_supported(feature) && + !feature_exists_in_list(name, OSINFO_LIST(foreach_data->unsupported_list))) + osinfo_list_add(OSINFO_LIST(foreach_data->unsupported_list), OSINFO_ENTITY(feature)); + } + + for (i = 0; i < featurelist_len; i++) { + OsinfoFeature *feature; + const gchar *name; + + feature = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(filtered), i)); + name = osinfo_feature_get_name(feature); + + if (!feature_exists_in_list(name, OSINFO_LIST(foreach_data->unsupported_list)) && + !feature_exists_in_list(name, OSINFO_LIST(foreach_data->feature_list))) + osinfo_list_add(OSINFO_LIST(foreach_data->feature_list), OSINFO_ENTITY(feature)); + } + + g_object_unref(filtered); + g_object_unref(filtered_all); + g_object_unref(filtered_arch); + g_object_unref(filter); +} + +/** + * osinfo_os_get_feature_list: + * @os: an operating system + * @arch: the target architecture + * + * Get all features matching a given filter and taking into consideration + * all features previous set in all OSes from which @os derived and/or cloned. + * + * Returns: (transfer full): A list of OsinfoFeature + */ +OsinfoFeatureList *osinfo_os_get_feature_list(OsinfoOs *os, const gchar *arch) +{ + struct GetAllFeaturesData foreach_data = { + .os = os, + .filter = osinfo_filter_new(), + .feature_list = osinfo_featurelist_new(), + .unsupported_list = osinfo_featurelist_new(), + }; + + g_return_val_if_fail(OSINFO_IS_OS(os), NULL); + g_return_val_if_fail(arch != NULL, NULL); + + osinfo_filter_add_constraint(foreach_data.filter, + OSINFO_FEATURE_PROP_ARCHITECTURE, + arch); + + osinfo_product_foreach_related(OSINFO_PRODUCT(os), + OSINFO_PRODUCT_FOREACH_FLAG_DERIVES_FROM | + OSINFO_PRODUCT_FOREACH_FLAG_CLONES, + get_all_features_cb, + &foreach_data); + + g_object_unref(foreach_data.filter); + g_object_unref(foreach_data.unsupported_list); + + return foreach_data.feature_list; +} + +/** osinfo_os_add_feature: + * @os: an operating system + * @feature: (transfer none): the feature to associate with + * + * Adds @feature to list of features of operating system @os. + */ +void osinfo_os_add_feature(OsinfoOs *os, OsinfoFeature *feature) +{ + g_return_if_fail(OSINFO_IS_OS(os)); + g_return_if_fail(OSINFO_IS_FEATURE(feature)); + + osinfo_list_add(OSINFO_LIST(os->priv->features), OSINFO_ENTITY(feature)); +} + /** * osinfo_os_get_family: * @os: an #OsinfoOs diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h index 4eb4b1b..6ea825d 100644 --- a/osinfo/osinfo_os.h +++ b/osinfo/osinfo_os.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -137,6 +138,9 @@ void osinfo_os_add_install_script(OsinfoOs *os, OsinfoInstallScript *script); OsinfoDeviceDriverList *osinfo_os_get_device_drivers(OsinfoOs *os); void osinfo_os_add_device_driver(OsinfoOs *os, OsinfoDeviceDriver *driver); +OsinfoFeatureList *osinfo_os_get_feature_list(OsinfoOs *os, const gchar *arch); +void osinfo_os_add_feature(OsinfoOs *os, OsinfoFeature *feature); + #endif /* __OSINFO_OS_H__ */ /* * Local variables: -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:42 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:42 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 07/12] loader: Make loader aware of Guest Features In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-8-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_loader.c | 71 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index 8f7b2bf..b4bad60 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -39,6 +39,7 @@ #include "osinfo_install_script_private.h" #include "osinfo_device_driver_private.h" #include "osinfo_resources_private.h" +#include "osinfo_feature_private.h" #ifndef USB_IDS #define USB_IDS PKG_DATA_DIR "/usb.ids" @@ -658,6 +659,54 @@ static void osinfo_loader_device_link(OsinfoLoader *loader, g_free(related); } +static void osinfo_loader_features(OsinfoOs *os, + OsinfoLoader *loader, + xmlXPathContextPtr ctxt, + xmlNodePtr root, + const gchar *id, + GError **err) +{ + gchar *arch; + xmlNodePtr *nodes = NULL; + int nnodes, i; + + arch = (gchar *)xmlGetProp(root, BAD_CAST "arch"); + + nnodes = osinfo_loader_nodeset("./feature", loader, ctxt, &nodes, err); + if (error_is_set(err)) + goto cleanup; + + for (i = 0; i < nnodes; i++) { + gchar *supported; + gchar *feature_id; + const gchar *name; + + if (nodes[i]->children->type != XML_TEXT_NODE || + !g_str_equal((const gchar *)nodes[i]->name, "feature")) + continue; + + name = (const gchar *)nodes[i]->children->content; + feature_id = g_strdup_printf("%s:%u", id, i); + OsinfoFeature *feature = osinfo_feature_new(feature_id, name, arch); + osinfo_os_add_feature(os, feature); + + supported = (gchar *)xmlGetProp(nodes[i], + BAD_CAST OSINFO_FEATURE_PROP_SUPPORTED); + if (supported != NULL) { + osinfo_feature_set_supported(feature, + g_str_equal(supported, "true") ? TRUE: FALSE); + g_free(supported); + } + + g_free(feature_id); + g_object_unref(feature); + } + + cleanup: + g_free(nodes); + g_free(arch); +} + static void osinfo_loader_product_relshp(OsinfoLoader *loader, OsinfoProduct *product, OsinfoProductRelationship relshp, @@ -1515,6 +1564,28 @@ static void osinfo_loader_os(OsinfoLoader *loader, if (error_is_set(err)) goto cleanup; + nnodes = osinfo_loader_nodeset("./features", loader, ctxt, &nodes, err); + if (error_is_set(err)) + goto cleanup; + + for (i = 0; i < nnodes; i++) { + xmlNodePtr saved; + gchar *features_id; + + saved = ctxt->node; + ctxt->node = nodes[i]; + features_id = g_strdup_printf("%s:%u", id, i); + osinfo_loader_features(os, loader, ctxt, nodes[i], features_id, err); + g_free(features_id); + + ctxt->node = saved; + + if (error_is_set(err)) + goto cleanup; + } + + g_free(nodes); + nnodes = osinfo_loader_nodeset("./media", loader, ctxt, &nodes, err); if (error_is_set(err)) goto cleanup; -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:43 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:43 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 08/12] test-os: Add basic tests for Guest Features In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-9-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- tests/test-os.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test-os.c b/tests/test-os.c index 45598bb..7bf45cf 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -61,6 +61,33 @@ test_devices(void) } +static void +test_features(void) +{ + OsinfoOs *os = osinfo_os_new("awesome"); + OsinfoFeature *feature1 = osinfo_feature_new("awesome:0", "cpu-hotplug", "x86_64"); + OsinfoFeature *feature2 = osinfo_feature_new("awesome:1", "hyperv-relaxed", "x86_64"); + OsinfoFeature *feature3 = osinfo_feature_new("awesome:2", "cpu-hotplug", "all"); + OsinfoFeature *feature4 = osinfo_feature_new("awesome:3", "hyperv-relaxed", "i686"); + + osinfo_os_add_feature(os, feature1); + osinfo_os_add_feature(os, feature2); + osinfo_os_add_feature(os, feature3); + osinfo_os_add_feature(os, feature4); + + OsinfoFeatureList *features = osinfo_os_get_feature_list(os, "x86_64"); + + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(features)), ==, 2); + g_assert_true(osinfo_list_get_nth(OSINFO_LIST(features), 0) == OSINFO_ENTITY(feature1)); + g_assert_true(osinfo_list_get_nth(OSINFO_LIST(features), 1) == OSINFO_ENTITY(feature2)); + + g_object_unref(features); + g_object_unref(feature1); + g_object_unref(feature2); + g_object_unref(os); +} + + static void test_loader(void) { @@ -947,6 +974,7 @@ main(int argc, char *argv[]) test_devices_inheritance_basic); g_test_add_func("/os/devices/inheritance/removal", test_devices_inheritance_removal); + g_test_add_func("/os/features", test_features); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:44 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:44 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 09/12] test-os: Add test_features_inheritance_basic() In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-10-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .../test-os-features-basic-1.xml | 21 +++++++ .../test-os-features-basic-2-clone.xml | 10 +++ .../test-os-features-basic-2.xml | 10 +++ tests/test-os.c | 61 +++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml b/tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml new file mode 100644 index 0000000..183e0d5 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-basic-1.xml @@ -0,0 +1,21 @@ + + + + features-basic-1 + Features Basic 1 + libosinfo.org + test + + + cpu-hotplug + + + + hyperv-relaxed + + + + hyperv-vapic + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml new file mode 100644 index 0000000..cf65ea7 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2-clone.xml @@ -0,0 +1,10 @@ + + + + features-basic-2-clone + Features Basic 2 Clone + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml new file mode 100644 index 0000000..d3af204 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-basic-2.xml @@ -0,0 +1,10 @@ + + + + features-basic-2 + Features Basic 2 + libosinfo.org + test + + + diff --git a/tests/test-os.c b/tests/test-os.c index 7bf45cf..851c99e 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -664,6 +664,65 @@ test_devices_inheritance_basic(void) } +static void +features_inheritance_basic_check(OsinfoDb *db, + const gchar *os_id) +{ + OsinfoOs *os; + OsinfoFeatureList *feature_list; + OsinfoFeature *feature; + gsize i; + + g_test_message("Testing \"%s\"\n", os_id); + + os = osinfo_db_get_os(db, os_id); + g_assert(OSINFO_IS_OS(os)); + + feature_list = osinfo_os_get_feature_list(os, "x86_64"); + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(feature_list)), ==, 2); + + for (i = 0; i < osinfo_list_get_length(OSINFO_LIST(feature_list)); i++) { + feature = OSINFO_FEATURE(osinfo_list_get_nth(OSINFO_LIST(feature_list), i)); + g_assert(OSINFO_IS_FEATURE(feature)); + } + + g_object_unref(feature_list); +} + + +static void +test_features_inheritance_basic(void) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + GError *error = NULL; + + osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error); + g_assert_no_error(error); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + /* + * "http://libosinfo.org/test/os/features/basic/1 has one feature set + */ + features_inheritance_basic_check(db, "http://libosinfo.org/test/os/features/basic/1"); + + /* + * http://libosinfo.org/test/os/features/basic/2 derives-from + * http://libosinfo.org/test/os/features/basic/1 + */ + features_inheritance_basic_check(db, "http://libosinfo.org/test/os/features/basic/2"); + + /* + * http://libosinfo.org/test/os/features/basic/2-clone clones + * http://libosinfo.org/test/os/features/basic/2 + */ + features_inheritance_basic_check(db, "http://libosinfo.org/test/os/features/basic/2-clone"); + + g_object_unref(db); +} + + static void devices_inheritance_removal_check_devs(OsinfoDb *db, const gchar *os_id, @@ -975,6 +1034,8 @@ main(int argc, char *argv[]) g_test_add_func("/os/devices/inheritance/removal", test_devices_inheritance_removal); g_test_add_func("/os/features", test_features); + g_test_add_func("/os/features/inheritance/basic", + test_features_inheritance_basic); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:45 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:45 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 10/12] test-os: Add test_features_inheritance_removal() In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-11-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .../test-os-features-removed-1.xml | 14 +++ .../test-os-features-removed-2-clone.xml | 10 ++ .../test-os-features-removed-2.xml | 10 ++ .../test-os-features-removed-3.xml | 15 +++ .../test-os-features-removed-4-clone.xml | 10 ++ .../test-os-features-removed-4.xml | 10 ++ tests/test-os.c | 95 +++++++++++++++++++ 7 files changed, 164 insertions(+) create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml new file mode 100644 index 0000000..d2c7806 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-1.xml @@ -0,0 +1,14 @@ + + + + features-removed-1 + Features Removed 1 + libosinfo.org + test + + + + cpu-hotplug + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml new file mode 100644 index 0000000..d6d2088 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2-clone.xml @@ -0,0 +1,10 @@ + + + + features-removed-2-clone + Features Removed 2 Clone + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml new file mode 100644 index 0000000..7939e98 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-2.xml @@ -0,0 +1,10 @@ + + + + features-removed-2 + Features Removed 2 + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml new file mode 100644 index 0000000..c433945 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-3.xml @@ -0,0 +1,15 @@ + + + + features-removed-3 + Features Removed 3 + libosinfo.org + test + + + + cpu-hotplug + + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml new file mode 100644 index 0000000..cb638e6 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4-clone.xml @@ -0,0 +1,10 @@ + + + + features-removed-4-clone + Features Removed 4 Clone + libosinfo.org + test + + + diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml new file mode 100644 index 0000000..7f5b7cb --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-removed-4.xml @@ -0,0 +1,10 @@ + + + + features-removed-4 + Features Removed 4 + libosinfo.org + test + + + diff --git a/tests/test-os.c b/tests/test-os.c index 851c99e..0aa6715 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -832,6 +832,99 @@ test_devices_inheritance_removal(void) } +static void +features_inheritance_removal_check_features(OsinfoDb *db, + const gchar *os_id, + gint feature_list_len) +{ + OsinfoOs *os; + OsinfoFeatureList *feature_list; + + g_test_message("Testing \"%s\"\n", os_id); + + os = osinfo_db_get_os(db, os_id); + g_assert(OSINFO_IS_OS(os)); + + feature_list = osinfo_os_get_feature_list(os, "x86_64"); + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(feature_list)), ==, feature_list_len); + g_object_unref(feature_list); +} + + +static void +test_features_inheritance_removal(void) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + GError *error = NULL; + + osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error); + g_assert_no_error(error); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + /* + * "http://libosinfo.org/test/os/features/basic/1 has one two features set + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/basic/1", + 2); + + /* + * http://libosinfo.org/test/os/features/removed/1 derives-from + * http://libosinfo.org/test/os/features/basic/1 ... + * And the one feature is marked as removed + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/1", + 1); + + /* + * http://libosinfo.org/test/os/features/removed/2 derives-from + * http://libosinfo.org/test/os/features/removed/1 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/2", + 1); + + /* + * http://libosinfo.org/test/os/features/removed/2-clone clones + * http://libosinfo.org/test/os/features/removed/2 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/2-clone", + 1); + + /* + * http://libosinfo.org/test/os/features/removed/3 derives-from + * http://libosinfo.org/test/os/features/removed/2 + * And the feature is not marked as removed anymore + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/3", + 2); + + /* + * http://libosinfo.org/test/os/features/removed/4 derives-from + * http://libosinfo.org/test/os/features/removed/3 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/4", + 2); + + + /* + * http://libosinfo.org/test/os/features/removed/4-clone clones + * http://libosinfo.org/test/os/features/removed/4 + */ + features_inheritance_removal_check_features(db, + "http://libosinfo.org/test/os/features/removed/4-clone", + 2); + + g_object_unref(db); +} + + static void check_resources(OsinfoDb *db, const gchar *os_id, @@ -1036,6 +1129,8 @@ main(int argc, char *argv[]) g_test_add_func("/os/features", test_features); g_test_add_func("/os/features/inheritance/basic", test_features_inheritance_basic); + g_test_add_func("/os/features/inheritance/removal", + test_features_inheritance_removal); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:46 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:46 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 11/12] os: Add osinfo_os_is_feature_supported() In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-12-fidencio@redhat.com> This is a helper function that apps can take advantage of in orther to easily figure out whether some feature is supported by the os or not. Signed-off-by: Fabiano Fid?ncio --- osinfo/libosinfo.syms | 2 ++ osinfo/osinfo_os.c | 31 +++++++++++++++++++++++++++++++ osinfo/osinfo_os.h | 1 + 3 files changed, 34 insertions(+) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 99a7843..4a3d5cd 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -570,6 +570,8 @@ LIBOSINFO_1.3.0 { osinfo_os_get_image_list; osinfo_os_get_maximum_resources; + osinfo_os_is_feature_supported; + osinfo_tree_has_treeinfo; } LIBOSINFO_0.2.13; diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index c29ffd2..9d24a64 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -693,6 +693,37 @@ void osinfo_os_add_feature(OsinfoOs *os, OsinfoFeature *feature) osinfo_list_add(OSINFO_LIST(os->priv->features), OSINFO_ENTITY(feature)); } +/** + * osinfo_os_is_feature_supported: + * @os: an operating system + * @arch: the target architecture + * @name: the feature's name + * + * Returns whether the named feature is supported or not by @os on @arch + * + * Returns: TRUE if the named feature is supported. Otherwise, FALSE. + */ +gboolean osinfo_os_is_feature_supported(OsinfoOs *os, + const gchar *name, + const gchar *arch) +{ + OsinfoFeatureList *list; + gboolean supports = FALSE; + + g_return_val_if_fail(OSINFO_IS_OS(os), FALSE); + g_return_val_if_fail(arch != NULL, FALSE); + g_return_val_if_fail(name != NULL, FALSE); + + list = osinfo_os_get_feature_list(os, arch); + + if (feature_exists_in_list(name, OSINFO_LIST(list))) + supports = TRUE; + + g_object_unref(list); + + return supports; +} + /** * osinfo_os_get_family: * @os: an #OsinfoOs diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h index 6ea825d..19c31ce 100644 --- a/osinfo/osinfo_os.h +++ b/osinfo/osinfo_os.h @@ -140,6 +140,7 @@ void osinfo_os_add_device_driver(OsinfoOs *os, OsinfoDeviceDriver *driver); OsinfoFeatureList *osinfo_os_get_feature_list(OsinfoOs *os, const gchar *arch); void osinfo_os_add_feature(OsinfoOs *os, OsinfoFeature *feature); +gboolean osinfo_os_is_feature_supported(OsinfoOs *os, const gchar *name, const gchar *arch); #endif /* __OSINFO_OS_H__ */ /* -- 2.19.2 From fidencio at redhat.com Fri Jan 18 12:30:47 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Fri, 18 Jan 2019 13:30:47 +0100 Subject: [Libosinfo] [libosinfo PATCH v3 12/12] test-os: Add test_features_supported() In-Reply-To: <20190118123047.31007-1-fidencio@redhat.com> References: <20190118123047.31007-1-fidencio@redhat.com> Message-ID: <20190118123047.31007-13-fidencio@redhat.com> Signed-off-by: Fabiano Fid?ncio --- .../test-os-features-supported.xml | 21 ++++++++++++++++ tests/test-os.c | 25 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/dbdata/os/libosinfo.org/test-os-features-supported.xml diff --git a/tests/dbdata/os/libosinfo.org/test-os-features-supported.xml b/tests/dbdata/os/libosinfo.org/test-os-features-supported.xml new file mode 100644 index 0000000..b044f93 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-features-supported.xml @@ -0,0 +1,21 @@ + + + + features-basic-1 + Features Basic 1 + libosinfo.org + test + + + cpu-hotplug + + + + hyperv-relaxed + + + + cpu-hotplug + + + diff --git a/tests/test-os.c b/tests/test-os.c index 0aa6715..49994f5 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -88,6 +88,30 @@ test_features(void) } +static void +test_features_supported(void) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + OsinfoOs *os; + GError *error = NULL; + + osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error); + g_assert_no_error(error); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + os = osinfo_db_get_os(db, "http://libosinfo.org/test/os/features/supported"); + g_assert(OSINFO_IS_OS(os)); + + g_assert_true(osinfo_os_is_feature_supported(os, "cpu-hotplug", "x86_64")); + g_assert_false(osinfo_os_is_feature_supported(os, "cpu-hotplug", "i686")); + g_assert_true(osinfo_os_is_feature_supported(os, "hyperv-relaxed", "x86_64")); + + g_object_unref(db); +} + + static void test_loader(void) { @@ -1127,6 +1151,7 @@ main(int argc, char *argv[]) g_test_add_func("/os/devices/inheritance/removal", test_devices_inheritance_removal); g_test_add_func("/os/features", test_features); + g_test_add_func("/os/features/supported", test_features_supported); g_test_add_func("/os/features/inheritance/basic", test_features_inheritance_basic); g_test_add_func("/os/features/inheritance/removal", -- 2.19.2 From fidencio at redhat.com Mon Jan 21 14:22:06 2019 From: fidencio at redhat.com (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Mon, 21 Jan 2019 15:22:06 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db Message-ID: People, I'd like to start a discussion here as this topic is not as simple as it looks like. My first idea would be to have something like: ... But Daniel raised the following points: - *every* guest OS wants an RTC timer, the only question is whether its better to have it synced UTC or locatime; - "tickpolicy" may not actually be portable across hypervisors; Now, I'm stuck on how to properly represent those and I'd like to have some feedback on the following suggestion: - Create a osinfo-db/data/timer/{qemu.org,xen.org,...} and add there the supported timers for which platform and add the following timers: hpet, kvmclock, pit, rtc, tsc and hypervclock. - Once we have those timers added, we'd have to add them to the specific platforms: - According to https://libvirt.org/formatdomain.html, we have the following list: - hpet: libxl, xen, qemu - kvmclock: qemu - pit: qemu - rtc: qemu - tsc: libxl - hypervclock: qemu (since 1.2.2) - And, finally, add those to the OSes; There are still a few questions that I have: - Do we treat "libxl" as "xen" on osinfo-db side or is "libxl" something that has to be added to the platforms? - Shall we care about "timezone" or "variable" possible clock offsets? - Are the clock offsets something that's portable across the platforms? Or, IOW, would be good enough to just have the allowed values as a choice and deal with that in the schema? - What would be a reasonable representation for the timers? Something like ... hpet x86_64 catchup - In case, it's totally wrong, why? What would be a different way to go? This seems like a *bunch* of work to be done, but if this is the way to go, well, this will be the path taken. Best Regards, -- Fabiano Fid?ncio From msivak at redhat.com Mon Jan 21 15:15:44 2019 From: msivak at redhat.com (Martin Sivak) Date: Mon, 21 Jan 2019 16:15:44 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: Message-ID: Hi, Couple of points: - do we already handle hypervisor and rachitecture differences elsewhere in libosinfo? (it might affect RAM sizes as well for example) - a timer might be supported in more than one hypervisor (your timer example does not express that) - the tickpolicy setting is not a property of a timer only, but depends on the guestos as well So if your timers (and devices, features in general) support hypervisor support fields (supported-by-hv="xen,qemu") and/or architecture support (supported-by-arch="x86_64,i386,ppc") then you could express timers in the same way as devices and let the guest os reference the timer device with catchup policy defined: Example (might not be the best form for XML or the db): hpet x86_64 // The same element repeated with disjunct supported-by attributes (matrix) catchup,delay catchup,delay,merge Martin On Mon, Jan 21, 2019 at 3:22 PM Fabiano Fid?ncio wrote: > > People, > > I'd like to start a discussion here as this topic is not as simple as > it looks like. > > My first idea would be to have something like: > > > tickpolicy="catchup|delay|discard|merge" arch="aarch64|x86_64|..." > supported="true|false"/> > ... > > > > But Daniel raised the following points: > - *every* guest OS wants an RTC timer, the only question is whether > its better to have it synced UTC or locatime; > - "tickpolicy" may not actually be portable across hypervisors; > > Now, I'm stuck on how to properly represent those and I'd like to have > some feedback on the following suggestion: > - Create a osinfo-db/data/timer/{qemu.org,xen.org,...} and add there > the supported timers for which platform and add the following timers: > hpet, kvmclock, pit, rtc, tsc and hypervclock. > > - Once we have those timers added, we'd have to add them to the > specific platforms: > - According to https://libvirt.org/formatdomain.html, we have the > following list: > - hpet: libxl, xen, qemu > - kvmclock: qemu > - pit: qemu > - rtc: qemu > - tsc: libxl > - hypervclock: qemu (since 1.2.2) > > - And, finally, add those to the OSes; > > There are still a few questions that I have: > - Do we treat "libxl" as "xen" on osinfo-db side or is "libxl" > something that has to be added to the platforms? > - Shall we care about "timezone" or "variable" possible clock offsets? > - Are the clock offsets something that's portable across the > platforms? Or, IOW, would be good enough to just have the allowed > values as a choice and deal with that in the schema? > - What would be a reasonable representation for the timers? Something like ... > > hpet > x86_64 > catchup > > - In case, it's totally wrong, why? What would be a different way to go? > > This seems like a *bunch* of work to be done, but if this is the way > to go, well, this will be the path taken. > > Best Regards, > -- > Fabiano Fid?ncio From fabiano at fidencio.org Mon Jan 21 19:23:09 2019 From: fabiano at fidencio.org (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Mon, 21 Jan 2019 20:23:09 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: Message-ID: On Mon, Jan 21, 2019 at 4:42 PM Martin Sivak wrote: > > Hi, > > Couple of points: > - do we already handle hypervisor and rachitecture differences > elsewhere in libosinfo? > (it might affect RAM sizes as well for > example) Devices are, for example, listed by hypervisors. Resources (as RAM), for example, listed by architecture. Something that deal with both at the same time, no (or at least not that I remember). > - a timer might be supported in more than one hypervisor (your timer > example does not express that) Actually, it does. Each timer definition would have to be added to the hypervisor itself (hypervisors are "platforms" for osinfo-db) and my suggestion is: - Define a timer (in the same way a device is defined); - Add the timer definition to the platform; - Add the timer definition to the OS; > - the tickpolicy setting is not a property of a timer only, but > depends on the guestos as well > Hmm. Right. But it's also hypervisor dependent right? So, the tickpolicy is something that we'd have to properly have mapped what's supported on each hypervisor and then what can be used by each guest OS. Right? > So if your timers (and devices, features in general) support > hypervisor support fields (supported-by-hv="xen,qemu") and/or > architecture support (supported-by-arch="x86_64,i386,ppc") then you > could express timers in the same way as devices and let the guest os > reference the timer device with catchup policy defined: > > Example (might not be the best form for XML or the db): > > > hpet > x86_64 > // The same element repeated with disjunct supported-by attributes (matrix) > supported-by-arch="all">catchup,delay > supported-by-arch="x86_64,ppc">catchup,delay,merge > > > > > supported-by-hv="xen"/> > supported-by-hv="kvm"/> > > > Although hat's not the way to go (as, in, having a supported-by field) and this is the most tricky part to have set/defined properly. Dan, any suggestion here? [snip] Best Regards, -- Fabiano Fid?ncio From fabiano at fidencio.org Mon Jan 21 19:40:18 2019 From: fabiano at fidencio.org (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Mon, 21 Jan 2019 20:40:18 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: Message-ID: b On Mon, Jan 21, 2019 at 8:23 PM Fabiano Fid?ncio wrote: > > On Mon, Jan 21, 2019 at 4:42 PM Martin Sivak wrote: > > > > Hi, > > > > Couple of points: > > - do we already handle hypervisor and rachitecture differences > > elsewhere in libosinfo? > > (it might affect RAM sizes as well for > > example) > > Devices are, for example, listed by hypervisors. > Resources (as RAM), for example, listed by architecture. > > Something that deal with both at the same time, no (or at least not > that I remember). > > > - a timer might be supported in more than one hypervisor (your timer > > example does not express that) > > Actually, it does. > Each timer definition would have to be added to the hypervisor itself > (hypervisors are "platforms" for osinfo-db) and my suggestion is: > - Define a timer (in the same way a device is defined); > - Add the timer definition to the platform; > - Add the timer definition to the OS; > > > - the tickpolicy setting is not a property of a timer only, but > > depends on the guestos as well > > > > Hmm. Right. But it's also hypervisor dependent right? > So, the tickpolicy is something that we'd have to properly have mapped > what's supported on each hypervisor and then what can be used by each > guest OS. Right? > > > So if your timers (and devices, features in general) support > > hypervisor support fields (supported-by-hv="xen,qemu") and/or > > architecture support (supported-by-arch="x86_64,i386,ppc") then you > > could express timers in the same way as devices and let the guest os > > reference the timer device with catchup policy defined: > > > > Example (might not be the best form for XML or the db): > > > > > > hpet > > x86_64 > > // The same element repeated with disjunct supported-by attributes (matrix) > > > supported-by-arch="all">catchup,delay > > > supported-by-arch="x86_64,ppc">catchup,delay,merge > > > > > > > > > > > supported-by-hv="xen"/> > > > supported-by-hv="kvm"/> > > > > > > > > Although hat's not the way to go (as, in, having a supported-by field) > and this is the most tricky part to have set/defined properly. Argh. -ENOPARSE here, on my own sentence! What I meant was: That's not the way to go (as, in, having a supported-by field) and this is the most tricky part to have set/defined properly and the main reason I've started this thread. There's one thing here that makes me wonder, Martin, don't you also need to know what's the clock offset to be used? Or, if that's indifferent for kubevirt ... why? (asking based on the example you gave). > > Dan, any suggestion here? > > [snip] > > Best Regards, > -- > Fabiano Fid?ncio -- Fabiano Fid?ncio From msivak at redhat.com Tue Jan 22 09:18:34 2019 From: msivak at redhat.com (Martin Sivak) Date: Tue, 22 Jan 2019 10:18:34 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: Message-ID: > There's one thing here that makes me wonder, Martin, don't you also > need to know what's the clock offset to be used? Or, if that's > indifferent for kubevirt ... why? (asking based on the example you > gave). Well.. to be honest I never saw it used.. so here I just do not know. I would say make it part of the db just in case then. I suppose this will be simple once all the other questions are answered. Martin On Mon, Jan 21, 2019 at 8:40 PM Fabiano Fid?ncio wrote: > > b > > On Mon, Jan 21, 2019 at 8:23 PM Fabiano Fid?ncio wrote: > > > > On Mon, Jan 21, 2019 at 4:42 PM Martin Sivak wrote: > > > > > > Hi, > > > > > > Couple of points: > > > - do we already handle hypervisor and rachitecture differences > > > elsewhere in libosinfo? > > > (it might affect RAM sizes as well for > > > example) > > > > Devices are, for example, listed by hypervisors. > > Resources (as RAM), for example, listed by architecture. > > > > Something that deal with both at the same time, no (or at least not > > that I remember). > > > > > - a timer might be supported in more than one hypervisor (your timer > > > example does not express that) > > > > Actually, it does. > > Each timer definition would have to be added to the hypervisor itself > > (hypervisors are "platforms" for osinfo-db) and my suggestion is: > > - Define a timer (in the same way a device is defined); > > - Add the timer definition to the platform; > > - Add the timer definition to the OS; > > > > > - the tickpolicy setting is not a property of a timer only, but > > > depends on the guestos as well > > > > > > > Hmm. Right. But it's also hypervisor dependent right? > > So, the tickpolicy is something that we'd have to properly have mapped > > what's supported on each hypervisor and then what can be used by each > > guest OS. Right? > > > > > So if your timers (and devices, features in general) support > > > hypervisor support fields (supported-by-hv="xen,qemu") and/or > > > architecture support (supported-by-arch="x86_64,i386,ppc") then you > > > could express timers in the same way as devices and let the guest os > > > reference the timer device with catchup policy defined: > > > > > > Example (might not be the best form for XML or the db): > > > > > > > > > hpet > > > x86_64 > > > // The same element repeated with disjunct supported-by attributes (matrix) > > > > > supported-by-arch="all">catchup,delay > > > > > supported-by-arch="x86_64,ppc">catchup,delay,merge > > > > > > > > > > > > > > > > > supported-by-hv="xen"/> > > > > > supported-by-hv="kvm"/> > > > > > > > > > > > > > Although hat's not the way to go (as, in, having a supported-by field) > > and this is the most tricky part to have set/defined properly. > > Argh. -ENOPARSE here, on my own sentence! > What I meant was: > That's not the way to go (as, in, having a supported-by field) and > this is the most tricky part to have set/defined properly and the main > reason I've started this thread. > > There's one thing here that makes me wonder, Martin, don't you also > need to know what's the clock offset to be used? Or, if that's > indifferent for kubevirt ... why? (asking based on the example you > gave). > > > > > Dan, any suggestion here? > > > > [snip] > > > > Best Regards, > > -- > > Fabiano Fid?ncio > > > > -- > Fabiano Fid?ncio From msivak at redhat.com Tue Jan 22 09:19:48 2019 From: msivak at redhat.com (Martin Sivak) Date: Tue, 22 Jan 2019 10:19:48 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: Message-ID: > Hmm. Right. But it's also hypervisor dependent right? > So, the tickpolicy is something that we'd have to properly have mapped > what's supported on each hypervisor and then what can be used by each > guest OS. Right? Yes, I think so. Martin On Mon, Jan 21, 2019 at 8:23 PM Fabiano Fid?ncio wrote: > > On Mon, Jan 21, 2019 at 4:42 PM Martin Sivak wrote: > > > > Hi, > > > > Couple of points: > > - do we already handle hypervisor and rachitecture differences > > elsewhere in libosinfo? > > (it might affect RAM sizes as well for > > example) > > Devices are, for example, listed by hypervisors. > Resources (as RAM), for example, listed by architecture. > > Something that deal with both at the same time, no (or at least not > that I remember). > > > - a timer might be supported in more than one hypervisor (your timer > > example does not express that) > > Actually, it does. > Each timer definition would have to be added to the hypervisor itself > (hypervisors are "platforms" for osinfo-db) and my suggestion is: > - Define a timer (in the same way a device is defined); > - Add the timer definition to the platform; > - Add the timer definition to the OS; > > > - the tickpolicy setting is not a property of a timer only, but > > depends on the guestos as well > > > > Hmm. Right. But it's also hypervisor dependent right? > So, the tickpolicy is something that we'd have to properly have mapped > what's supported on each hypervisor and then what can be used by each > guest OS. Right? > > > So if your timers (and devices, features in general) support > > hypervisor support fields (supported-by-hv="xen,qemu") and/or > > architecture support (supported-by-arch="x86_64,i386,ppc") then you > > could express timers in the same way as devices and let the guest os > > reference the timer device with catchup policy defined: > > > > Example (might not be the best form for XML or the db): > > > > > > hpet > > x86_64 > > // The same element repeated with disjunct supported-by attributes (matrix) > > > supported-by-arch="all">catchup,delay > > > supported-by-arch="x86_64,ppc">catchup,delay,merge > > > > > > > > > > > supported-by-hv="xen"/> > > > supported-by-hv="kvm"/> > > > > > > > > Although hat's not the way to go (as, in, having a supported-by field) > and this is the most tricky part to have set/defined properly. > > Dan, any suggestion here? > > [snip] > > Best Regards, > -- > Fabiano Fid?ncio From berrange at redhat.com Tue Jan 22 11:14:26 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Tue, 22 Jan 2019 11:14:26 +0000 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: Message-ID: <20190122111426.GF13143@redhat.com> On Mon, Jan 21, 2019 at 03:22:06PM +0100, Fabiano Fid?ncio wrote: > People, > > I'd like to start a discussion here as this topic is not as simple as > it looks like. > > My first idea would be to have something like: > > > tickpolicy="catchup|delay|discard|merge" arch="aarch64|x86_64|..." > supported="true|false"/> > ... > > > > But Daniel raised the following points: > - *every* guest OS wants an RTC timer, the only question is whether > its better to have it synced UTC or locatime; > - "tickpolicy" may not actually be portable across hypervisors; Yeah, this second point is a big concern for me. The only things that are purely about guest OS support are - Whether the RTC should be synced to UTC vs localtime - Whether a particular timer is supported The tickpolicy is very much hypervisor dependent so I don't think that really belongs as a setting against the OS. Unfortunately, without tickpolicy the timers stuff becomes significantly less useful to apps. > Now, I'm stuck on how to properly represent those and I'd like to have > some feedback on the following suggestion: > - Create a osinfo-db/data/timer/{qemu.org,xen.org,...} and add there > the supported timers for which platform and add the following timers: > hpet, kvmclock, pit, rtc, tsc and hypervclock. > > - Once we have those timers added, we'd have to add them to the > specific platforms: > - According to https://libvirt.org/formatdomain.html, we have the > following list: > - hpet: libxl, xen, qemu > - kvmclock: qemu > - pit: qemu > - rtc: qemu > - tsc: libxl > - hypervclock: qemu (since 1.2.2) > > - And, finally, add those to the OSes; > > There are still a few questions that I have: > - Do we treat "libxl" as "xen" on osinfo-db side or is "libxl" > something that has to be added to the platforms? It is "xen" - libxl is a libvirt driver name, "xen" is the hypervisor name. > - Shall we care about "timezone" or "variable" possible clock offsets? Neither of those are relevant. timezone is just a way of saying the guest clock is synced to "localtime", but in a timezone that is diffferent from what the host OS uses. "variable" is a way of expressing the fact that the guest OS has adjusted their clock away from the original sync point. > - Are the clock offsets something that's portable across the > platforms? Or, IOW, would be good enough to just have the allowed > values as a choice and deal with that in the schema? > - What would be a reasonable representation for the timers? Something like ... > > hpet > x86_64 > catchup > > - In case, it's totally wrong, why? What would be a different way to go? "hpet" is not a QEMU invention - it is a standard defined for the x86 architecture, as at the other timers, so using a qemu.org namespace would be wrong. > > This seems like a *bunch* of work to be done, but if this is the way > to go, well, this will be the path taken. My concern with the above is that it feels like we are effectively re-inventing the "profiles" stuff that was previous discussed, but in a way that only works for timers. With both this stuff around timers, and the stuff around features, it feels like we really need the "profiles" concept to deal with the fact that what we're trying to express is tied to a pair of (hypervisor, guest os). Unfortunately we didn't come to an agreement on the profiles design concept yet. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From fidencio at redhat.com Tue Jan 22 11:23:54 2019 From: fidencio at redhat.com (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 12:23:54 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: <20190122111426.GF13143@redhat.com> References: <20190122111426.GF13143@redhat.com> Message-ID: On Tue, Jan 22, 2019 at 12:14 PM Daniel P. Berrang? wrote: > > On Mon, Jan 21, 2019 at 03:22:06PM +0100, Fabiano Fid?ncio wrote: > > People, > > > > I'd like to start a discussion here as this topic is not as simple as > > it looks like. > > > > My first idea would be to have something like: > > > > > > > tickpolicy="catchup|delay|discard|merge" arch="aarch64|x86_64|..." > > supported="true|false"/> > > ... > > > > > > > > But Daniel raised the following points: > > - *every* guest OS wants an RTC timer, the only question is whether > > its better to have it synced UTC or locatime; > > - "tickpolicy" may not actually be portable across hypervisors; > > Yeah, this second point is a big concern for me. > > The only things that are purely about guest OS support are > > - Whether the RTC should be synced to UTC vs localtime > - Whether a particular timer is supported > > The tickpolicy is very much hypervisor dependent so I don't think > that really belongs as a setting against the OS. > > Unfortunately, without tickpolicy the timers stuff becomes > significantly less useful to apps. > > > Now, I'm stuck on how to properly represent those and I'd like to have > > some feedback on the following suggestion: > > - Create a osinfo-db/data/timer/{qemu.org,xen.org,...} and add there > > the supported timers for which platform and add the following timers: > > hpet, kvmclock, pit, rtc, tsc and hypervclock. > > > > - Once we have those timers added, we'd have to add them to the > > specific platforms: > > - According to https://libvirt.org/formatdomain.html, we have the > > following list: > > - hpet: libxl, xen, qemu > > - kvmclock: qemu > > - pit: qemu > > - rtc: qemu > > - tsc: libxl > > - hypervclock: qemu (since 1.2.2) > > > > - And, finally, add those to the OSes; > > > > There are still a few questions that I have: > > - Do we treat "libxl" as "xen" on osinfo-db side or is "libxl" > > something that has to be added to the platforms? > > It is "xen" - libxl is a libvirt driver name, "xen" is the hypervisor > name. > > > - Shall we care about "timezone" or "variable" possible clock offsets? > > Neither of those are relevant. timezone is just a way of saying > the guest clock is synced to "localtime", but in a timezone that > is diffferent from what the host OS uses. "variable" is a way > of expressing the fact that the guest OS has adjusted their > clock away from the original sync point. > > > - Are the clock offsets something that's portable across the > > platforms? Or, IOW, would be good enough to just have the allowed > > values as a choice and deal with that in the schema? > > - What would be a reasonable representation for the timers? Something like ... > > > > hpet > > x86_64 > > catchup > > > > - In case, it's totally wrong, why? What would be a different way to go? > > "hpet" is not a QEMU invention - it is a standard defined for the > x86 architecture, as at the other timers, so using a qemu.org > namespace would be wrong. > > > > > This seems like a *bunch* of work to be done, but if this is the way > > to go, well, this will be the path taken. > > My concern with the above is that it feels like we are effectively > re-inventing the "profiles" stuff that was previous discussed, but > in a way that only works for timers. > > With both this stuff around timers, and the stuff around features, > it feels like we really need the "profiles" concept to deal with > the fact that what we're trying to express is tied to a pair of > (hypervisor, guest os). > > Unfortunately we didn't come to an agreement on the profiles > design concept yet. Okay, so we should: - Do not review Features series - Do not move forward with the Timers series - Get back to the Profiles discussion (Fabian, Martin, your feedback there is more than appreciated ... it's actually needed!) - Revisit Features/Timers after having a clear idea about the Profiles work started by Martin Kletzander. Does that sound like a deal? Best Regards, -- Fabiano Fid?ncio From berrange at redhat.com Tue Jan 22 11:28:48 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Tue, 22 Jan 2019 11:28:48 +0000 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: <20190122111426.GF13143@redhat.com> Message-ID: <20190122112848.GH13143@redhat.com> On Tue, Jan 22, 2019 at 12:23:54PM +0100, Fabiano Fid?ncio wrote: > On Tue, Jan 22, 2019 at 12:14 PM Daniel P. Berrang? wrote: > > > > On Mon, Jan 21, 2019 at 03:22:06PM +0100, Fabiano Fid?ncio wrote: > > > People, > > > > > > I'd like to start a discussion here as this topic is not as simple as > > > it looks like. > > > > > > My first idea would be to have something like: > > > > > > > > > > > tickpolicy="catchup|delay|discard|merge" arch="aarch64|x86_64|..." > > > supported="true|false"/> > > > ... > > > > > > > > > > > > But Daniel raised the following points: > > > - *every* guest OS wants an RTC timer, the only question is whether > > > its better to have it synced UTC or locatime; > > > - "tickpolicy" may not actually be portable across hypervisors; > > > > Yeah, this second point is a big concern for me. > > > > The only things that are purely about guest OS support are > > > > - Whether the RTC should be synced to UTC vs localtime > > - Whether a particular timer is supported > > > > The tickpolicy is very much hypervisor dependent so I don't think > > that really belongs as a setting against the OS. > > > > Unfortunately, without tickpolicy the timers stuff becomes > > significantly less useful to apps. > > > > > Now, I'm stuck on how to properly represent those and I'd like to have > > > some feedback on the following suggestion: > > > - Create a osinfo-db/data/timer/{qemu.org,xen.org,...} and add there > > > the supported timers for which platform and add the following timers: > > > hpet, kvmclock, pit, rtc, tsc and hypervclock. > > > > > > - Once we have those timers added, we'd have to add them to the > > > specific platforms: > > > - According to https://libvirt.org/formatdomain.html, we have the > > > following list: > > > - hpet: libxl, xen, qemu > > > - kvmclock: qemu > > > - pit: qemu > > > - rtc: qemu > > > - tsc: libxl > > > - hypervclock: qemu (since 1.2.2) > > > > > > - And, finally, add those to the OSes; > > > > > > There are still a few questions that I have: > > > - Do we treat "libxl" as "xen" on osinfo-db side or is "libxl" > > > something that has to be added to the platforms? > > > > It is "xen" - libxl is a libvirt driver name, "xen" is the hypervisor > > name. > > > > > - Shall we care about "timezone" or "variable" possible clock offsets? > > > > Neither of those are relevant. timezone is just a way of saying > > the guest clock is synced to "localtime", but in a timezone that > > is diffferent from what the host OS uses. "variable" is a way > > of expressing the fact that the guest OS has adjusted their > > clock away from the original sync point. > > > > > - Are the clock offsets something that's portable across the > > > platforms? Or, IOW, would be good enough to just have the allowed > > > values as a choice and deal with that in the schema? > > > - What would be a reasonable representation for the timers? Something like ... > > > > > > hpet > > > x86_64 > > > catchup > > > > > > - In case, it's totally wrong, why? What would be a different way to go? > > > > "hpet" is not a QEMU invention - it is a standard defined for the > > x86 architecture, as at the other timers, so using a qemu.org > > namespace would be wrong. > > > > > > > > This seems like a *bunch* of work to be done, but if this is the way > > > to go, well, this will be the path taken. > > > > My concern with the above is that it feels like we are effectively > > re-inventing the "profiles" stuff that was previous discussed, but > > in a way that only works for timers. > > > > With both this stuff around timers, and the stuff around features, > > it feels like we really need the "profiles" concept to deal with > > the fact that what we're trying to express is tied to a pair of > > (hypervisor, guest os). > > > > Unfortunately we didn't come to an agreement on the profiles > > design concept yet. > > Okay, so we should: > - Do not review Features series > - Do not move forward with the Timers series > - Get back to the Profiles discussion (Fabian, Martin, your feedback > there is more than appreciated ... it's actually needed!) > - Revisit Features/Timers after having a clear idea about the Profiles > work started by Martin Kletzander. > > Does that sound like a deal? Yeah, I think so. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From msivak at redhat.com Tue Jan 22 13:56:44 2019 From: msivak at redhat.com (Martin Sivak) Date: Tue, 22 Jan 2019 14:56:44 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: <20190122111426.GF13143@redhat.com> Message-ID: > - Revisit Features/Timers after having a clear idea about the Profiles > work started by Martin Kletzander. > > Does that sound like a deal? Except the workload profiles are trying to solve a different thing there (application specific needs on top of guest OS). Pure libOSinfo is about what a guest OS supports and what the application _independent_ defaults for the guest OS should be. And the timers are mostly that (at least RHV always used them like that). The features we want are 100% that and have definitely nothing to do with workload profiles. Some of that information is architecture dependent though but libosinfo apparently knows how to handle this aspect already. Hypervisor feature support has also nothing to do with workload profiles and maybe we need a separate database for hypervisor features :) For those reasons I would gently ask to keep those discussions separate as both hypervisor and workload definitions are specific to integrator, environment and product (downstream RHV has its own qemu with extra patches for example). Best regards Martin Sivak On Tue, Jan 22, 2019 at 12:24 PM Fabiano Fid?ncio wrote: > > On Tue, Jan 22, 2019 at 12:14 PM Daniel P. Berrang? wrote: > > > > On Mon, Jan 21, 2019 at 03:22:06PM +0100, Fabiano Fid?ncio wrote: > > > People, > > > > > > I'd like to start a discussion here as this topic is not as simple as > > > it looks like. > > > > > > My first idea would be to have something like: > > > > > > > > > > > tickpolicy="catchup|delay|discard|merge" arch="aarch64|x86_64|..." > > > supported="true|false"/> > > > ... > > > > > > > > > > > > But Daniel raised the following points: > > > - *every* guest OS wants an RTC timer, the only question is whether > > > its better to have it synced UTC or locatime; > > > - "tickpolicy" may not actually be portable across hypervisors; > > > > Yeah, this second point is a big concern for me. > > > > The only things that are purely about guest OS support are > > > > - Whether the RTC should be synced to UTC vs localtime > > - Whether a particular timer is supported > > > > The tickpolicy is very much hypervisor dependent so I don't think > > that really belongs as a setting against the OS. > > > > Unfortunately, without tickpolicy the timers stuff becomes > > significantly less useful to apps. > > > > > Now, I'm stuck on how to properly represent those and I'd like to have > > > some feedback on the following suggestion: > > > - Create a osinfo-db/data/timer/{qemu.org,xen.org,...} and add there > > > the supported timers for which platform and add the following timers: > > > hpet, kvmclock, pit, rtc, tsc and hypervclock. > > > > > > - Once we have those timers added, we'd have to add them to the > > > specific platforms: > > > - According to https://libvirt.org/formatdomain.html, we have the > > > following list: > > > - hpet: libxl, xen, qemu > > > - kvmclock: qemu > > > - pit: qemu > > > - rtc: qemu > > > - tsc: libxl > > > - hypervclock: qemu (since 1.2.2) > > > > > > - And, finally, add those to the OSes; > > > > > > There are still a few questions that I have: > > > - Do we treat "libxl" as "xen" on osinfo-db side or is "libxl" > > > something that has to be added to the platforms? > > > > It is "xen" - libxl is a libvirt driver name, "xen" is the hypervisor > > name. > > > > > - Shall we care about "timezone" or "variable" possible clock offsets? > > > > Neither of those are relevant. timezone is just a way of saying > > the guest clock is synced to "localtime", but in a timezone that > > is diffferent from what the host OS uses. "variable" is a way > > of expressing the fact that the guest OS has adjusted their > > clock away from the original sync point. > > > > > - Are the clock offsets something that's portable across the > > > platforms? Or, IOW, would be good enough to just have the allowed > > > values as a choice and deal with that in the schema? > > > - What would be a reasonable representation for the timers? Something like ... > > > > > > hpet > > > x86_64 > > > catchup > > > > > > - In case, it's totally wrong, why? What would be a different way to go? > > > > "hpet" is not a QEMU invention - it is a standard defined for the > > x86 architecture, as at the other timers, so using a qemu.org > > namespace would be wrong. > > > > > > > > This seems like a *bunch* of work to be done, but if this is the way > > > to go, well, this will be the path taken. > > > > My concern with the above is that it feels like we are effectively > > re-inventing the "profiles" stuff that was previous discussed, but > > in a way that only works for timers. > > > > With both this stuff around timers, and the stuff around features, > > it feels like we really need the "profiles" concept to deal with > > the fact that what we're trying to express is tied to a pair of > > (hypervisor, guest os). > > > > Unfortunately we didn't come to an agreement on the profiles > > design concept yet. > > Okay, so we should: > - Do not review Features series > - Do not move forward with the Timers series > - Get back to the Profiles discussion (Fabian, Martin, your feedback > there is more than appreciated ... it's actually needed!) > - Revisit Features/Timers after having a clear idea about the Profiles > work started by Martin Kletzander. > > Does that sound like a deal? > Best Regards, > -- > Fabiano Fid?ncio From berrange at redhat.com Tue Jan 22 14:07:47 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Tue, 22 Jan 2019 14:07:47 +0000 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: <20190122111426.GF13143@redhat.com> Message-ID: <20190122140747.GM13143@redhat.com> On Tue, Jan 22, 2019 at 02:56:44PM +0100, Martin Sivak wrote: > > - Revisit Features/Timers after having a clear idea about the Profiles > > work started by Martin Kletzander. > > > > Does that sound like a deal? > > Except the workload profiles are trying to solve a different thing > there (application specific needs on top of guest OS). > > Pure libOSinfo is about what a guest OS supports and what the > application _independent_ defaults for the guest OS should be. And the > timers are mostly that (at least RHV always used them like that). The > features we want are 100% that and have definitely nothing to do with > workload profiles. Some of that information is architecture dependent > though but libosinfo apparently knows how to handle this aspect > already. > > Hypervisor feature support has also nothing to do with workload > profiles and maybe we need a separate database for hypervisor features > :) > > For those reasons I would gently ask to keep those discussions > separate as both hypervisor and workload definitions are specific to > integrator, environment and product (downstream RHV has its own qemu > with extra patches for example). My view on what profiles are for differs from this. In particular I do *not* consider the profiles to be application specific. The core rationale for libosinfo existing is to have information that is shared by all applications managing VMs. Data that is application specific should be maintained by the application in whatever manner it wants - application specific data is not in scope for libosinfo. I consider profiles to be a way of expressing the best practice recommendations for configuring a virtual machine to satisfy some declared scenario. This covers data that is specific to a hypervisor, or a (guest,hypervisor) pairing, potentially taking into account goals for runtime performance, as well as other aspects that might be relevant. A particular application may have particular scenarios it wants covered by profiles, but that doesn't mean the profiles are application specific or restricted to only care about "workload", Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From msivak at redhat.com Tue Jan 22 14:16:26 2019 From: msivak at redhat.com (Martin Sivak) Date: Tue, 22 Jan 2019 15:16:26 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: <20190122140747.GM13143@redhat.com> References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> Message-ID: > My view on what profiles are for differs from this. In particular > I do *not* consider the profiles to be application specific. Oh, I think we are talking about different applications. I agree all management products (the applications you talk about) should use the same data. But workload profiles are about guest application specific needs (the apps I talk about) and pure osinfo is about guest application independent guest os defaults. Here the application means the app running within the VM. Martin On Tue, Jan 22, 2019 at 3:08 PM Daniel P. Berrang? wrote: > > On Tue, Jan 22, 2019 at 02:56:44PM +0100, Martin Sivak wrote: > > > - Revisit Features/Timers after having a clear idea about the Profiles > > > work started by Martin Kletzander. > > > > > > Does that sound like a deal? > > > > Except the workload profiles are trying to solve a different thing > > there (application specific needs on top of guest OS). > > > > Pure libOSinfo is about what a guest OS supports and what the > > application _independent_ defaults for the guest OS should be. And the > > timers are mostly that (at least RHV always used them like that). The > > features we want are 100% that and have definitely nothing to do with > > workload profiles. Some of that information is architecture dependent > > though but libosinfo apparently knows how to handle this aspect > > already. > > > > Hypervisor feature support has also nothing to do with workload > > profiles and maybe we need a separate database for hypervisor features > > :) > > > > For those reasons I would gently ask to keep those discussions > > separate as both hypervisor and workload definitions are specific to > > integrator, environment and product (downstream RHV has its own qemu > > with extra patches for example). > > My view on what profiles are for differs from this. In particular > I do *not* consider the profiles to be application specific. The > core rationale for libosinfo existing is to have information that > is shared by all applications managing VMs. Data that is application > specific should be maintained by the application in whatever manner > it wants - application specific data is not in scope for libosinfo. > > I consider profiles to be a way of expressing the best practice > recommendations for configuring a virtual machine to satisfy some > declared scenario. This covers data that is specific to a hypervisor, > or a (guest,hypervisor) pairing, potentially taking into account > goals for runtime performance, as well as other aspects that might > be relevant. A particular application may have particular scenarios > it wants covered by profiles, but that doesn't mean the profiles > are application specific or restricted to only care about "workload", > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From msivak at redhat.com Tue Jan 22 14:19:26 2019 From: msivak at redhat.com (Martin Sivak) Date: Tue, 22 Jan 2019 15:19:26 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: <20190122140747.GM13143@redhat.com> References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> Message-ID: Hi, > I consider profiles to be a way of expressing the best practice > recommendations for configuring a virtual machine to satisfy some > declared scenario. I agree here. > This covers data that is specific to a hypervisor, > or a (guest,hypervisor) pairing, > potentially taking into account > goals for runtime performance, as well as other aspects that might > be relevant. But not here. At least not completely. Some configuration is not just best practice recommendation, but a crucial and (almost-)mandatory setting that will make the VM work properly regardless of the scenario. And that kind of information should go into osinfo. Martin On Tue, Jan 22, 2019 at 3:08 PM Daniel P. Berrang? wrote: > > On Tue, Jan 22, 2019 at 02:56:44PM +0100, Martin Sivak wrote: > > > - Revisit Features/Timers after having a clear idea about the Profiles > > > work started by Martin Kletzander. > > > > > > Does that sound like a deal? > > > > Except the workload profiles are trying to solve a different thing > > there (application specific needs on top of guest OS). > > > > Pure libOSinfo is about what a guest OS supports and what the > > application _independent_ defaults for the guest OS should be. And the > > timers are mostly that (at least RHV always used them like that). The > > features we want are 100% that and have definitely nothing to do with > > workload profiles. Some of that information is architecture dependent > > though but libosinfo apparently knows how to handle this aspect > > already. > > > > Hypervisor feature support has also nothing to do with workload > > profiles and maybe we need a separate database for hypervisor features > > :) > > > > For those reasons I would gently ask to keep those discussions > > separate as both hypervisor and workload definitions are specific to > > integrator, environment and product (downstream RHV has its own qemu > > with extra patches for example). > > My view on what profiles are for differs from this. In particular > I do *not* consider the profiles to be application specific. The > core rationale for libosinfo existing is to have information that > is shared by all applications managing VMs. Data that is application > specific should be maintained by the application in whatever manner > it wants - application specific data is not in scope for libosinfo. > > I consider profiles to be a way of expressing the best practice > recommendations for configuring a virtual machine to satisfy some > declared scenario. This covers data that is specific to a hypervisor, > or a (guest,hypervisor) pairing, potentially taking into account > goals for runtime performance, as well as other aspects that might > be relevant. A particular application may have particular scenarios > it wants covered by profiles, but that doesn't mean the profiles > are application specific or restricted to only care about "workload", > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Tue Jan 22 14:23:19 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Tue, 22 Jan 2019 14:23:19 +0000 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> Message-ID: <20190122142319.GP13143@redhat.com> On Tue, Jan 22, 2019 at 03:19:26PM +0100, Martin Sivak wrote: > Hi, > > > I consider profiles to be a way of expressing the best practice > > recommendations for configuring a virtual machine to satisfy some > > declared scenario. > > I agree here. > > > This covers data that is specific to a hypervisor, > > or a (guest,hypervisor) pairing, > > potentially taking into account > > goals for runtime performance, as well as other aspects that might > > be relevant. > > But not here. At least not completely. Some configuration is not just > best practice recommendation, but a crucial and (almost-)mandatory > setting that will make the VM work properly regardless of the > scenario. And that kind of information should go into osinfo. I don't think we're in disagreement actually. When I said "best practice" I do in fact consider it to cover stuff that may be any of "nice to have", "strongly recommended" or "crucial / mandatory". Even if we call it "mandatory" we can't force applicaitons to actually use the data we provide in the profile. We can though say "its your fault" if the guest doesn't behave optimally if the app ignores the profiles. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Tue Jan 22 14:26:16 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Tue, 22 Jan 2019 14:26:16 +0000 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> Message-ID: <20190122142616.GQ13143@redhat.com> On Tue, Jan 22, 2019 at 03:16:26PM +0100, Martin Sivak wrote: > > My view on what profiles are for differs from this. In particular > > I do *not* consider the profiles to be application specific. > > Oh, I think we are talking about different applications. > > I agree all management products (the applications you talk about) > should use the same data. > > But workload profiles are about guest application specific needs (the > apps I talk about) and pure osinfo is about guest application > independent guest os defaults. Here the application means the app > running within the VM. Ok, that's not neccessarily a problem. The set of profiles will be extensible in the normal manner by adding new XML files. So we can have some profiles that are generic best practice for the guest + hypervisor combination. Those can be used as a starting point for any person/app who wishes to define further profiles that taken into account specific guest applications. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From msivak at redhat.com Tue Jan 22 14:54:17 2019 From: msivak at redhat.com (Martin Sivak) Date: Tue, 22 Jan 2019 15:54:17 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: <20190122142616.GQ13143@redhat.com> References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> <20190122142616.GQ13143@redhat.com> Message-ID: > So we can > have some profiles that are generic best practice for the guest + > hypervisor combination. I probably still do not understand where is the line between osinfo a profiles then. What you are talking about (hypervisor + guest OS) seems to me to belong to osinfo. Profiles we asked Martin for (as the primary request was probably driven from us at the beginning) were really ment to be used for workload specific settings on top or in combination with osinfo (io-intensive, SAP HANA, OracleDB, ...). Martin On Tue, Jan 22, 2019 at 3:26 PM Daniel P. Berrang? wrote: > > On Tue, Jan 22, 2019 at 03:16:26PM +0100, Martin Sivak wrote: > > > My view on what profiles are for differs from this. In particular > > > I do *not* consider the profiles to be application specific. > > > > Oh, I think we are talking about different applications. > > > > I agree all management products (the applications you talk about) > > should use the same data. > > > > But workload profiles are about guest application specific needs (the > > apps I talk about) and pure osinfo is about guest application > > independent guest os defaults. Here the application means the app > > running within the VM. > > Ok, that's not neccessarily a problem. The set of profiles will be > extensible in the normal manner by adding new XML files. So we can > have some profiles that are generic best practice for the guest + > hypervisor combination. Those can be used as a starting point for > any person/app who wishes to define further profiles that taken into > account specific guest applications. > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Tue Jan 22 15:17:36 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Tue, 22 Jan 2019 15:17:36 +0000 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> <20190122142616.GQ13143@redhat.com> Message-ID: <20190122151736.GV13143@redhat.com> On Tue, Jan 22, 2019 at 03:54:17PM +0100, Martin Sivak wrote: > > So we can > > have some profiles that are generic best practice for the guest + > > hypervisor combination. > > I probably still do not understand where is the line between osinfo a > profiles then. What you are talking about (hypervisor + guest OS) > seems to me to belong to osinfo. > > Profiles we asked Martin for (as the primary request was probably > driven from us at the beginning) were really ment to be used for > workload specific settings on top or in combination with osinfo > (io-intensive, SAP HANA, OracleDB, ...). Traditionally lots of logic around how to build a libvirt domain XML to configure a guest according to best practice for a given deployment scenario was embedded in applications as code. This was always undesirable since it caused logic duplication across mgmt apps. Libosinfo dealt with a small piece of this by allowing optimal virtual devices to be identified via the DB. Long ago there was an abortive attempt to address the more general problem of writing XML via an set of APIS (libvirt-designer + libvirt-builder). This failed as a concept for various reasons, not least that doing it via an API is quite inflexible. The logic that apps hardcoded for configuring a guest OS XML was usually aiming at an design that was "general purpose" good enough for any workload, but not optimal for every workload. Apps could have added app specific logic to optimize for SAP, Oracle, etc but that just makes the existing problem of hardcoded logic even worse. Having a concept of OS profiles in libosinfo is intended to address the problem of apps all harcoding rules for building XML configs in the general case. By providing such a feature we could reduce the amount of harcoded logic in applications, and by extension this will also make it trivial to provide profiles that are optimized for specific applications, alongside the general purpose guest OS profile. IOW there should not be any distinction between the way we deal with a general purpose profile for a guest OS, from the way we deal with an SAP or Oracle optimized profile for a guest OS. I would consider it a big failure if we had different ways to handle the general purpose config vs the application optimized config. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From msivak at redhat.com Tue Jan 22 15:52:59 2019 From: msivak at redhat.com (Martin Sivak) Date: Tue, 22 Jan 2019 16:52:59 +0100 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: <20190122151736.GV13143@redhat.com> References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> <20190122142616.GQ13143@redhat.com> <20190122151736.GV13143@redhat.com> Message-ID: > IOW there should not be any distinction between the way we deal > with a general purpose profile for a guest OS, from the way we > deal with an SAP or Oracle optimized profile for a guest OS. I > would consider it a big failure if we had different ways to > handle the general purpose config vs the application optimized > config. The issue here is in maintenance. Either you maintain the full matrix of profiles or you have to deal with conflicts between what guest OS, application and hypervisor all allow. Also some of the configuration logic depends on hypervisor, libvirt and kernel and product versions you will not be able to express. Some device might be working according to the database, but the product owners (RHV, CNV, ..) might decide to not use it for support reasons (legal, too many bugs, integration issues..). So the product specific (as opposed to generic) application profile can be based on more than just generally available hard requirements data. What we are after are the pure data right now as we have to prepare custom templates anyway. Neither CNV nor oVirt for example use pure libvirt XML. Both add additional information needed for the whole ecosystem to work properly. Martin On Tue, Jan 22, 2019 at 4:17 PM Daniel P. Berrang? wrote: > > On Tue, Jan 22, 2019 at 03:54:17PM +0100, Martin Sivak wrote: > > > So we can > > > have some profiles that are generic best practice for the guest + > > > hypervisor combination. > > > > I probably still do not understand where is the line between osinfo a > > profiles then. What you are talking about (hypervisor + guest OS) > > seems to me to belong to osinfo. > > > > Profiles we asked Martin for (as the primary request was probably > > driven from us at the beginning) were really ment to be used for > > workload specific settings on top or in combination with osinfo > > (io-intensive, SAP HANA, OracleDB, ...). > > Traditionally lots of logic around how to build a libvirt domain XML > to configure a guest according to best practice for a given deployment > scenario was embedded in applications as code. This was always > undesirable since it caused logic duplication across mgmt apps. > > Libosinfo dealt with a small piece of this by allowing optimal > virtual devices to be identified via the DB. > > Long ago there was an abortive attempt to address the more general > problem of writing XML via an set of APIS (libvirt-designer + > libvirt-builder). This failed as a concept for various reasons, not > least that doing it via an API is quite inflexible. > > The logic that apps hardcoded for configuring a guest OS XML was > usually aiming at an design that was "general purpose" good enough > for any workload, but not optimal for every workload. Apps could > have added app specific logic to optimize for SAP, Oracle, etc > but that just makes the existing problem of hardcoded logic even > worse. > > Having a concept of OS profiles in libosinfo is intended to address > the problem of apps all harcoding rules for building XML configs > in the general case. By providing such a feature we could reduce > the amount of harcoded logic in applications, and by extension this > will also make it trivial to provide profiles that are optimized > for specific applications, alongside the general purpose guest > OS profile. > > IOW there should not be any distinction between the way we deal > with a general purpose profile for a guest OS, from the way we > deal with an SAP or Oracle optimized profile for a guest OS. I > would consider it a big failure if we had different ways to > handle the general purpose config vs the application optimized > config. > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Tue Jan 22 16:07:13 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Tue, 22 Jan 2019 16:07:13 +0000 Subject: [Libosinfo] RFC: Add clock/timers info in osinfo-db In-Reply-To: References: <20190122111426.GF13143@redhat.com> <20190122140747.GM13143@redhat.com> <20190122142616.GQ13143@redhat.com> <20190122151736.GV13143@redhat.com> Message-ID: <20190122160713.GY13143@redhat.com> On Tue, Jan 22, 2019 at 04:52:59PM +0100, Martin Sivak wrote: > > IOW there should not be any distinction between the way we deal > > with a general purpose profile for a guest OS, from the way we > > deal with an SAP or Oracle optimized profile for a guest OS. I > > would consider it a big failure if we had different ways to > > handle the general purpose config vs the application optimized > > config. > > The issue here is in maintenance. Either you maintain the full matrix > of profiles or you have to deal with conflicts between what guest OS, > application and hypervisor all allow. Also some of the configuration > logic depends on hypervisor, libvirt and kernel and product versions > you will not be able to express. Some device might be working > according to the database, but the product owners (RHV, CNV, ..) might > decide to not use it for support reasons (legal, too many bugs, > integration issues..). So the product specific (as opposed to generic) > application profile can be based on more than just generally available > hard requirements data. I don't think any of that really matters from libosinfo's POV. We're just defining a way to record & retrieve profile information. Apps are free to ignore profiles they don't wish to support, or they can drop in extra DB XML files to augment an existing profile, or blackout a profile, or to define new profiles just for their own usage. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From fabiano at fidencio.org Tue Jan 22 19:28:09 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:09 +0100 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 00/12] Add network-install resources + maximum resources fixes Message-ID: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> This series adds a bunch of fixes for the maximum resources series plus the new network-install resources that are intended to be used to express (mainly) the amount of RAM OSes will need in order to perform a network installation. osinfo-db: Fabiano Fid?ncio (1): schema: Add network-install resources data/schema/osinfo.rng.in | 5 +++++ 1 file changed, 5 insertions(+) libosinfo: Fabiano Fid?ncio (10): os: Fix typos in resources methods os: Remove extra line from _get_recommended_resources() os: Group get_*_resources() together os: Make get_maximum_resources() aware of inheritance loader: Fix typo when loading maximum resources test-os: Fix typo in resources tests os: Deal with network-install resources loader: Deal with network-install resources os: Make get_resources_*_without_inheritance() static test-os: Add basic test for resources osinfo/Makefile.am | 1 - osinfo/libosinfo.syms | 2 + osinfo/osinfo_loader.c | 10 +++- osinfo/osinfo_os.c | 134 +++++++++++++++++++++++++++++++++++---------- osinfo/osinfo_os.h | 2 + osinfo/osinfo_os_private.h | 39 ------------- tests/test-os.c | 55 ++++++++++++++++++- 7 files changed, 171 insertions(+), 72 deletions(-) delete mode 100644 osinfo/osinfo_os_private.h -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:11 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:11 +0100 Subject: [Libosinfo] [libosinfo PATCH 02/11] os: Fix typos in resources methods In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-3-git-send-email-fabiano@fidencio.org> methos -> method *private! -> *private*! Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 01d2e01..da37cd4 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -883,7 +883,7 @@ OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os) * * Get the list of recommended resources for the operating system @os. * - * Mind that this methos is *private! + * Mind that this method is *private*! * * Returns: (transfer full): A list of resources */ -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:10 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:10 +0100 Subject: [Libosinfo] [osinfo-db PATCH 01/11] schema: Add network-install resources In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-2-git-send-email-fabiano@fidencio.org> Signed-off-by: Fabiano Fid?ncio --- 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 3a42ac8..5e6f5e7 100644 --- a/data/schema/osinfo.rng.in +++ b/data/schema/osinfo.rng.in @@ -299,6 +299,11 @@ + + + + + -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:13 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:13 +0100 Subject: [Libosinfo] [libosinfo PATCH 04/11] os: Group get_*_resources() together In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-5-git-send-email-fabiano@fidencio.org> Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_os.c | 65 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 86e726f..c396565 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -741,28 +741,6 @@ void osinfo_os_add_variant(OsinfoOs *os, OsinfoOsVariant *variant) osinfo_list_add(OSINFO_LIST(os->priv->variants), OSINFO_ENTITY(variant)); } -/** - * osinfo_os_get_minimum_resources_without_inheritance: - * @os: an operating system - * - * Get the list of minimum required resources for the operating system @os. - * - * Mind that this method is *private*! - * - * Returns: (transfer full): A list of resources - */ -OsinfoResourcesList * -osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os) -{ - g_return_val_if_fail(OSINFO_IS_OS(os), NULL); - - OsinfoResourcesList *newList = osinfo_resourceslist_new(); - - osinfo_list_add_all(OSINFO_LIST(newList), OSINFO_LIST(os->priv->minimum)); - - return newList; -} - struct GetAllResourcesData { OsinfoOs *os; OsinfoResourcesList *resourceslist; @@ -862,6 +840,27 @@ osinfo_os_get_resources_internal(OsinfoOs *os, return foreach_data.resourceslist; } +/** + * osinfo_os_get_minimum_resources_without_inheritance: + * @os: an operating system + * + * Get the list of minimum required resources for the operating system @os. + * + * Mind that this method is *private*! + * + * Returns: (transfer full): A list of resources + */ +OsinfoResourcesList * +osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os) +{ + g_return_val_if_fail(OSINFO_IS_OS(os), NULL); + + OsinfoResourcesList *newList = osinfo_resourceslist_new(); + + osinfo_list_add_all(OSINFO_LIST(newList), OSINFO_LIST(os->priv->minimum)); + + return newList; +} /** * osinfo_os_get_minimum_resources: @@ -878,44 +877,44 @@ OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os) } /** - * osinfo_os_get_recommended_resources_without_inheritance: + * osinfo_os_get_maximum_resources: * @os: an operating system * - * Get the list of recommended resources for the operating system @os. - * - * Mind that this method is *private*! + * Get the list of maximum resources for the operating system @os. * * Returns: (transfer full): A list of resources */ -OsinfoResourcesList * -osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os) +OsinfoResourcesList *osinfo_os_get_maximum_resources(OsinfoOs *os) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); OsinfoResourcesList *newList = osinfo_resourceslist_new(); osinfo_list_add_all(OSINFO_LIST(newList), - OSINFO_LIST(os->priv->recommended)); + OSINFO_LIST(os->priv->maximum)); return newList; } /** - * osinfo_os_get_maximum_resources: + * osinfo_os_get_recommended_resources_without_inheritance: * @os: an operating system * - * Get the list of maximum resources for the operating system @os. + * Get the list of recommended resources for the operating system @os. + * + * Mind that this method is *private*! * * Returns: (transfer full): A list of resources */ -OsinfoResourcesList *osinfo_os_get_maximum_resources(OsinfoOs *os) +OsinfoResourcesList * +osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); OsinfoResourcesList *newList = osinfo_resourceslist_new(); osinfo_list_add_all(OSINFO_LIST(newList), - OSINFO_LIST(os->priv->maximum)); + OSINFO_LIST(os->priv->recommended)); return newList; } -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:15 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:15 +0100 Subject: [Libosinfo] [libosinfo PATCH 06/11] loader: Fix typo when loading maximum resources In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-7-git-send-email-fabiano@fidencio.org> osinfo_os_add_recommended_resources -> osinfo_os_add_maximum_resources Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index 8f7b2bf..9c2a757 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -1391,7 +1391,7 @@ static void osinfo_loader_resources_list(OsinfoLoader *loader, goto EXIT; if (resources != NULL) - osinfo_os_add_recommended_resources(os, resources); + osinfo_os_add_maximum_resources(os, resources); EXIT: g_clear_object(&resources); -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:12 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:12 +0100 Subject: [Libosinfo] [libosinfo PATCH 03/11] os: Remove extra line from _get_recommended_resources() In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-4-git-send-email-fabiano@fidencio.org> Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_os.c | 1 - 1 file changed, 1 deletion(-) diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index da37cd4..86e726f 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -932,7 +932,6 @@ OsinfoResourcesList *osinfo_os_get_recommended_resources(OsinfoOs *os) { return osinfo_os_get_resources_internal (os, osinfo_os_get_recommended_resources_without_inheritance); - } /** -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:14 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:14 +0100 Subject: [Libosinfo] [libosinfo PATCH 05/11] os: Make get_maximum_resources() aware of inheritance In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-6-git-send-email-fabiano@fidencio.org> Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_os.c | 21 +++++++++++++++++++-- osinfo/osinfo_os_private.h | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index c396565..0e3bb3c 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -877,14 +877,17 @@ OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os) } /** - * osinfo_os_get_maximum_resources: + * osinfo_os_get_maximum_resources_without_inheritance: * @os: an operating system * * Get the list of maximum resources for the operating system @os. * + * Mind that this method is *private*! + * * Returns: (transfer full): A list of resources */ -OsinfoResourcesList *osinfo_os_get_maximum_resources(OsinfoOs *os) +OsinfoResourcesList * +osinfo_os_get_maximum_resources_without_inheritance(OsinfoOs *os) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); @@ -897,6 +900,20 @@ OsinfoResourcesList *osinfo_os_get_maximum_resources(OsinfoOs *os) } /** + * osinfo_os_get_maximum_resources: + * @os: an operating system + * + * Get the list of maximum resources for the operating system @os. + * + * Returns: (transfer full): A list of resources + */ +OsinfoResourcesList *osinfo_os_get_maximum_resources(OsinfoOs *os) +{ + return osinfo_os_get_resources_internal + (os, osinfo_os_get_maximum_resources_without_inheritance); +} + +/** * osinfo_os_get_recommended_resources_without_inheritance: * @os: an operating system * diff --git a/osinfo/osinfo_os_private.h b/osinfo/osinfo_os_private.h index d8a13b2..3b0e2ce 100644 --- a/osinfo/osinfo_os_private.h +++ b/osinfo/osinfo_os_private.h @@ -28,6 +28,7 @@ OsinfoResourcesList *osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os); OsinfoResourcesList *osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os); +OsinfoResourcesList *osinfo_os_get_maximum_resources_without_inheritance(OsinfoOs *os); #endif /* __OSINFO_OS_PRIVATE_H__ */ /* -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:17 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:17 +0100 Subject: [Libosinfo] [libosinfo PATCH 08/11] os: Deal with network-install resources In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-9-git-send-email-fabiano@fidencio.org> network-install resources represent the resources to be used during a network installation. It may differs from the minimum resources as the network installers (not only the medias, but the trees) may download a huge amount of data to the RAM* consuming way more than the minimum or recommended RAM for the OS. *: anaconda downloads the whole stage2 of the installer into the RAM in order to perform a network installation. Signed-off-by: Fabiano Fid?ncio --- osinfo/libosinfo.syms | 2 ++ osinfo/osinfo_os.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ osinfo/osinfo_os.h | 2 ++ osinfo/osinfo_os_private.h | 1 + 4 files changed, 65 insertions(+) diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 56cf9a5..2a60689 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -553,9 +553,11 @@ LIBOSINFO_1.3.0 { osinfo_os_add_image; osinfo_os_add_maximum_resources; + osinfo_os_add_network_install_resources; osinfo_os_get_all_device_links; osinfo_os_get_image_list; osinfo_os_get_maximum_resources; + osinfo_os_get_network_install_resources; osinfo_tree_has_treeinfo; } LIBOSINFO_0.2.13; diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 0e3bb3c..73ad3a3 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -56,6 +56,7 @@ struct _OsinfoOsPrivate OsinfoTreeList *trees; OsinfoImageList *images; OsinfoOsVariantList *variants; + OsinfoResourcesList *network_install; OsinfoResourcesList *minimum; OsinfoResourcesList *recommended; OsinfoResourcesList *maximum; @@ -116,6 +117,7 @@ osinfo_os_finalize(GObject *object) g_object_unref(os->priv->trees); g_object_unref(os->priv->images); g_object_unref(os->priv->variants); + g_object_unref(os->priv->network_install); g_object_unref(os->priv->minimum); g_object_unref(os->priv->recommended); g_object_unref(os->priv->maximum); @@ -183,6 +185,7 @@ osinfo_os_init(OsinfoOs *os) os->priv->trees = osinfo_treelist_new(); os->priv->images = osinfo_imagelist_new(); os->priv->variants = osinfo_os_variantlist_new(); + os->priv->network_install = osinfo_resourceslist_new(); os->priv->minimum = osinfo_resourceslist_new(); os->priv->recommended = osinfo_resourceslist_new(); os->priv->maximum = osinfo_resourceslist_new(); @@ -951,6 +954,45 @@ OsinfoResourcesList *osinfo_os_get_recommended_resources(OsinfoOs *os) } /** + * osinfo_os_get_network_install_resources_without_inheritance: + * @os: an operating system + * + * Get the list of resources needed for network installing an operating system + * @os. + * + * Mind that this method is *private*! + * + * Returns: (transfer full): A list of resources + */ +OsinfoResourcesList * +osinfo_os_get_network_install_resources_without_inheritance(OsinfoOs *os) +{ + g_return_val_if_fail(OSINFO_IS_OS(os), NULL); + + OsinfoResourcesList *newList = osinfo_resourceslist_new(); + + osinfo_list_add_all(OSINFO_LIST(newList), + OSINFO_LIST(os->priv->network_install)); + + return newList; +} + +/** + * osinfo_os_get_network_install_resources: + * @os: an operating system + * + * Get the list of resources needed for network installing an operating system + * @os. + * + * Returns: (transfer full): A list of resources + */ +OsinfoResourcesList *osinfo_os_get_network_install_resources(OsinfoOs *os) +{ + return osinfo_os_get_resources_internal + (os, osinfo_os_get_network_install_resources_without_inheritance); +} + +/** * osinfo_os_add_minimum_resources: * @os: an operating system * @resources: (transfer none): the resources to add @@ -1000,6 +1042,24 @@ void osinfo_os_add_maximum_resources(OsinfoOs *os, } /** + * osinfo_os_add_network_install_resources: + * @os: an operating system + * @resources: (transfer none): the resources to add + * + * Adds @resources to list of resources needed for network installing an + * operating system @os. + */ +void osinfo_os_add_network_install_resources(OsinfoOs *os, + OsinfoResources *resources) +{ + g_return_if_fail(OSINFO_IS_OS(os)); + g_return_if_fail(OSINFO_IS_RESOURCES(resources)); + + osinfo_list_add(OSINFO_LIST(os->priv->network_install), + OSINFO_ENTITY(resources)); +} + +/** * osinfo_os_find_install_script: * @os: an operating system * @profile: the install script profile that must be either diff --git a/osinfo/osinfo_os.h b/osinfo/osinfo_os.h index 4eb4b1b..5e677e1 100644 --- a/osinfo/osinfo_os.h +++ b/osinfo/osinfo_os.h @@ -123,9 +123,11 @@ OsinfoImageList *osinfo_os_get_image_list(OsinfoOs *os); void osinfo_os_add_image(OsinfoOs *os, OsinfoImage *image); OsinfoOsVariantList *osinfo_os_get_variant_list(OsinfoOs *os); void osinfo_os_add_variant(OsinfoOs *os, OsinfoOsVariant *variant); +OsinfoResourcesList *osinfo_os_get_network_install_resources(OsinfoOs *os); OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os); OsinfoResourcesList *osinfo_os_get_recommended_resources(OsinfoOs *os); OsinfoResourcesList *osinfo_os_get_maximum_resources(OsinfoOs *os); +void osinfo_os_add_network_install_resources(OsinfoOs *os, OsinfoResources *resources); void osinfo_os_add_minimum_resources(OsinfoOs *os, OsinfoResources *resources); void osinfo_os_add_recommended_resources(OsinfoOs *os, OsinfoResources *resources); void osinfo_os_add_maximum_resources(OsinfoOs *os, OsinfoResources *resources); diff --git a/osinfo/osinfo_os_private.h b/osinfo/osinfo_os_private.h index 3b0e2ce..b4df87d 100644 --- a/osinfo/osinfo_os_private.h +++ b/osinfo/osinfo_os_private.h @@ -26,6 +26,7 @@ #ifndef __OSINFO_OS_PRIVATE_H__ #define __OSINFO_OS_PRIVATE_H__ +OsinfoResourcesList *osinfo_os_get_network_install_resources_without_inheritance(OsinfoOs *os); OsinfoResourcesList *osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os); OsinfoResourcesList *osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os); OsinfoResourcesList *osinfo_os_get_maximum_resources_without_inheritance(OsinfoOs *os); -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:18 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:18 +0100 Subject: [Libosinfo] [libosinfo PATCH 09/11] loader: Deal with network-install resources In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-10-git-send-email-fabiano@fidencio.org> Signed-off-by: Fabiano Fid?ncio --- osinfo/osinfo_loader.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index 9c2a757..a6f111c 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -1393,6 +1393,14 @@ static void osinfo_loader_resources_list(OsinfoLoader *loader, if (resources != NULL) osinfo_os_add_maximum_resources(os, resources); + g_clear_object(&resources); + resources = osinfo_loader_resources(loader, ctxt, root, id, "network-install", err); + if (error_is_set(err)) + goto EXIT; + + if (resources != NULL) + osinfo_os_add_network_install_resources(os, resources); + EXIT: g_clear_object(&resources); } -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:16 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:16 +0100 Subject: [Libosinfo] [libosinfo PATCH 07/11] test-os: Fix typo in resources tests In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-8-git-send-email-fabiano@fidencio.org> osinfo_os_get_recommended_resources -> osinfo_os_get_maximum_resources Signed-off-by: Fabiano Fid?ncio --- tests/test-os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-os.c b/tests/test-os.c index 45598bb..1c13c56 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -334,7 +334,7 @@ test_resources_minimum_recommended_maximum(void) minimum_list = osinfo_os_get_minimum_resources(os); recommended_list = osinfo_os_get_recommended_resources(os); - maximum_list = osinfo_os_get_recommended_resources(os); + maximum_list = osinfo_os_get_maximum_resources(os); if (osinfo_list_get_length(OSINFO_LIST(minimum_list)) > 0 && osinfo_list_get_length(OSINFO_LIST(recommended_list)) > 0) -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:19 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:19 +0100 Subject: [Libosinfo] [libosinfo PATCH 10/11] os: Make get_resources_*_without_inheritance() static In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-11-git-send-email-fabiano@fidencio.org> With that we can get rid of osinfo_os_private.h Signed-off-by: Fabiano Fid?ncio --- osinfo/Makefile.am | 1 - osinfo/osinfo_os.c | 9 ++++----- osinfo/osinfo_os_private.h | 41 ----------------------------------------- 3 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 osinfo/osinfo_os_private.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index b43e32b..cb1df8f 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -161,7 +161,6 @@ libosinfo_private_header_files = \ osinfo_product_private.h \ osinfo_media_private.h \ osinfo_resources_private.h \ - osinfo_os_private.h \ ignore-value.h \ $(NULL) diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c index 73ad3a3..cb28767 100644 --- a/osinfo/osinfo_os.c +++ b/osinfo/osinfo_os.c @@ -27,7 +27,6 @@ #include #include "osinfo_media_private.h" #include "osinfo/osinfo_product_private.h" -#include "osinfo/osinfo_os_private.h" #include "osinfo/osinfo_resources_private.h" #include @@ -853,7 +852,7 @@ osinfo_os_get_resources_internal(OsinfoOs *os, * * Returns: (transfer full): A list of resources */ -OsinfoResourcesList * +static OsinfoResourcesList * osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); @@ -889,7 +888,7 @@ OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os) * * Returns: (transfer full): A list of resources */ -OsinfoResourcesList * +static OsinfoResourcesList * osinfo_os_get_maximum_resources_without_inheritance(OsinfoOs *os) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); @@ -926,7 +925,7 @@ OsinfoResourcesList *osinfo_os_get_maximum_resources(OsinfoOs *os) * * Returns: (transfer full): A list of resources */ -OsinfoResourcesList * +static OsinfoResourcesList * osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); @@ -964,7 +963,7 @@ OsinfoResourcesList *osinfo_os_get_recommended_resources(OsinfoOs *os) * * Returns: (transfer full): A list of resources */ -OsinfoResourcesList * +static OsinfoResourcesList * osinfo_os_get_network_install_resources_without_inheritance(OsinfoOs *os) { g_return_val_if_fail(OSINFO_IS_OS(os), NULL); diff --git a/osinfo/osinfo_os_private.h b/osinfo/osinfo_os_private.h deleted file mode 100644 index b4df87d..0000000 --- a/osinfo/osinfo_os_private.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * libosinfo: an operating system - * - * Copyright (C) 2018 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * . - * - * Authors: - * Fabiano Fid?ncio - */ - -#include - -#ifndef __OSINFO_OS_PRIVATE_H__ -#define __OSINFO_OS_PRIVATE_H__ - -OsinfoResourcesList *osinfo_os_get_network_install_resources_without_inheritance(OsinfoOs *os); -OsinfoResourcesList *osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os); -OsinfoResourcesList *osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os); -OsinfoResourcesList *osinfo_os_get_maximum_resources_without_inheritance(OsinfoOs *os); - -#endif /* __OSINFO_OS_PRIVATE_H__ */ -/* - * Local variables: - * indent-tabs-mode: nil - * c-indent-level: 4 - * c-basic-offset: 4 - * End: - */ -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 19:28:20 2019 From: fabiano at fidencio.org (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 20:28:20 +0100 Subject: [Libosinfo] [libosinfo PATCH 11/11] test-os: Add basic test for resources In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: <1548185300-21614-12-git-send-email-fabiano@fidencio.org> This test only ensures that libosinfo is able to properly load the resource info from an OS entry. Signed-off-by: Fabiano Fid?ncio --- tests/test-os.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/test-os.c b/tests/test-os.c index 1c13c56..f4e758d 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -218,6 +218,58 @@ test_device_driver(void) } +static void test_resources_basic(void) +{ + OsinfoLoader *loader = osinfo_loader_new(); + OsinfoDb *db; + OsinfoOs *os; + OsinfoResourcesList *resources_list; + OsinfoResources *resources; + GError *error = NULL; + + osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error); + g_assert_no_error(error); + db = g_object_ref(osinfo_loader_get_db(loader)); + g_object_unref(loader); + + os = osinfo_db_get_os(db, "http://libosinfo.org/test/os/resources/basic"); + + resources_list = osinfo_os_get_minimum_resources(os); + resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 1); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 1); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 1); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 1); + + g_clear_object(&resources_list); + resources_list = osinfo_os_get_recommended_resources(os); + resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 2); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 2); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 2); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 2); + + g_clear_object(&resources_list); + resources_list = osinfo_os_get_maximum_resources(os); + resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 3); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 3); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 3); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 3); + + g_clear_object(&resources_list); + resources_list = osinfo_os_get_network_install_resources(os); + resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 4); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 4); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 4); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 4); + + g_object_unref(resources_list); + g_object_unref(db); +} + + static void test_n_cpus(OsinfoResources *resources1, OsinfoResources *resources2) { gint resources1_cpus, resources2_cpus; @@ -947,6 +999,7 @@ main(int argc, char *argv[]) test_devices_inheritance_basic); g_test_add_func("/os/devices/inheritance/removal", test_devices_inheritance_removal); + g_test_add_func("/os/resources/basic", test_resources_basic); g_test_add_func("/os/resources/minimum_recommended_maximum", test_resources_minimum_recommended_maximum); g_test_add_func("/os/resources/uniqueness", test_resources_uniqueness); -- 1.8.3.1 From fabiano at fidencio.org Tue Jan 22 21:05:33 2019 From: fabiano at fidencio.org (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Tue, 22 Jan 2019 22:05:33 +0100 Subject: [Libosinfo] [osinfo-db/libosinfo PATCH 00/12] Add network-install resources + maximum resources fixes In-Reply-To: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> Message-ID: On Tue, Jan 22, 2019 at 8:28 PM Fabiano Fid?ncio wrote: > > This series adds a bunch of fixes for the maximum resources series plus > the new network-install resources that are intended to be used to express > (mainly) the amount of RAM OSes will need in order to perform a network > installation. > > osinfo-db: > Fabiano Fid?ncio (1): > schema: Add network-install resources > > data/schema/osinfo.rng.in | 5 +++++ > 1 file changed, 5 insertions(+) > > libosinfo: > Fabiano Fid?ncio (10): > os: Fix typos in resources methods > os: Remove extra line from _get_recommended_resources() > os: Group get_*_resources() together > os: Make get_maximum_resources() aware of inheritance > loader: Fix typo when loading maximum resources > test-os: Fix typo in resources tests > os: Deal with network-install resources > loader: Deal with network-install resources > os: Make get_resources_*_without_inheritance() static > test-os: Add basic test for resources > > osinfo/Makefile.am | 1 - > osinfo/libosinfo.syms | 2 + > osinfo/osinfo_loader.c | 10 +++- > osinfo/osinfo_os.c | 134 +++++++++++++++++++++++++++++++++++---------- > osinfo/osinfo_os.h | 2 + > osinfo/osinfo_os_private.h | 39 ------------- > tests/test-os.c | 55 ++++++++++++++++++- > 7 files changed, 171 insertions(+), 72 deletions(-) > delete mode 100644 osinfo/osinfo_os_private.h > > -- > 1.8.3.1 > Argh, the subject should say 00/11. There's only 11 patches in the end, no patch is missing. -- Fabiano Fid?ncio From fidencio at redhat.com Wed Jan 23 17:11:27 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Wed, 23 Jan 2019 18:11:27 +0100 Subject: [Libosinfo] [libosinfo PATCH] tools: Remove a reference to fedorahosted.org Message-ID: <20190123171127.18271-1-fidencio@redhat.com> Although it's just the id used for the install script, let's remove the reference to the already sunset fedorahosted.org and just use "https://libosinfo.org/config" as the id. Signed-off-by: Fabiano Fid?ncio --- tools/osinfo-install-script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c index 6ef0cc0..81552a4 100644 --- a/tools/osinfo-install-script.c +++ b/tools/osinfo-install-script.c @@ -315,7 +315,7 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); - config = osinfo_install_config_new("http://libosinfo.fedorahosted.org/config"); + config = osinfo_install_config_new("https://libosinfo.org/config"); context = g_option_context_new(_("- Generate an OS install script")); g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); -- 2.19.2 From berrange at redhat.com Thu Jan 24 13:18:21 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:18:21 +0000 Subject: [Libosinfo] [osinfo-db PATCH 01/11] schema: Add network-install resources In-Reply-To: <1548185300-21614-2-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-2-git-send-email-fabiano@fidencio.org> Message-ID: <20190124131821.GF7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:10PM +0100, Fabiano Fid?ncio wrote: > Signed-off-by: Fabiano Fid?ncio > --- > data/schema/osinfo.rng.in | 5 +++++ > 1 file changed, 5 insertions(+) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:21:30 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:21:30 +0000 Subject: [Libosinfo] [libosinfo PATCH 02/11] os: Fix typos in resources methods In-Reply-To: <1548185300-21614-3-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-3-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132130.GG7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:11PM +0100, Fabiano Fid?ncio wrote: > methos -> method > *private! -> *private*! > > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_os.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:21:46 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:21:46 +0000 Subject: [Libosinfo] [libosinfo PATCH 03/11] os: Remove extra line from _get_recommended_resources() In-Reply-To: <1548185300-21614-4-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-4-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132146.GH7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:12PM +0100, Fabiano Fid?ncio wrote: > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_os.c | 1 - > 1 file changed, 1 deletion(-) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:22:20 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:22:20 +0000 Subject: [Libosinfo] [libosinfo PATCH 04/11] os: Group get_*_resources() together In-Reply-To: <1548185300-21614-5-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-5-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132220.GI7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:13PM +0100, Fabiano Fid?ncio wrote: > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_os.c | 65 +++++++++++++++++++++++++++--------------------------- > 1 file changed, 32 insertions(+), 33 deletions(-) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:22:56 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:22:56 +0000 Subject: [Libosinfo] [libosinfo PATCH 05/11] os: Make get_maximum_resources() aware of inheritance In-Reply-To: <1548185300-21614-6-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-6-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132256.GJ7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:14PM +0100, Fabiano Fid?ncio wrote: > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_os.c | 21 +++++++++++++++++++-- > osinfo/osinfo_os_private.h | 1 + > 2 files changed, 20 insertions(+), 2 deletions(-) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:25:05 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:25:05 +0000 Subject: [Libosinfo] [libosinfo PATCH 06/11] loader: Fix typo when loading maximum resources In-Reply-To: <1548185300-21614-7-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-7-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132505.GK7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:15PM +0100, Fabiano Fid?ncio wrote: > osinfo_os_add_recommended_resources -> osinfo_os_add_maximum_resources > > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_loader.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:25:33 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:25:33 +0000 Subject: [Libosinfo] [libosinfo PATCH 07/11] test-os: Fix typo in resources tests In-Reply-To: <1548185300-21614-8-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-8-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132533.GL7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:16PM +0100, Fabiano Fid?ncio wrote: > osinfo_os_get_recommended_resources -> osinfo_os_get_maximum_resources > > Signed-off-by: Fabiano Fid?ncio > --- > tests/test-os.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:27:28 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:27:28 +0000 Subject: [Libosinfo] [libosinfo PATCH 08/11] os: Deal with network-install resources In-Reply-To: <1548185300-21614-9-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-9-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132728.GM7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:17PM +0100, Fabiano Fid?ncio wrote: > network-install resources represent the resources to be used during a > network installation. It may differs from the minimum resources as the > network installers (not only the medias, but the trees) may download a > huge amount of data to the RAM* consuming way more than the minimum or > recommended RAM for the OS. > > *: anaconda downloads the whole stage2 of the installer into the RAM in > order to perform a network installation. > > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/libosinfo.syms | 2 ++ > osinfo/osinfo_os.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ > osinfo/osinfo_os.h | 2 ++ > osinfo/osinfo_os_private.h | 1 + > 4 files changed, 65 insertions(+) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:28:07 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:28:07 +0000 Subject: [Libosinfo] [libosinfo PATCH 09/11] loader: Deal with network-install resources In-Reply-To: <1548185300-21614-10-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-10-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132807.GN7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:18PM +0100, Fabiano Fid?ncio wrote: > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/osinfo_loader.c | 8 ++++++++ > 1 file changed, 8 insertions(+) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:28:53 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:28:53 +0000 Subject: [Libosinfo] [libosinfo PATCH 10/11] os: Make get_resources_*_without_inheritance() static In-Reply-To: <1548185300-21614-11-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-11-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132853.GO7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:19PM +0100, Fabiano Fid?ncio wrote: > With that we can get rid of osinfo_os_private.h > > Signed-off-by: Fabiano Fid?ncio > --- > osinfo/Makefile.am | 1 - > osinfo/osinfo_os.c | 9 ++++----- > osinfo/osinfo_os_private.h | 41 ----------------------------------------- > 3 files changed, 4 insertions(+), 47 deletions(-) > delete mode 100644 osinfo/osinfo_os_private.h Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:29:31 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:29:31 +0000 Subject: [Libosinfo] [libosinfo PATCH 11/11] test-os: Add basic test for resources In-Reply-To: <1548185300-21614-12-git-send-email-fabiano@fidencio.org> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-12-git-send-email-fabiano@fidencio.org> Message-ID: <20190124132931.GP7953@redhat.com> On Tue, Jan 22, 2019 at 08:28:20PM +0100, Fabiano Fid?ncio wrote: > This test only ensures that libosinfo is able to properly load the > resource info from an OS entry. > > Signed-off-by: Fabiano Fid?ncio > --- > tests/test-os.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 53 insertions(+) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From berrange at redhat.com Thu Jan 24 13:29:57 2019 From: berrange at redhat.com (Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?=) Date: Thu, 24 Jan 2019 13:29:57 +0000 Subject: [Libosinfo] [libosinfo PATCH] tools: Remove a reference to fedorahosted.org In-Reply-To: <20190123171127.18271-1-fidencio@redhat.com> References: <20190123171127.18271-1-fidencio@redhat.com> Message-ID: <20190124132957.GQ7953@redhat.com> On Wed, Jan 23, 2019 at 06:11:27PM +0100, Fabiano Fid?ncio wrote: > Although it's just the id used for the install script, let's remove the > reference to the already sunset fedorahosted.org and just use > "https://libosinfo.org/config" as the id. > > Signed-off-by: Fabiano Fid?ncio > --- > tools/osinfo-install-script.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Daniel P. Berrang? Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From fidencio at redhat.com Thu Jan 24 13:46:38 2019 From: fidencio at redhat.com (Fabiano =?ISO-8859-1?Q?Fid=EAncio?=) Date: Thu, 24 Jan 2019 14:46:38 +0100 Subject: [Libosinfo] [libosinfo PATCH 11/11] test-os: Add basic test for resources In-Reply-To: <20190124132931.GP7953@redhat.com> References: <1548185300-21614-1-git-send-email-fabiano@fidencio.org> <1548185300-21614-12-git-send-email-fabiano@fidencio.org> <20190124132931.GP7953@redhat.com> Message-ID: <9085c9dd17b935178a6839d79e3fc92db62646e7.camel@redhat.com> On Thu, 2019-01-24 at 13:29 +0000, Daniel P. Berrang? wrote: > On Tue, Jan 22, 2019 at 08:28:20PM +0100, Fabiano Fid?ncio wrote: > > This test only ensures that libosinfo is able to properly load the > > resource info from an OS entry. > > > > Signed-off-by: Fabiano Fid?ncio > > --- > > tests/test-os.c | 53 > > +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 53 insertions(+) > > Reviewed-by: Daniel P. Berrang? Ouch, I've just noticed that I forgot to add the new xml for this test when I sent the patch. diff --git a/tests/dbdata/os/libosinfo.org/test-os-resources-basic.xml b/tests/dbdata/os/libosinfo.org/test-os-resources-basic.xml new file mode 100644 index 0000000..65f6fb2 --- /dev/null +++ b/tests/dbdata/os/libosinfo.org/test-os-resources-basic.xml @@ -0,0 +1,37 @@ + + + + resourcesbasic + Resources Basic + libosinfo.org + test + + + + 1 + 1 + 1 + 1 + + + 2 + 2 + 2 + 2 + + + 3 + 3 + 3 + 3 + + + 4 + 4 + 4 + 4 + + + + + It's going to be pushed as part of this commit as well. From fidencio at redhat.com Thu Jan 24 14:14:17 2019 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 24 Jan 2019 15:14:17 +0100 Subject: [Libosinfo] [libosinfo PATCH] test-os: Fix make syntax-check Message-ID: <20190124141417.29485-1-fidencio@redhat.com> While applying the last patches a few trailing whitespaces have been introduced, making `make syntax-check` fail. Signed-off-by: Fabiano Fid?ncio --- Pushed under 'fix breakage' rule! --- tests/test-os.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/test-os.c b/tests/test-os.c index f4e758d..178bd15 100644 --- a/tests/test-os.c +++ b/tests/test-os.c @@ -236,34 +236,34 @@ static void test_resources_basic(void) resources_list = osinfo_os_get_minimum_resources(os); resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); - g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 1); - g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 1); - g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 1); - g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 1); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 1); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 1); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 1); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 1); g_clear_object(&resources_list); resources_list = osinfo_os_get_recommended_resources(os); resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); - g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 2); - g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 2); - g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 2); - g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 2); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 2); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 2); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 2); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 2); g_clear_object(&resources_list); resources_list = osinfo_os_get_maximum_resources(os); resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); - g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 3); - g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 3); - g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 3); - g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 3); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 3); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 3); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 3); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 3); g_clear_object(&resources_list); resources_list = osinfo_os_get_network_install_resources(os); resources = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(resources_list), 0)); - g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 4); - g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 4); - g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 4); - g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 4); + g_assert_cmpint(osinfo_resources_get_n_cpus(resources), ==, 4); + g_assert_cmpint(osinfo_resources_get_cpu(resources), ==, 4); + g_assert_cmpint(osinfo_resources_get_ram(resources), ==, 4); + g_assert_cmpint(osinfo_resources_get_storage(resources), ==, 4); g_object_unref(resources_list); g_object_unref(db); -- 2.19.2 From mkletzan at redhat.com Wed Jan 30 11:22:14 2019 From: mkletzan at redhat.com (Martin Kletzander) Date: Wed, 30 Jan 2019 12:22:14 +0100 Subject: [Libosinfo] [osinfo-db PATCH 3/3] workload: Example for particular use case - SAP HANA In-Reply-To: <20181120155919.GW25047@redhat.com> References: <20181120155919.GW25047@redhat.com> Message-ID: <20190130112214.GB20964@wheatley> On Tue, Nov 20, 2018 at 03:59:19PM +0000, Daniel P. Berrang? wrote: >On Sat, Nov 17, 2018 at 01:06:13AM +0100, Martin Kletzander wrote: >> This is an example of what information workloads should ultimately express. >> This is not a comprehensive definition of what SAP HANA needs for functioning, >> just a few things I dug out from the web. But it contains various types of >> settings that might be useful for workloads. For example the hugepage size as >> that is not something which is definite, the optimal size varies on the >> workload. >> >> Signed-off-by: Martin Kletzander >> --- >> data/workload/example.com/sap-hana.xml.in | 29 +++++++++++++++++++++++ >> 1 file changed, 29 insertions(+) >> create mode 100644 data/workload/example.com/sap-hana.xml.in >> Sorry for not following up on this. As I'm mostly a middle man here and we are still missing assessment of the actual "customers" (mgmt apps developers) to know what is worth going for and what would be a waste of time. Since I have more important manners to attend to, I had to abandon this pursuit. Thank you for the reviews and thoughts on this. If anyone in the future would like to continue in this effort, I believe there is enough information here to know how to continue. Have a nice day, Martin -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: