[virt-tools-list] [libosinfo 2/6] Add Resources class

Daniel P. Berrange berrange at redhat.com
Wed Sep 14 12:52:03 UTC 2011


On Sat, Sep 10, 2011 at 03:05:00AM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> Add a new class to represent resource requirements/recommendations for OSs.
> ---
>  docs/reference/Libosinfo-sections.txt |   22 ++++
>  osinfo/Makefile.am                    |    4 +-
>  osinfo/libosinfo.syms                 |    7 +
>  osinfo/osinfo.h                       |    1 +
>  osinfo/osinfo_resources.c             |  196 +++++++++++++++++++++++++++++++++
>  osinfo/osinfo_resources.h             |  101 +++++++++++++++++
>  6 files changed, 330 insertions(+), 1 deletions(-)
>  create mode 100644 osinfo/osinfo_resources.c
>  create mode 100644 osinfo/osinfo_resources.h

As a general comment, I wonder if we really need this one to
derive from OsinfoEntity. The primary purpose of that base
class is so we can do filtering on lists of OS, HVs, etc
and their attributes.

It seems unlikely we need todo filtering based on resources,
so could we simplify life and just derive from GObject
directly and thus use plain old GObject properties, instead
of the OsinfoEntity properties. It might make the bindings
a little nicer to use.

I actually have the same thought about the OsinfoMedia
object class too.

> +GType osinfo_resources_get_type(void);
> +
> +OsinfoResources *osinfo_resources_new(const gchar *id, const gchar *architecture);
> +
> +const gchar *osinfo_resources_get_architecture(OsinfoResources *resources);
> +gint osinfo_resources_get_n_cpus(OsinfoResources *resources);
> +gint64 osinfo_resources_get_cpu(OsinfoResources *resources);
> +gint64 osinfo_resources_get_ram(OsinfoResources *resources);
> +gint64 osinfo_resources_get_storage(OsinfoResources *resources);

The API looks fine to me though

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the virt-tools-list mailing list