On 09/10/2015 07:24 PM, Aline Manera wrote:
On 01/09/2015 14:57, chandra(a)linux.vnet.ibm.com wrote:
> From: chandrureddy <chandra(a)linux.vnet.ibm.com>
>
> ---
> plugins/gingerbase/API.json | 175 ++++++++
> plugins/gingerbase/INSTALL | 369 ++++++++++++++++
> plugins/gingerbase/config.rpath | 672
> +++++++++++++++++++++++++++++
> plugins/gingerbase/control/Makefile.am | 25 ++
> plugins/gingerbase/control/__init__.py | 26 ++
> plugins/gingerbase/control/cpuinfo.py | 37 ++
> plugins/gingerbase/control/debugreports.py | 61 +++
> plugins/gingerbase/control/host.py | 145 +++++++
> plugins/gingerbase/control/tasks.py | 37 ++
> plugins/kimchi/control/debugreports.py | 61 ---
> 10 files changed, 1547 insertions(+), 61 deletions(-)
> create mode 100644 plugins/gingerbase/API.json
> create mode 100644 plugins/gingerbase/INSTALL
> create mode 100644 plugins/gingerbase/config.rpath
> create mode 100644 plugins/gingerbase/control/Makefile.am
> create mode 100644 plugins/gingerbase/control/__init__.py
> create mode 100644 plugins/gingerbase/control/cpuinfo.py
> create mode 100644 plugins/gingerbase/control/debugreports.py
> create mode 100644 plugins/gingerbase/control/host.py
> create mode 100644 plugins/gingerbase/control/tasks.py
> delete mode 100644 plugins/kimchi/control/debugreports.py
All the above changes should be done in the first patch
Well considering the patch
size limits, I tried to come up with many
patches with the 17 commits. Nevertheless objective is met :-)
> diff --git a/plugins/gingerbase/API.json b/plugins/gingerbase/API.json
> new file mode 100644
> index 0000000..7b77eac
> --- /dev/null
> +++ b/plugins/gingerbase/API.json
License header is missing
Will add it.
> @@ -0,0 +1,175 @@
> +{
> + "$schema": "http://json-schema.org/draft-03/schema#",
> + "title": "Ginger Base API",
> + "description": "Json schema for Gigner Base API",
> + "type": "object",
> + "gingerbasetype": {
> + "cpu_info": {
> + "description": "Configure CPU specifics for a VM.",
> + "type": "object",
> + "properties": {
> + "topology": {
> + "description": "Configure the guest CPU
topology.",
> + "type": "object",
> + "properties": {
> + "sockets": {
> + "type": "integer",
> + "required": true,
> + "minimum": 1,
> + "error": "GGBHOST0005E"
> + },
> + "cores": {
> + "type": "integer",
> + "required": true,
> + "minimum": 1,
> + "error": "GGBHOST0005E"
> + },
> + "threads": {
> + "type": "integer",
> + "required": true,
> + "minimum": 1,
> + "error": "GGBHOST0005E"
> + }
> + }
> + }
> + }
> + }
> + },
> + "properties": {
> + "debugreports_create": {
> + "type": "object",
> + "error": "GGBDR0006E",
> + "properties": {
> + "name": {
> + "description": "The name for the debug report
> file.",
> + "type": "string",
> + "pattern": "^[_A-Za-z0-9-]*$",
> + "error": "GGBDR0007E"
> + }
> + }
> + },
> + "debugreport_update": {
> + "type": "object",
> + "properties": {
> + "name": {
> + "description": "New name of debug report",
> + "type": "string",
> + "pattern": "^[_A-Za-z0-9-]*$",
> + "error": "GGBDR0007E"
> + }
> + },
> + "additionalProperties": false
> + },
> + "repositories_create": {
> + "type": "object",
> + "properties": {
> + "repo_id": {
> + "description": "Repository ID used for YUM
> repository.",
> + "type": "string",
> + "error": "GGBREPOS0001E"
> + },
> + "baseurl": {
> + "description": "URL to the directory where the
> repodata directory of a repository is located. Can be an http://,
> ftp:// or file:// URL.",
> + "type": "string",
> + "error": "GGBREPOS0002E"
> + },
> + "config": {
> + "description": "Dictionary containing repository
> configuration",
> + "type": "object",
> + "error": "GGBREPOS0003E",
> + "properties": {
> + "dist": {
> + "description": "Distribution to DEB
> repository",
> + "type": "string",
> + "error": "GGBREPOS0004E"
> + },
> + "comps": {
> + "description": "List of components to
> DEB repository",
> + "type": "array",
> + "error": "GGBREPOS0005E",
> + "uniqueItems": true,
> + "items": {
> + "description": "Component
name",
> + "type": "string",
> + "error": "GGBREPOS0006E"
> + }
> + },
> + "repo_name": {
> + "description": "YUM repository
name",
> + "type": "string",
> + "error": "GGBREPOS0023E"
> + },
> + "mirrorlist": {
> + "description": "URL to a file containing
> a list of baseurls",
> + "type": "string",
> + "error": "GGBREPOS0007E"
> + },
> + "metalink": {
> + "description": "URL to a metalink file
> for the repomd.xml",
> + "type": "string",
> + "error": "GGBREPOS0029E"
> + }
> + }
> + }
> + },
> + "additionalProperties": false,
> + "error": "KCHAPI0001E"
> + },
> + "repository_update": {
> + "type": "object",
> + "properties": {
> + "baseurl": {
> + "description": "URL to the directory where the
> repodata directory of a repository is located. Can be an http://,
> ftp:// or file:// URL.",
> + "type": "string",
> + "error": "GGBREPOS0002E"
> + },
> + "config": {
> + "description": "Dictionary containing repository
> configuration",
> + "type": "object",
> + "error": "GGBREPOS0003E",
> + "properties": {
> + "dist": {
> + "description": "Distribution to DEB
> repository",
> + "type": "string",
> + "error": "GGBREPOS0004E"
> + },
> + "comps": {
> + "description": "List of components to
> DEB repository",
> + "type": "array",
> + "error": "GGBREPOS0005E",
> + "uniqueItems": true,
> + "items": {
> + "description": "Component
name",
> + "type": "string",
> + "error": "GGBREPOS0006E"
> + }
> + },
> + "repo_name": {
> + "description": "Human-readable string
> describing the YUM repository.",
> + "type": "string",
> + "error": "GGBREPOS0008E"
> + },
> + "mirrorlist": {
> + "description": "URL to a file containing
> a list of baseurls for YUM repository",
> + "type": "string",
> + "error": "GGBREPOS0007E"
> + },
> + "gpgcheck": {
> + "description": "Indicates if a GPG
> signature check on the packages gotten from repository should be
> performed.",
> + "type": "boolean",
> + "error": "GGBREPOS0009E"
> + },
> + "gpgkey": {
> + "description": "URL pointing to the
> ASCII-armored GPG key file for the repository.",
> + "type": "string",
> + "error": "GGBREPOS0010E"
> + }
> + }
> + }
> + },
> + "additionalProperties": false,
> + "error": "GGBAPI0001E"
> +
> + }
> + }
> +}
> diff --git a/plugins/gingerbase/INSTALL b/plugins/gingerbase/INSTALL
> new file mode 100644
> index 0000000..63bf076
> --- /dev/null
> +++ b/plugins/gingerbase/INSTALL
> @@ -0,0 +1,369 @@
> +Installation Instructions
> +*************************
> +
> +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
> +Inc.
> +
> + Copying and distribution of this file, with or without modification,
> +are permitted in any medium without royalty provided the copyright
> +notice and this notice are preserved. This file is offered as-is,
> +without warranty of any kind.
> +
> +Basic Installation
> +==================
> +
> + Briefly, the shell commands `./configure; make; make install' should
> +configure, build, and install this package. The following
> +more-detailed instructions are generic; see the `README' file for
> +instructions specific to this package. Some packages provide this
> +`INSTALL' file but do not implement all of the features documented
> +below. The lack of an optional feature in a given package is not
> +necessarily a bug. More recommendations for GNU packages can be found
> +in *note Makefile Conventions: (standards)Makefile Conventions.
> +
> + The `configure' shell script attempts to guess correct values for
> +various system-dependent variables used during compilation. It uses
> +those values to create a `Makefile' in each directory of the package.
> +It may also create one or more `.h' files containing system-dependent
> +definitions. Finally, it creates a shell script `config.status' that
> +you can run in the future to recreate the current configuration, and a
> +file `config.log' containing compiler output (useful mainly for
> +debugging `configure').
> +
> + It can also use an optional file (typically called `config.cache'
> +and enabled with `--cache-file=config.cache' or simply `-C') that saves
> +the results of its tests to speed up reconfiguring. Caching is
> +disabled by default to prevent problems with accidental use of stale
> +cache files.
> +
> + If you need to do unusual things to compile the package, please try
> +to figure out how `configure' could check whether to do them, and mail
> +diffs or instructions to the address given in the `README' so they can
> +be considered for the next release. If you are using the cache, and at
> +some point `config.cache' contains results you don't want to keep, you
> +may remove or edit it.
> +
> + The file `configure.ac' (or `configure.in') is used to create
> +`configure' by a program called `autoconf'. You need `configure.ac' if
> +you want to change it or regenerate `configure' using a newer version
> +of `autoconf'.
> +
> + The simplest way to compile this package is:
> +
> + 1. `cd' to the directory containing the package's source code and
> type
> + `./configure' to configure the package for your system.
> +
> + Running `configure' might take a while. While running, it prints
> + some messages telling which features it is checking for.
> +
> + 2. Type `make' to compile the package.
> +
> + 3. Optionally, type `make check' to run any self-tests that come with
> + the package, generally using the just-built uninstalled binaries.
> +
> + 4. Type `make install' to install the programs and any data files and
> + documentation. When installing into a prefix owned by root, it is
> + recommended that the package be configured and built as a regular
> + user, and only the `make install' phase executed with root
> + privileges.
> +
> + 5. Optionally, type `make installcheck' to repeat any self-tests, but
> + this time using the binaries in their final installed location.
> + This target does not install anything. Running this target as a
> + regular user, particularly if the prior `make install' required
> + root privileges, verifies that the installation completed
> + correctly.
> +
> + 6. You can remove the program binaries and object files from the
> + source code directory by typing `make clean'. To also remove the
> + files that `configure' created (so you can compile the package for
> + a different kind of computer), type `make distclean'. There is
> + also a `make maintainer-clean' target, but that is intended mainly
> + for the package's developers. If you use it, you may have to get
> + all sorts of other programs in order to regenerate files that came
> + with the distribution.
> +
> + 7. Often, you can also type `make uninstall' to remove the installed
> + files again. In practice, not all packages have tested that
> + uninstallation works correctly, even though it is required by the
> + GNU Coding Standards.
> +
> + 8. Some packages, particularly those that use Automake, provide `make
> + distcheck', which can by used by developers to test that all other
> + targets like `make install' and `make uninstall' work correctly.
> + This target is generally not run by end users.
> +
> +Compilers and Options
> +=====================
> +
> + Some systems require unusual options for compilation or linking that
> +the `configure' script does not know about. Run `./configure --help'
> +for details on some of the pertinent environment variables.
> +
> + You can give `configure' initial values for configuration parameters
> +by setting variables in the command line or in the environment. Here
> +is an example:
> +
> + ./configure CC=c99 CFLAGS=-g LIBS=-lposix
> +
> + *Note Defining Variables::, for more details.
> +
> +Compiling For Multiple Architectures
> +====================================
> +
> + You can compile the package for more than one kind of computer at
> the
> +same time, by placing the object files for each architecture in their
> +own directory. To do this, you can use GNU `make'. `cd' to the
> +directory where you want the object files and executables to go and run
> +the `configure' script. `configure' automatically checks for the
> +source code in the directory that `configure' is in and in `..'. This
> +is known as a "VPATH" build.
> +
> + With a non-GNU `make', it is safer to compile the package for one
> +architecture at a time in the source code directory. After you have
> +installed the package for one architecture, use `make distclean' before
> +reconfiguring for another architecture.
> +
> + On MacOS X 10.5 and later systems, you can create libraries and
> +executables that work on multiple system types--known as "fat" or
> +"universal" binaries--by specifying multiple `-arch' options to the
> +compiler but only a single `-arch' option to the preprocessor. Like
> +this:
> +
> + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch
> ppc64" \
> + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch
> ppc64" \
> + CPP="gcc -E" CXXCPP="g++ -E"
> +
> + This is not guaranteed to produce working output in all cases, you
> +may have to build one architecture at a time and combine the results
> +using the `lipo' tool if you have problems.
> +
> +Installation Names
> +==================
> +
> + By default, `make install' installs the package's commands under
> +`/usr/local/bin', include files under `/usr/local/include', etc. You
> +can specify an installation prefix other than `/usr/local' by giving
> +`configure' the option `--prefix=PREFIX', where PREFIX must be an
> +absolute file name.
> +
> + You can specify separate installation prefixes for
> +architecture-specific files and architecture-independent files. If you
> +pass the option `--exec-prefix=PREFIX' to `configure', the package uses
> +PREFIX as the prefix for installing programs and libraries.
> +Documentation and other data files still use the regular prefix.
> +
> + In addition, if you use an unusual directory layout you can give
> +options like `--bindir=DIR' to specify different values for particular
> +kinds of files. Run `configure --help' for a list of the directories
> +you can set and what kinds of files go in them. In general, the
> +default for these options is expressed in terms of `${prefix}', so that
> +specifying just `--prefix' will affect all of the other directory
> +specifications that were not explicitly provided.
> +
> + The most portable way to affect installation locations is to pass
> the
> +correct locations to `configure'; however, many packages provide one or
> +both of the following shortcuts of passing variable assignments to the
> +`make install' command line to change installation locations without
> +having to reconfigure or recompile.
> +
> + The first method involves providing an override variable for each
> +affected directory. For example, `make install
> +prefix=/alternate/directory' will choose an alternate location for all
> +directory configuration variables that were expressed in terms of
> +`${prefix}'. Any directories that were specified during `configure',
> +but not in terms of `${prefix}', must each be overridden at install
> +time for the entire installation to be relocated. The approach of
> +makefile variable overrides for each directory variable is required by
> +the GNU Coding Standards, and ideally causes no recompilation.
> +However, some platforms have known limitations with the semantics of
> +shared libraries that end up requiring recompilation when using this
> +method, particularly noticeable in packages that use GNU Libtool.
> +
> + The second method involves providing the `DESTDIR' variable. For
> +example, `make install DESTDIR=/alternate/directory' will prepend
> +`/alternate/directory' before all installation names. The approach of
> +`DESTDIR' overrides is not required by the GNU Coding Standards, and
> +does not work on platforms that have drive letters. On the other hand,
> +it does better at avoiding recompilation issues, and works well even
> +when some directory options were not specified in terms of `${prefix}'
> +at `configure' time.
> +
> +Optional Features
> +=================
> +
> + If the package supports it, you can cause programs to be installed
> +with an extra prefix or suffix on their names by giving `configure' the
> +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
> +
> + Some packages pay attention to `--enable-FEATURE' options to
> +`configure', where FEATURE indicates an optional part of the package.
> +They may also pay attention to `--with-PACKAGE' options, where PACKAGE
> +is something like `gnu-as' or `x' (for the X Window System). The
> +`README' should mention any `--enable-' and `--with-' options that the
> +package recognizes.
> +
> + For packages that use the X Window System, `configure' can usually
> +find the X include and library files automatically, but if it doesn't,
> +you can use the `configure' options `--x-includes=DIR' and
> +`--x-libraries=DIR' to specify their locations.
> +
> + Some packages offer the ability to configure how verbose the
> +execution of `make' will be. For these packages, running `./configure
> +--enable-silent-rules' sets the default to minimal output, which can be
> +overridden with `make V=1'; while running `./configure
> +--disable-silent-rules' sets the default to verbose, which can be
> +overridden with `make V=0'.
> +
> +Particular systems
> +==================
> +
> + On HP-UX, the default C compiler is not ANSI C compatible. If GNU
> +CC is not installed, it is recommended to use the following options in
> +order to use an ANSI C compiler:
> +
> + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
> +
> +and if that doesn't work, install pre-built binaries of GCC for HP-UX.
> +
> + HP-UX `make' updates targets which have the same time stamps as
> +their prerequisites, which makes it generally unusable when shipped
> +generated files such as `configure' are involved. Use GNU `make'
> +instead.
> +
> + On OSF/1 a.k.a. Tru64, some versions of the default C compiler
> cannot
> +parse its `<wchar.h>' header file. The option `-nodtk' can be used
as
> +a workaround. If GNU CC is not installed, it is therefore recommended
> +to try
> +
> + ./configure CC="cc"
> +
> +and if that doesn't work, try
> +
> + ./configure CC="cc -nodtk"
> +
> + On Solaris, don't put `/usr/ucb' early in your `PATH'. This
> +directory contains several dysfunctional programs; working variants of
> +these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
> +in your `PATH', put it _after_ `/usr/bin'.
> +
> + On Haiku, software installed for all users goes in `/boot/common',
> +not `/usr/local'. It is recommended to use the following options:
> +
> + ./configure --prefix=/boot/common
> +
> +Specifying the System Type
> +==========================
> +
> + There may be some features `configure' cannot figure out
> +automatically, but needs to determine by the type of machine the
> package
> +will run on. Usually, assuming the package is built to be run on the
> +_same_ architectures, `configure' can figure that out, but if it prints
> +a message saying it cannot guess the machine type, give it the
> +`--build=TYPE' option. TYPE can either be a short name for the system
> +type, such as `sun4', or a canonical name which has the form:
> +
> + CPU-COMPANY-SYSTEM
> +
> +where SYSTEM can have one of these forms:
> +
> + OS
> + KERNEL-OS
> +
> + See the file `config.sub' for the possible values of each field. If
> +`config.sub' isn't included in this package, then this package doesn't
> +need to know the machine type.
> +
> + If you are _building_ compiler tools for cross-compiling, you should
> +use the option `--target=TYPE' to select the type of system they will
> +produce code for.
> +
> + If you want to _use_ a cross compiler, that generates code for a
> +platform different from the build platform, you should specify the
> +"host" platform (i.e., that on which the generated programs will
> +eventually be run) with `--host=TYPE'.
> +
> +Sharing Defaults
> +================
> +
> + If you want to set default values for `configure' scripts to share,
> +you can create a site shell script called `config.site' that gives
> +default values for variables like `CC', `cache_file', and `prefix'.
> +`configure' looks for `PREFIX/share/config.site' if it exists, then
> +`PREFIX/etc/config.site' if it exists. Or, you can set the
> +`CONFIG_SITE' environment variable to the location of the site script.
> +A warning: not all `configure' scripts look for a site script.
> +
> +Defining Variables
> +==================
> +
> + Variables not defined in a site shell script can be set in the
> +environment passed to `configure'. However, some packages may run
> +configure again during the build, and the customized values of these
> +variables may be lost. In order to avoid this problem, you should set
> +them in the `configure' command line, using `VAR=value'. For example:
> +
> + ./configure CC=/usr/local2/bin/gcc
> +
> +causes the specified `gcc' to be used as the C compiler (unless it is
> +overridden in the site shell script).
> +
> +Unfortunately, this technique does not work for `CONFIG_SHELL' due to
> +an Autoconf bug. Until the bug is fixed you can use this workaround:
> +
> + CONFIG_SHELL=/bin/bash /bin/bash ./configure
> CONFIG_SHELL=/bin/bash
> +
> +`configure' Invocation
> +======================
> +
> + `configure' recognizes the following options to control how it
> +operates.
> +
> +`--help'
> +`-h'
> + Print a summary of all of the options to `configure', and exit.
> +
> +`--help=short'
> +`--help=recursive'
> + Print a summary of the options unique to this package's
> + `configure', and exit. The `short' variant lists options used
> + only in the top level, while the `recursive' variant lists options
> + also present in any nested packages.
> +
> +`--version'
> +`-V'
> + Print the version of Autoconf used to generate the `configure'
> + script, and exit.
> +
> +`--cache-file=FILE'
> + Enable the cache: use and save the results of the tests in FILE,
> + traditionally `config.cache'. FILE defaults to `/dev/null' to
> + disable caching.
> +
> +`--config-cache'
> +`-C'
> + Alias for `--cache-file=config.cache'.
> +
> +`--quiet'
> +`--silent'
> +`-q'
> + Do not print messages saying which checks are being made. To
> + suppress all normal output, redirect it to `/dev/null' (any error
> + messages will still be shown).
> +
> +`--srcdir=DIR'
> + Look for the package's source code in directory DIR. Usually
> + `configure' can determine that directory automatically.
> +
> +`--prefix=DIR'
> + Use DIR as the installation prefix. *note Installation Names::
> + for more details, including other options available for
> fine-tuning
> + the installation locations.
> +
> +`--no-create'
> +`-n'
> + Run the configure checks, but stop before creating any output
> + files.
> +
> +`configure' also accepts some other, not widely useful, options. Run
> +`configure --help' for more details.
> diff --git a/plugins/gingerbase/config.rpath
> b/plugins/gingerbase/config.rpath
> new file mode 100644
> index 0000000..17298f2
> --- /dev/null
> +++ b/plugins/gingerbase/config.rpath
> @@ -0,0 +1,672 @@
> +#! /bin/sh
> +# Output a system dependent set of variables, describing how to set the
> +# run time search path of shared libraries in an executable.
> +#
> +# Copyright 1996-2010 Free Software Foundation, Inc.
> +# Taken from GNU libtool, 2001
> +# Originally by Gordon Matzigkeit <gord(a)gnu.ai.mit.edu>, 1996
> +#
> +# This file is free software; the Free Software Foundation gives
> +# unlimited permission to copy and/or distribute it, with or without
> +# modifications, as long as this notice is preserved.
> +#
> +# The first argument passed to this file is the canonical host
> specification,
> +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
> +# or
> +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
> +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
> +# should be set by the caller.
> +#
> +# The set of defined variables is at the end of this script.
> +
> +# Known limitations:
> +# - On IRIX 6.5 with CC="cc", the run time search patch must not be
> longer
> +# than 256 bytes, otherwise the compiler driver will dump core.
> The only
> +# known workaround is to choose shorter directory names for the build
> +# directory and/or the installation directory.
> +
> +# All known linkers require a `.a' archive for static linking
> (except MSVC,
> +# which needs '.lib').
> +libext=a
> +shrext=.so
> +
> +host="$1"
> +host_cpu=`echo "$host" | sed
's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
> +host_vendor=`echo "$host" | sed
's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
> +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
> +
> +# Code taken from libtool.m4's _LT_CC_BASENAME.
> +
> +for cc_temp in $CC""; do
> + case $cc_temp in
> + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
> + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
> + \-*) ;;
> + *) break;;
> + esac
> +done
> +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
> +
> +# Code taken from libtool.m4's _LT_COMPILER_PIC.
> +
> +wl=
> +if test "$GCC" = yes; then
> + wl='-Wl,'
> +else
> + case "$host_os" in
> + aix*)
> + wl='-Wl,'
> + ;;
> + darwin*)
> + case $cc_basename in
> + xlc*)
> + wl='-Wl,'
> + ;;
> + esac
> + ;;
> + mingw* | cygwin* | pw32* | os2* | cegcc*)
> + ;;
> + hpux9* | hpux10* | hpux11*)
> + wl='-Wl,'
> + ;;
> + irix5* | irix6* | nonstopux*)
> + wl='-Wl,'
> + ;;
> + newsos6)
> + ;;
> + linux* | k*bsd*-gnu)
> + case $cc_basename in
> + ecc*)
> + wl='-Wl,'
> + ;;
> + icc* | ifort*)
> + wl='-Wl,'
> + ;;
> + lf95*)
> + wl='-Wl,'
> + ;;
> + pgcc | pgf77 | pgf90)
> + wl='-Wl,'
> + ;;
> + ccc*)
> + wl='-Wl,'
> + ;;
> + como)
> + wl='-lopt='
> + ;;
> + *)
> + case `$CC -V 2>&1 | sed 5q` in
> + *Sun\ C*)
> + wl='-Wl,'
> + ;;
> + esac
> + ;;
> + esac
> + ;;
> + osf3* | osf4* | osf5*)
> + wl='-Wl,'
> + ;;
> + rdos*)
> + ;;
> + solaris*)
> + wl='-Wl,'
> + ;;
> + sunos4*)
> + wl='-Qoption ld '
> + ;;
> + sysv4 | sysv4.2uw2* | sysv4.3*)
> + wl='-Wl,'
> + ;;
> + sysv4*MP*)
> + ;;
> + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
> + wl='-Wl,'
> + ;;
> + unicos*)
> + wl='-Wl,'
> + ;;
> + uts4*)
> + ;;
> + esac
> +fi
> +
> +# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
> +
> +hardcode_libdir_flag_spec=
> +hardcode_libdir_separator=
> +hardcode_direct=no
> +hardcode_minus_L=no
> +
> +case "$host_os" in
> + cygwin* | mingw* | pw32* | cegcc*)
> + # FIXME: the MSVC++ port hasn't been tested in a loooong time
> + # When not using gcc, we currently assume that we are using
> + # Microsoft Visual C++.
> + if test "$GCC" != yes; then
> + with_gnu_ld=no
> + fi
> + ;;
> + interix*)
> + # we just hope/assume this is gcc and not c89 (= MSVC++)
> + with_gnu_ld=yes
> + ;;
> + openbsd*)
> + with_gnu_ld=no
> + ;;
> +esac
> +
> +ld_shlibs=yes
> +if test "$with_gnu_ld" = yes; then
> + # Set some defaults for GNU ld with shared library support. These
> + # are reset later if shared libraries are not supported. Putting them
> + # here allows them to be overridden if necessary.
> + # Unlike libtool, we use -rpath here, not --rpath, since the
> documented
> + # option of GNU ld is called -rpath, not --rpath.
> + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
> + case "$host_os" in
> + aix[3-9]*)
> + # On AIX/PPC, the GNU linker is very broken
> + if test "$host_cpu" != ia64; then
> + ld_shlibs=no
> + fi
> + ;;
> + amigaos*)
> + hardcode_libdir_flag_spec='-L$libdir'
> + hardcode_minus_L=yes
> + # Samuel A. Falvo II <kc5tja(a)dolphin.openprojects.net> reports
> + # that the semantics of dynamic libraries on AmigaOS, at least up
> + # to version 4, is to share data among multiple programs linked
> + # with the same dynamic library. Since this doesn't match the
> + # behavior of shared libraries on other platforms, we cannot use
> + # them.
> + ld_shlibs=no
> + ;;
> + beos*)
> + if $LD --help 2>&1 | grep ': supported targets:.* elf' >
> /dev/null; then
> + :
> + else
> + ld_shlibs=no
> + fi
> + ;;
> + cygwin* | mingw* | pw32* | cegcc*)
> + # hardcode_libdir_flag_spec is actually meaningless, as there is
> + # no search path for DLLs.
> + hardcode_libdir_flag_spec='-L$libdir'
> + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
> + :
> + else
> + ld_shlibs=no
> + fi
> + ;;
> + interix[3-9]*)
> + hardcode_direct=no
> + hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
> + ;;
> + gnu* | linux* | k*bsd*-gnu)
> + if $LD --help 2>&1 | grep ': supported targets:.* elf' >
> /dev/null; then
> + :
> + else
> + ld_shlibs=no
> + fi
> + ;;
> + netbsd*)
> + ;;
> + solaris*)
> + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
> + ld_shlibs=no
> + elif $LD --help 2>&1 | grep ': supported targets:.* elf' >
> /dev/null; then
> + :
> + else
> + ld_shlibs=no
> + fi
> + ;;
> + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
> + case `$LD -v 2>&1` in
> + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
> + ld_shlibs=no
> + ;;
> + *)
> + if $LD --help 2>&1 | grep ': supported targets:.* elf' >
> /dev/null; then
> + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH"
&&
> echo ${wl}-rpath,$libdir`'
> + else
> + ld_shlibs=no
> + fi
> + ;;
> + esac
> + ;;
> + sunos4*)
> + hardcode_direct=yes
> + ;;
> + *)
> + if $LD --help 2>&1 | grep ': supported targets:.* elf' >
> /dev/null; then
> + :
> + else
> + ld_shlibs=no
> + fi
> + ;;
> + esac
> + if test "$ld_shlibs" = no; then
> + hardcode_libdir_flag_spec=
> + fi
> +else
> + case "$host_os" in
> + aix3*)
> + # Note: this linker hardcodes the directories in LIBPATH if there
> + # are no directories specified by -L.
> + hardcode_minus_L=yes
> + if test "$GCC" = yes; then
> + # Neither direct hardcoding nor static linking is supported
> with a
> + # broken collect2.
> + hardcode_direct=unsupported
> + fi
> + ;;
> + aix[4-9]*)
> + if test "$host_cpu" = ia64; then
> + # On IA64, the linker does run time linking by default, so
> we don't
> + # have to do anything special.
> + aix_use_runtimelinking=no
> + else
> + aix_use_runtimelinking=no
> + # Test if we are trying to use run time linking or normal
> + # AIX style linking. If -brtl is somewhere in LDFLAGS, we
> + # need to do runtime linking.
> + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
> + for ld_flag in $LDFLAGS; do
> + if (test $ld_flag = "-brtl" || test $ld_flag =
> "-Wl,-brtl"); then
> + aix_use_runtimelinking=yes
> + break
> + fi
> + done
> + ;;
> + esac
> + fi
> + hardcode_direct=yes
> + hardcode_libdir_separator=':'
> + if test "$GCC" = yes; then
> + case $host_os in aix4.[012]|aix4.[012].*)
> + collect2name=`${CC} -print-prog-name=collect2`
> + if test -f "$collect2name" && \
> + strings "$collect2name" | grep resolve_lib_name >/dev/null
> + then
> + # We have reworked collect2
> + :
> + else
> + # We have old collect2
> + hardcode_direct=unsupported
> + hardcode_minus_L=yes
> + hardcode_libdir_flag_spec='-L$libdir'
> + hardcode_libdir_separator=
> + fi
> + ;;
> + esac
> + fi
> + # Begin _LT_AC_SYS_LIBPATH_AIX.
> + echo 'int main () { return 0; }' > conftest.c
> + ${CC} ${LDFLAGS} conftest.c -o conftest
> + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import
> File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
> +}'`
> + if test -z "$aix_libpath"; then
> + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e
> '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
> +}'`
> + fi
> + if test -z "$aix_libpath"; then
> + aix_libpath="/usr/lib:/lib"
> + fi
> + rm -f conftest.c conftest
> + # End _LT_AC_SYS_LIBPATH_AIX.
> + if test "$aix_use_runtimelinking" = yes; then
> +
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
> + else
> + if test "$host_cpu" = ia64; then
> + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
> + else
> +
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
> + fi
> + fi
> + ;;
> + amigaos*)
> + hardcode_libdir_flag_spec='-L$libdir'
> + hardcode_minus_L=yes
> + # see comment about different semantics on the GNU ld section
> + ld_shlibs=no
> + ;;
> + bsdi[45]*)
> + ;;
> + cygwin* | mingw* | pw32* | cegcc*)
> + # When not using gcc, we currently assume that we are using
> + # Microsoft Visual C++.
> + # hardcode_libdir_flag_spec is actually meaningless, as there is
> + # no search path for DLLs.
> + hardcode_libdir_flag_spec=' '
> + libext=lib
> + ;;
> + darwin* | rhapsody*)
> + hardcode_direct=no
> + if test "$GCC" = yes ; then
> + :
> + else
> + case $cc_basename in
> + xlc*)
> + ;;
> + *)
> + ld_shlibs=no
> + ;;
> + esac
> + fi
> + ;;
> + dgux*)
> + hardcode_libdir_flag_spec='-L$libdir'
> + ;;
> + freebsd1*)
> + ld_shlibs=no
> + ;;
> + freebsd2.2*)
> + hardcode_libdir_flag_spec='-R$libdir'
> + hardcode_direct=yes
> + ;;
> + freebsd2*)
> + hardcode_direct=yes
> + hardcode_minus_L=yes
> + ;;
> + freebsd* | dragonfly*)
> + hardcode_libdir_flag_spec='-R$libdir'
> + hardcode_direct=yes
> + ;;
> + hpux9*)
> + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
> + hardcode_libdir_separator=:
> + hardcode_direct=yes
> + # hardcode_minus_L: Not really in the search PATH,
> + # but as the default location of the library.
> + hardcode_minus_L=yes
> + ;;
> + hpux10*)
> + if test "$with_gnu_ld" = no; then
> + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
> + hardcode_libdir_separator=:
> + hardcode_direct=yes
> + # hardcode_minus_L: Not really in the search PATH,
> + # but as the default location of the library.
> + hardcode_minus_L=yes
> + fi
> + ;;
> + hpux11*)
> + if test "$with_gnu_ld" = no; then
> + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
> + hardcode_libdir_separator=:
> + case $host_cpu in
> + hppa*64*|ia64*)
> + hardcode_direct=no
> + ;;
> + *)
> + hardcode_direct=yes
> + # hardcode_minus_L: Not really in the search PATH,
> + # but as the default location of the library.
> + hardcode_minus_L=yes
> + ;;
> + esac
> + fi
> + ;;
> + irix5* | irix6* | nonstopux*)
> + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
> + hardcode_libdir_separator=:
> + ;;
> + netbsd*)
> + hardcode_libdir_flag_spec='-R$libdir'
> + hardcode_direct=yes
> + ;;
> + newsos6)
> + hardcode_direct=yes
> + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
> + hardcode_libdir_separator=:
> + ;;
> + openbsd*)
> + if test -f /usr/libexec/ld.so; then
> + hardcode_direct=yes
> + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" ||
> test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
> + hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
> + else
> + case "$host_os" in
> + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
> + hardcode_libdir_flag_spec='-R$libdir'
> + ;;
> + *)
> + hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
> + ;;
> + esac
> + fi
> + else
> + ld_shlibs=no
> + fi
> + ;;
> + os2*)
> + hardcode_libdir_flag_spec='-L$libdir'
> + hardcode_minus_L=yes
> + ;;
> + osf3*)
> + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
> + hardcode_libdir_separator=:
> + ;;
> + osf4* | osf5*)
> + if test "$GCC" = yes; then
> + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
> + else
> + # Both cc and cxx compiler support -rpath directly
> + hardcode_libdir_flag_spec='-rpath $libdir'
> + fi
> + hardcode_libdir_separator=:
> + ;;
> + solaris*)
> + hardcode_libdir_flag_spec='-R$libdir'
> + ;;
> + sunos4*)
> + hardcode_libdir_flag_spec='-L$libdir'
> + hardcode_direct=yes
> + hardcode_minus_L=yes
> + ;;
> + sysv4)
> + case $host_vendor in
> + sni)
> + hardcode_direct=yes # is this really true???
> + ;;
> + siemens)
> + hardcode_direct=no
> + ;;
> + motorola)
> + hardcode_direct=no #Motorola manual says yes, but my tests
> say they lie
> + ;;
> + esac
> + ;;
> + sysv4.3*)
> + ;;
> + sysv4*MP*)
> + if test -d /usr/nec; then
> + ld_shlibs=yes
> + fi
> + ;;
> + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* |
> unixware7* | sco3.2v5.0.[024]*)
> + ;;
> + sysv5* | sco3.2v5* | sco5v6*)
> + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" &&
echo
> ${wl}-R,$libdir`'
> + hardcode_libdir_separator=':'
> + ;;
> + uts4*)
> + hardcode_libdir_flag_spec='-L$libdir'
> + ;;
> + *)
> + ld_shlibs=no
> + ;;
> + esac
> +fi
> +
> +# Check dynamic linker characteristics
> +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
> +# Unlike libtool.m4, here we don't care about _all_ names of the
> library, but
> +# only about the one the linker finds when passed -lNAME. This is
> the last
> +# element of library_names_spec in libtool.m4, or possibly two of
> them if the
> +# linker has special search rules.
> +library_names_spec= # the last element of library_names_spec in
> libtool.m4
> +libname_spec='lib$name'
> +case "$host_os" in
> + aix3*)
> + library_names_spec='$libname.a'
> + ;;
> + aix[4-9]*)
> + library_names_spec='$libname$shrext'
> + ;;
> + amigaos*)
> + library_names_spec='$libname.a'
> + ;;
> + beos*)
> + library_names_spec='$libname$shrext'
> + ;;
> + bsdi[45]*)
> + library_names_spec='$libname$shrext'
> + ;;
> + cygwin* | mingw* | pw32* | cegcc*)
> + shrext=.dll
> + library_names_spec='$libname.dll.a $libname.lib'
> + ;;
> + darwin* | rhapsody*)
> + shrext=.dylib
> + library_names_spec='$libname$shrext'
> + ;;
> + dgux*)
> + library_names_spec='$libname$shrext'
> + ;;
> + freebsd1*)
> + ;;
> + freebsd* | dragonfly*)
> + case "$host_os" in
> + freebsd[123]*)
> + library_names_spec='$libname$shrext$versuffix' ;;
> + *)
> + library_names_spec='$libname$shrext' ;;
> + esac
> + ;;
> + gnu*)
> + library_names_spec='$libname$shrext'
> + ;;
> + hpux9* | hpux10* | hpux11*)
> + case $host_cpu in
> + ia64*)
> + shrext=.so
> + ;;
> + hppa*64*)
> + shrext=.sl
> + ;;
> + *)
> + shrext=.sl
> + ;;
> + esac
> + library_names_spec='$libname$shrext'
> + ;;
> + interix[3-9]*)
> + library_names_spec='$libname$shrext'
> + ;;
> + irix5* | irix6* | nonstopux*)
> + library_names_spec='$libname$shrext'
> + case "$host_os" in
> + irix5* | nonstopux*)
> + libsuff= shlibsuff=
> + ;;
> + *)
> + case $LD in
> + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff=
> shlibsuff= ;;
> + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
> libsuff=32 shlibsuff=N32 ;;
> + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64
> shlibsuff=64 ;;
> + *) libsuff= shlibsuff= ;;
> + esac
> + ;;
> + esac
> + ;;
> + linux*oldld* | linux*aout* | linux*coff*)
> + ;;
> + linux* | k*bsd*-gnu)
> + library_names_spec='$libname$shrext'
> + ;;
> + knetbsd*-gnu)
> + library_names_spec='$libname$shrext'
> + ;;
> + netbsd*)
> + library_names_spec='$libname$shrext'
> + ;;
> + newsos6)
> + library_names_spec='$libname$shrext'
> + ;;
> + nto-qnx*)
> + library_names_spec='$libname$shrext'
> + ;;
> + openbsd*)
> + library_names_spec='$libname$shrext$versuffix'
> + ;;
> + os2*)
> + libname_spec='$name'
> + shrext=.dll
> + library_names_spec='$libname.a'
> + ;;
> + osf3* | osf4* | osf5*)
> + library_names_spec='$libname$shrext'
> + ;;
> + rdos*)
> + ;;
> + solaris*)
> + library_names_spec='$libname$shrext'
> + ;;
> + sunos4*)
> + library_names_spec='$libname$shrext$versuffix'
> + ;;
> + sysv4 | sysv4.3*)
> + library_names_spec='$libname$shrext'
> + ;;
> + sysv4*MP*)
> + library_names_spec='$libname$shrext'
> + ;;
> + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
> + library_names_spec='$libname$shrext'
> + ;;
> + uts4*)
> + library_names_spec='$libname$shrext'
> + ;;
> +esac
> +
> +sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
> +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e
"$sed_quote_subst"`
> +shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
> +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e
> "$sed_quote_subst"`
> +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e
> 's/^X//' -e "$sed_quote_subst"`
> +escaped_hardcode_libdir_flag_spec=`echo
> "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e
"$sed_quote_subst"`
> +
> +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
> +
> +# How to pass a linker flag through the compiler.
> +wl="$escaped_wl"
> +
> +# Static library suffix (normally "a").
> +libext="$libext"
> +
> +# Shared library suffix (normally "so").
> +shlibext="$shlibext"
> +
> +# Format of library name prefix.
> +libname_spec="$escaped_libname_spec"
> +
> +# Library names that the linker finds when passed -lNAME.
> +library_names_spec="$escaped_library_names_spec"
> +
> +# Flag to hardcode \$libdir into a binary during linking.
> +# This must work even if \$libdir does not exist.
> +hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
> +
> +# Whether we need a single -rpath flag with a separated argument.
> +hardcode_libdir_separator="$hardcode_libdir_separator"
> +
> +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR
> into the
> +# resulting binary.
> +hardcode_direct="$hardcode_direct"
> +
> +# Set to yes if using the -LDIR flag during linking hardcodes DIR
> into the
> +# resulting binary.
> +hardcode_minus_L="$hardcode_minus_L"
> +
> +EOF
> diff --git a/plugins/gingerbase/control/Makefile.am
> b/plugins/gingerbase/control/Makefile.am
> new file mode 100644
> index 0000000..049570f
> --- /dev/null
> +++ b/plugins/gingerbase/control/Makefile.am
> @@ -0,0 +1,25 @@
> +#
> +# Kimchi
> +#
> +# Copyright IBM Corp, 2013
> +#
Update the copyright and the Project name
Sure.
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> +
> +control_PYTHON = *.py
> +
> +controldir = $(pythondir)/wok/plugins/gingerbase/control
> +
> +install-data-local:
> + $(MKDIR_P) $(DESTDIR)$(controldir)
> diff --git a/plugins/gingerbase/control/__init__.py
> b/plugins/gingerbase/control/__init__.py
> new file mode 100644
> index 0000000..4ad9459
> --- /dev/null
> +++ b/plugins/gingerbase/control/__init__.py
> @@ -0,0 +1,26 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2013-2014
> +#
Same here.
Sure
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> +
> +import os
> +
> +
> +from wok.control.utils import load_url_sub_node
> +
> +
> +sub_nodes = load_url_sub_node(os.path.dirname(__file__), __name__)
> diff --git a/plugins/gingerbase/control/cpuinfo.py
> b/plugins/gingerbase/control/cpuinfo.py
> new file mode 100644
> index 0000000..31f316c
> --- /dev/null
> +++ b/plugins/gingerbase/control/cpuinfo.py
> @@ -0,0 +1,37 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2014
> +#
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> +
> +
> +from wok.control.base import Resource
> +
> +
> +class CPUInfo(Resource):
> + def __init__(self, model):
> + super(CPUInfo, self).__init__(model)
> + self.admin_methods = ['GET']
> + self.role_key = 'host'
> + self.uri_fmt = "/host/cpuinfo"
> +
> + @property
> + def data(self):
> + return {'threading_enabled':
> self.info['guest_threads_enabled'],
> + 'sockets': self.info['sockets'],
> + 'cores': self.info['cores_available'],
> + 'threads_per_core': self.info['threads_per_core']
> + }
> diff --git a/plugins/gingerbase/control/debugreports.py
> b/plugins/gingerbase/control/debugreports.py
> new file mode 100644
> index 0000000..b5a3072
> --- /dev/null
> +++ b/plugins/gingerbase/control/debugreports.py
> @@ -0,0 +1,61 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2013-2015
> +#
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> +
> +from wok.control.base import AsyncCollection, Resource
> +from wok.control.utils import internal_redirect
> +from wok.control.utils import UrlSubNode
> +
> +
> +@UrlSubNode('debugreports', True)
> +class DebugReports(AsyncCollection):
> + def __init__(self, model):
> + super(DebugReports, self).__init__(model)
> + self.resource = DebugReport
> + self.role_key = 'host'
> + self.admin_methods = ['GET', 'POST']
> +
> + def _get_resources(self, filter_params):
> + res_list = super(DebugReports,
> self)._get_resources(filter_params)
> + return sorted(res_list, key=lambda x: x.data['time'],
> reverse=True)
> +
> +
> +class DebugReport(Resource):
> + def __init__(self, model, ident):
> + super(DebugReport, self).__init__(model, ident)
> + self.role_key = 'host'
> + self.admin_methods = ['GET', 'PUT', 'POST']
> + self.uri_fmt = '/debugreports/%s'
> + self.content = DebugReportContent(model, ident)
> +
> + @property
> + def data(self):
> + return {'name': self.ident,
> + 'uri': self.info['uri'],
> + 'time': self.info['ctime']}
> +
> +
> +class DebugReportContent(Resource):
> + def __init__(self, model, ident):
> + super(DebugReportContent, self).__init__(model, ident)
> + self.role_key = 'host'
> + self.admin_methods = ['GET']
> +
> + def get(self):
> + self.lookup()
> + raise internal_redirect(self.info['uri'])
> diff --git a/plugins/gingerbase/control/host.py
> b/plugins/gingerbase/control/host.py
> new file mode 100644
> index 0000000..6e6bd68
> --- /dev/null
> +++ b/plugins/gingerbase/control/host.py
> @@ -0,0 +1,145 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2013-2015
> +#
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> +
> +from wok.control.base import Collection, Resource, SimpleCollection
> +from wok.control.utils import UrlSubNode
> +from wok.exception import NotFoundError
> +
> +from cpuinfo import CPUInfo
> +
> +
> +@UrlSubNode('host', True)
> +class Host(Resource):
> + def __init__(self, model, id=None):
> + super(Host, self).__init__(model, id)
> + self.role_key = 'host'
> + self.admin_methods = ['GET', 'POST']
> + self.uri_fmt = '/host/%s'
> + self.reboot = self.generate_action_handler('reboot')
> + self.shutdown = self.generate_action_handler('shutdown')
> + self.stats = HostStats(self.model)
> + self.partitions = Partitions(self.model)
> + # self.devices = Devices(self.model)
> + self.packagesupdate = PackagesUpdate(self.model)
> + self.repositories = Repositories(self.model)
> + self.swupdate = self.generate_action_handler_task('swupdate')
> + self.cpuinfo = CPUInfo(self.model)
> + self.capabilities = Capabilities(self.model)
> +
> + @property
> + def data(self):
> + return self.info
> +
> +
> +class HostStats(Resource):
> + def __init__(self, model, id=None):
> + super(HostStats, self).__init__(model, id)
> + self.role_key = 'host'
> + self.admin_methods = ['GET']
> + self.history = HostStatsHistory(self.model)
> +
> + @property
> + def data(self):
> + return self.info
> +
> +
> +class HostStatsHistory(Resource):
> + @property
> + def data(self):
> + return self.info
> +
> +
> +class Capabilities(Resource):
> + def __init__(self, model, id=None):
> + super(Capabilities, self).__init__(model, id)
> +
> + @property
> + def data(self):
> + return self.info
> +
> +
> +class Partitions(Collection):
> + def __init__(self, model):
> + super(Partitions, self).__init__(model)
> + self.role_key = 'storage'
> + self.admin_methods = ['GET']
> + self.resource = Partition
> +
> + # Defining get_resources in order to return list of partitions
> in UI
> + # sorted by their path
> + def _get_resources(self, flag_filter):
> + res_list = super(Partitions, self)._get_resources(flag_filter)
> + res_list = filter(lambda x: x.info['available'], res_list)
> + res_list.sort(key=lambda x: x.info['path'])
> + return res_list
> +
> +
> +class Partition(Resource):
> + def __init__(self, model, id):
> + self.role_key = 'storage'
> + self.admin_methods = ['GET']
> + super(Partition, self).__init__(model, id)
> +
> + @property
> + def data(self):
> + if not self.info['available']:
> + raise NotFoundError("GGBPART0001E", {'name':
> self.info['name']})
> +
> + return self.info
> +
> +
> +class PackagesUpdate(Collection):
> + def __init__(self, model):
> + super(PackagesUpdate, self).__init__(model)
> + self.role_key = 'host'
> + self.admin_methods = ['GET']
> + self.resource = PackageUpdate
> +
> +
> +class PackageUpdate(Resource):
> + def __init__(self, model, id=None):
> + super(PackageUpdate, self).__init__(model, id)
> + self.role_key = 'host'
> + self.admin_methods = ['GET']
> +
> + @property
> + def data(self):
> + return self.info
> +
> +
> +class Repositories(Collection):
> + def __init__(self, model):
> + super(Repositories, self).__init__(model)
> + self.role_key = 'host'
> + self.admin_methods = ['GET', 'POST']
> + self.resource = Repository
> +
> +
> +class Repository(Resource):
> + def __init__(self, model, id):
> + super(Repository, self).__init__(model, id)
> + self.role_key = 'host'
> + self.admin_methods = ['GET', 'PUT', 'POST',
'DELETE']
> + self.uri_fmt = "/host/repositories/%s"
> + self.enable = self.generate_action_handler('enable')
> + self.disable = self.generate_action_handler('disable')
> +
> + @property
> + def data(self):
> + return self.info
> diff --git a/plugins/gingerbase/control/tasks.py
> b/plugins/gingerbase/control/tasks.py
> new file mode 100644
> index 0000000..b25d892
> --- /dev/null
> +++ b/plugins/gingerbase/control/tasks.py
> @@ -0,0 +1,37 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2013-2014
> +#
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> +
> +from wok.control.base import Collection, Resource
> +from wok.control.utils import UrlSubNode
> +
> +
> +@UrlSubNode("tasks", True)
> +class Tasks(Collection):
> + def __init__(self, model):
> + super(Tasks, self).__init__(model)
> + self.resource = Task
> +
> +
> +class Task(Resource):
> + def __init__(self, model, id):
> + super(Task, self).__init__(model, id)
> +
> + @property
> + def data(self):
> + return self.info
> diff --git a/plugins/kimchi/control/debugreports.py
> b/plugins/kimchi/control/debugreports.py
> deleted file mode 100644
> index b5a3072..0000000
> --- a/plugins/kimchi/control/debugreports.py
> +++ /dev/null
> @@ -1,61 +0,0 @@
> -#
> -# Project Kimchi
> -#
> -# Copyright IBM, Corp. 2013-2015
> -#
> -# 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, write to the Free Software
> -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> -
> -from wok.control.base import AsyncCollection, Resource
> -from wok.control.utils import internal_redirect
> -from wok.control.utils import UrlSubNode
> -
> -
> -@UrlSubNode('debugreports', True)
> -class DebugReports(AsyncCollection):
> - def __init__(self, model):
> - super(DebugReports, self).__init__(model)
> - self.resource = DebugReport
> - self.role_key = 'host'
> - self.admin_methods = ['GET', 'POST']
> -
> - def _get_resources(self, filter_params):
> - res_list = super(DebugReports,
> self)._get_resources(filter_params)
> - return sorted(res_list, key=lambda x: x.data['time'],
> reverse=True)
> -
> -
> -class DebugReport(Resource):
> - def __init__(self, model, ident):
> - super(DebugReport, self).__init__(model, ident)
> - self.role_key = 'host'
> - self.admin_methods = ['GET', 'PUT', 'POST']
> - self.uri_fmt = '/debugreports/%s'
> - self.content = DebugReportContent(model, ident)
> -
> - @property
> - def data(self):
> - return {'name': self.ident,
> - 'uri': self.info['uri'],
> - 'time': self.info['ctime']}
> -
> -
> -class DebugReportContent(Resource):
> - def __init__(self, model, ident):
> - super(DebugReportContent, self).__init__(model, ident)
> - self.role_key = 'host'
> - self.admin_methods = ['GET']
> -
> - def get(self):
> - self.lookup()
> - raise internal_redirect(self.info['uri'])