[Kimchi-devel] [PATCH 02/16] V6 Ginger Base : base folder files part 1

chandra at linux.vnet.ibm.com chandra at linux.vnet.ibm.com
Fri Oct 16 14:39:02 UTC 2015


From: chandrureddy <chandra at linux.vnet.ibm.com>

---
 src/wok/plugins/gingerbase/API.json        | 175 ++++++++
 src/wok/plugins/gingerbase/INSTALL         | 369 ++++++++++++++++
 src/wok/plugins/gingerbase/Makefile.am     | 161 +++++++
 src/wok/plugins/gingerbase/VERSION         |   1 +
 src/wok/plugins/gingerbase/__init__.py     |  21 +
 src/wok/plugins/gingerbase/autogen.sh      |  21 +
 src/wok/plugins/gingerbase/config.py.in    |  59 +++
 src/wok/plugins/gingerbase/config.rpath    | 672 +++++++++++++++++++++++++++++
 src/wok/plugins/gingerbase/configure.ac    | 103 +++++
 src/wok/plugins/gingerbase/gingerbase.conf |  31 ++
 src/wok/plugins/gingerbase/gingerbase.py   |  61 +++
 src/wok/plugins/gingerbase/i18n.py         |  95 ++++
 src/wok/plugins/gingerbase/lscpu.py        | 126 ++++++
 src/wok/plugins/gingerbase/mockmodel.py    | 298 +++++++++++++
 14 files changed, 2193 insertions(+)
 create mode 100644 src/wok/plugins/gingerbase/API.json
 create mode 100644 src/wok/plugins/gingerbase/INSTALL
 create mode 100644 src/wok/plugins/gingerbase/Makefile.am
 create mode 100644 src/wok/plugins/gingerbase/VERSION
 create mode 100644 src/wok/plugins/gingerbase/__init__.py
 create mode 100755 src/wok/plugins/gingerbase/autogen.sh
 create mode 100644 src/wok/plugins/gingerbase/config.py.in
 create mode 100644 src/wok/plugins/gingerbase/config.rpath
 create mode 100644 src/wok/plugins/gingerbase/configure.ac
 create mode 100644 src/wok/plugins/gingerbase/gingerbase.conf
 create mode 100644 src/wok/plugins/gingerbase/gingerbase.py
 create mode 100644 src/wok/plugins/gingerbase/i18n.py
 create mode 100644 src/wok/plugins/gingerbase/lscpu.py
 create mode 100644 src/wok/plugins/gingerbase/mockmodel.py

diff --git a/src/wok/plugins/gingerbase/API.json b/src/wok/plugins/gingerbase/API.json
new file mode 100644
index 0000000..7b77eac
--- /dev/null
+++ b/src/wok/plugins/gingerbase/API.json
@@ -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/src/wok/plugins/gingerbase/INSTALL b/src/wok/plugins/gingerbase/INSTALL
new file mode 100644
index 0000000..63bf076
--- /dev/null
+++ b/src/wok/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/src/wok/plugins/gingerbase/Makefile.am b/src/wok/plugins/gingerbase/Makefile.am
new file mode 100644
index 0000000..db661d1
--- /dev/null
+++ b/src/wok/plugins/gingerbase/Makefile.am
@@ -0,0 +1,161 @@
+#
+# Ginger Base
+#
+# Copyright IBM Corp, 2015
+#
+# Code derived from Project Kimchi
+#
+# 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
+
+SUBDIRS = contrib control docs model po tests ui
+
+gingerbase_PYTHON = $(filter-out config.py, $(wildcard *.py))
+
+nodist_gingerbase_PYTHON = config.py
+
+wokdir = $(pythondir)/wok
+gingerbasedir = $(pythondir)/wok/plugins/gingerbase
+
+confdir = $(sysconfdir)/wok/plugins.d
+dist_conf_DATA = gingerbase.conf
+
+AUTOMAKE_OPTIONS = foreign
+
+ACLOCAL_AMFLAGS = --install -I m4
+
+EXTRA_DIST = \
+	config.rpath \
+	API.json \
+	autogen.sh \
+	COPYING.ASL2 \
+	COPYING.LGPL \
+	CONTRIBUTE.md \
+	VERSION \
+	build-aux/pkg-version \
+	config.py.in \
+	$(NULL)
+
+
+PEP8_BLACKLIST = *config.py,*i18n.py,*tests/test_config.py
+
+I18N_FILES = ./i18n.py \
+	$(NULL)
+
+check-local:
+	contrib/check_i18n.py $(I18N_FILES)
+	find . -path './.git' -prune -type f -o \
+		-name '*.py' -o -name '*.py.in'  | xargs $(PYFLAKES) | \
+		while read LINE; do echo "$$LINE"; false; done
+
+	$(PEP8) --version
+	$(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
+
+
+# Link built mo files in the source tree to enable use of translations from
+# within the source tree
+all-local:
+	while read L && test -n "$$L"; do                  \
+		dir=mo/$$L/LC_MESSAGES ;                       \
+		$(MKDIR_P) $$dir ;                             \
+		ln -sf ../../../po/$$L.gmo $$dir/gingerbase.mo ;   \
+	done < po/LINGUAS
+
+do_substitution = \
+	sed -e 's,[@]prefix[@],$(prefix),g'             \
+	-e 's,[@]datadir[@],$(datadir),g'               \
+	-e 's,[@]sysconfdir[@],$(sysconfdir),g'         \
+	-e 's,[@]localstatedir[@],$(localstatedir),g'   \
+	-e 's,[@]pkgdatadir[@],$(pkgdatadir),g'         \
+	-e 's,[@]wokdir[@],$(wokdir),g'           \
+	-e 's,[@]gingerbasedir[@],$(gingerbasedir),g'           \
+	-e 's,[@]kimchiversion[@],$(PACKAGE_VERSION),g' \
+	-e 's,[@]kimchirelease[@],$(PACKAGE_RELEASE),g' \
+	-e 's,[@]withspice[@],$(WITH_SPICE),g'
+
+config.py: config.py.in Makefile
+	$(do_substitution) < $(srcdir)/config.py.in > config.py
+
+
+#
+# Packaging helpers
+#
+
+install-deb: install
+	$(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/kimchi/
+	cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
+	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/
+	touch $(DESTDIR)/$(localstatedir)/lib/wok/objectstore_gingerbase
+	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
+
+
+deb: contrib/make-deb.sh
+	$(top_srcdir)/contrib/make-deb.sh
+
+gingerbase.spec: contrib/gingerbase.spec.fedora contrib/gingerbase.spec.suse
+	@if test -e /etc/redhat-release; then                   \
+		ln -sf contrib/gingerbase.spec.fedora $@ ;              \
+	elif test -e /etc/SuSE-release; then                    \
+		ln -sf contrib/gingerbase.spec.suse $@ ;                \
+	else                                                    \
+		echo "Unable to select a spec file for RPM build" ; \
+		/bin/false ;                                        \
+	fi
+
+rpm: dist gingerbase.spec
+	$(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS
+	cp $(top_srcdir)/gingerbase.spec rpm/SPECS/gingerbase.spec
+	cp $(DIST_ARCHIVES) rpm/SOURCES
+	rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/gingerbase.spec
+
+fedora-rpm: contrib/gingerbase.spec.fedora
+	ln -sf contrib/gingerbase.spec.fedora gingerbase.spec
+	$(MAKE) rpm
+
+suse-rpm: contrib/gingerbase.spec.suse
+	ln -sf contrib/gingerbase.spec.suse gingerbase.spec
+	$(MAKE) rpm
+
+ChangeLog:
+	@if test -d .git; then                                   \
+		$(top_srcdir)/build-aux/genChangelog --release > $@; \
+	fi
+
+install-data-local:
+	$(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/kimchi/
+	touch $(DESTDIR)/$(localstatedir)/lib/wok/objectstore_gingerbase
+	$(MKDIR_P) $(DESTDIR)$(gingerbasedir)
+	$(INSTALL_DATA) API.json $(DESTDIR)$(gingerbasedir)/API.json
+	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
+
+uninstall-local:
+	@if test -f $(DESTDIR)/etc/systemd/system/wokd.service.d/gingerbase.conf; then \
+		$(RM) $(DESTDIR)/etc/systemd/system/wokd.service.d/gingerbase.conf; \
+	fi; \
+	$(RM) $(DESTDIR)$(gingerbasedir)/API.json
+	$(RM) -rf $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
+
+VERSION:
+	@if test -d .git; then                                \
+		git describe --abbrev=0 > $@;                     \
+	fi
+
+.PHONY: deb install-deb rpm fedora-rpm suse-rpm ChangeLog VERSION
+
+
+clean-local:
+	rm -rf mo rpm
+
+BUILT_SOURCES = config.py
+CLEANFILES = config.py gingerbase.spec `find "$(top_srcdir)" -type f -name "*.pyc" -print`
diff --git a/src/wok/plugins/gingerbase/VERSION b/src/wok/plugins/gingerbase/VERSION
new file mode 100644
index 0000000..bc80560
--- /dev/null
+++ b/src/wok/plugins/gingerbase/VERSION
@@ -0,0 +1 @@
+1.5.0
diff --git a/src/wok/plugins/gingerbase/__init__.py b/src/wok/plugins/gingerbase/__init__.py
new file mode 100644
index 0000000..21a12a9
--- /dev/null
+++ b/src/wok/plugins/gingerbase/__init__.py
@@ -0,0 +1,21 @@
+#
+# Project Ginger Base
+#
+# Copyright IBM, Corp. 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 gingerbase import GingerBase
+__all__ = [GingerBase]
diff --git a/src/wok/plugins/gingerbase/autogen.sh b/src/wok/plugins/gingerbase/autogen.sh
new file mode 100755
index 0000000..0f22dba
--- /dev/null
+++ b/src/wok/plugins/gingerbase/autogen.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+aclocal
+automake --add-missing
+autoreconf
+
+if [ ! -f "configure" ]; then
+    echo "Failed to generate configure script.  Check to make sure autoconf, "
+    echo "automake, and other build dependencies are properly installed."
+    exit 1
+fi
+
+if [ "x$1" == "x--system" ]; then
+    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+else
+   if [ $# -gt 0 ]; then
+        ./configure $@
+   else
+        ./configure --prefix=/usr/local
+   fi
+fi
diff --git a/src/wok/plugins/gingerbase/config.py.in b/src/wok/plugins/gingerbase/config.py.in
new file mode 100644
index 0000000..b80b6fe
--- /dev/null
+++ b/src/wok/plugins/gingerbase/config.py.in
@@ -0,0 +1,59 @@
+#
+# Project Ginger Base
+#
+# Copyright IBM, Corp. 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
+#
+
+import os
+import threading
+
+from wok.config import CACHEEXPIRES, PluginConfig, PluginPaths
+
+gingerBaseLock = threading.Lock()
+
+
+def get_debugreports_path():
+    return os.path.join(PluginPaths('gingerbase').state_dir, 'debugreports')
+
+
+class GingerBasePaths(PluginPaths):
+
+    def __init__(self):
+        super(GingerBasePaths, self).__init__('gingerbase')
+
+
+gingerBasePaths = GingerBasePaths()
+
+
+class GingerBaseConfig(PluginConfig):
+    def __init__(self):
+        super(GingerBaseConfig, self).__init__('gingerbase')
+
+        custom_config = {}
+        for dirname in ('css', 'js', 'images'):
+            custom_config['/' + dirname] = {
+                'tools.staticdir.on': True,
+                'tools.staticdir.dir': os.path.join(gingerBasePaths.ui_dir,
+                                                    dirname),
+                'tools.wokauth.on': False,
+                'tools.nocache.on': False}
+            if dirname != 'images':
+                custom_config['/' + dirname].update({
+                    'tools.expires.on': True,
+                    'tools.expires.secs': CACHEEXPIRES})
+
+        self.update(custom_config)
diff --git a/src/wok/plugins/gingerbase/config.rpath b/src/wok/plugins/gingerbase/config.rpath
new file mode 100644
index 0000000..17298f2
--- /dev/null
+++ b/src/wok/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 at 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 at 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/src/wok/plugins/gingerbase/configure.ac b/src/wok/plugins/gingerbase/configure.ac
new file mode 100644
index 0000000..00aba89
--- /dev/null
+++ b/src/wok/plugins/gingerbase/configure.ac
@@ -0,0 +1,103 @@
+#
+# Ginger Base
+#
+# Copyright IBM Corp, 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
+
+AC_INIT([gingerbase], [m4_esyscmd([./build-aux/pkg-version --version])])
+
+AC_SUBST([PACKAGE_VERSION],
+         [m4_esyscmd([./build-aux/pkg-version --version])])
+
+AC_SUBST([PACKAGE_RELEASE],
+         [m4_esyscmd([./build-aux/pkg-version --release])])
+
+# Testing for version and release
+AS_IF([test "x$PACKAGE_VERSION" = x],
+      AC_MSG_ERROR([package version not defined]))
+AS_IF([test "x$PACKAGE_RELEASE" = x],
+      AC_MSG_ERROR([package release not defined]))
+
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([-Wno-portability])
+AM_PATH_PYTHON([2.6])
+AC_PATH_PROG([PEP8], [pep8], [/usr/bin/pep8])
+AC_PYTHON_MODULE([unittest])
+AC_SUBST([HAVE_PYMOD_UNITTEST])
+AC_SUBST([PYTHON_VERSION])
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.10])
+AC_PATH_PROG([CHEETAH], [cheetah], [/usr/bin/cheetah])
+
+# Checking for pyflakes
+AC_PATH_PROG([PYFLAKES], [pyflakes])
+if test "x$PYFLAKES" = "x"; then
+  AC_MSG_WARN([pyflakes not found])
+fi
+
+AC_ARG_ENABLE(
+    [sample],
+    [AS_HELP_STRING(
+        [--enable-sample],
+        [enable sample plugin @<:@default=no@:>@]
+    )],
+    ,
+    [enable_sample="no"]
+)
+
+if test "${enable_sample}" = "yes"; then
+AC_SUBST([ENABLE_SAMPLE], [True])
+else
+AC_SUBST([ENABLE_SAMPLE], [False])
+fi
+
+AC_CONFIG_FILES([
+    po/Makefile.in
+    po/gen-pot
+    Makefile
+    docs/Makefile
+    control/Makefile
+    model/Makefile
+    ui/Makefile
+    ui/config/Makefile
+    ui/css/Makefile
+    ui/images/Makefile
+    ui/images/theme-default/Makefile
+    ui/js/Makefile
+    ui/pages/Makefile
+    ui/pages/help/Makefile
+    ui/pages/help/en_US/Makefile
+    ui/pages/help/de_DE/Makefile
+    ui/pages/help/es_ES/Makefile
+    ui/pages/help/fr_FR/Makefile
+    ui/pages/help/it_IT/Makefile
+    ui/pages/help/ja_JP/Makefile
+    ui/pages/help/ko_KR/Makefile
+    ui/pages/help/pt_BR/Makefile
+    ui/pages/help/ru_RU/Makefile
+    ui/pages/help/zh_CN/Makefile
+    ui/pages/help/zh_TW/Makefile
+    contrib/Makefile
+    contrib/DEBIAN/Makefile
+    contrib/DEBIAN/control
+    contrib/gingerbase.spec.fedora
+    contrib/gingerbase.spec.suse
+    tests/Makefile
+],[
+    chmod +x po/gen-pot
+])
+
+AC_OUTPUT
diff --git a/src/wok/plugins/gingerbase/gingerbase.conf b/src/wok/plugins/gingerbase/gingerbase.conf
new file mode 100644
index 0000000..a7e6e08
--- /dev/null
+++ b/src/wok/plugins/gingerbase/gingerbase.conf
@@ -0,0 +1,31 @@
+[wok]
+enable = True
+plugin_class = "GingerBase"
+uri = "/plugins/gingerbase"
+extra_auth_api_class = "control.sub_nodes"
+
+[/]
+tools.trailing_slash.on = False
+request.methods_with_bodies = ('POST', 'PUT')
+tools.nocache.on = True
+tools.proxy.on = True
+tools.sessions.on = True
+tools.sessions.name = 'wok'
+tools.sessions.secure = True
+tools.sessions.httponly = True
+tools.sessions.locking = 'explicit'
+tools.sessions.storage_type = 'ram'
+tools.sessions.timeout = 10
+tools.wokauth.on = True
+
+[/data/debugreports]
+tools.staticdir.on = True
+tools.staticdir.dir = wok.config.PluginPaths('gingerbase').state_dir + '/debugreports'
+tools.nocache.on = False
+tools.wokauth.on = True
+tools.staticdir.content_types = {'xz': 'application/x-xz'}
+
+[/help]
+tools.staticdir.on = True
+tools.staticdir.dir = wok.config.PluginPaths('gingerbase').ui_dir + '/pages/help'
+tools.nocache.on = True
\ No newline at end of file
diff --git a/src/wok/plugins/gingerbase/gingerbase.py b/src/wok/plugins/gingerbase/gingerbase.py
new file mode 100644
index 0000000..493e9f3
--- /dev/null
+++ b/src/wok/plugins/gingerbase/gingerbase.py
@@ -0,0 +1,61 @@
+#
+# Project Ginger Base
+#
+# Copyright IBM, Corp. 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
+
+import json
+import os
+
+from wok.i18n import messages
+from wok.root import WokRoot
+
+import config
+import mockmodel
+from control import sub_nodes
+from model import model as gingerBaseModel
+
+
+class GingerBase(WokRoot):
+    def __init__(self, wok_options):
+        if hasattr(wok_options, "model"):
+            self.model = wok_options.model
+        elif wok_options.test:
+            self.model = mockmodel.MockModel()
+        else:
+            self.model = gingerBaseModel.Model()
+
+        dev_env = wok_options.environment != 'production'
+        super(GingerBase, self).__init__(self.model, dev_env)
+
+        for ident, node in sub_nodes.items():
+            setattr(self, ident, node(self.model))
+
+        self.api_schema = json.load(open(os.path.join(os.path.dirname(
+                                    os.path.abspath(__file__)), 'API.json')))
+        self.paths = config.gingerBasePaths
+        self.domain = 'gingerbase'
+        self.messages = messages
+
+        make_dirs = [
+            os.path.abspath(config.get_debugreports_path()),
+        ]
+        for directory in make_dirs:
+            if not os.path.isdir(directory):
+                os.makedirs(directory)
+
+    def get_custom_conf(self):
+        return config.GingerBaseConfig()
diff --git a/src/wok/plugins/gingerbase/i18n.py b/src/wok/plugins/gingerbase/i18n.py
new file mode 100644
index 0000000..69285eb
--- /dev/null
+++ b/src/wok/plugins/gingerbase/i18n.py
@@ -0,0 +1,95 @@
+#
+# Project Ginger Base
+#
+# Copyright IBM, Corp. 2015
+#
+# Code derived from Project Kimchi
+# 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 gettext
+
+_ = gettext.gettext
+
+
+messages = {
+    "GGBAPI0001E": _("Unknown parameter %(value)s"),
+
+    "GGBDISKS0001E": _("Error while getting block devices. Details: %(err)s"),
+    "GGBDISKS0002E": _("Error while getting block device information for %(device)s."),
+
+    "GGBDR0001E": _("Debug report %(name)s does not exist"),
+    "GGBDR0002E": _("Debug report tool not found in system"),
+    "GGBDR0003E": _("Unable to create debug report %(name)s. Details: %(err)s."),
+    "GGBDR0004E": _("Can not find any debug report with the given name %(name)s"),
+    "GGBDR0005E": _("Unable to generate debug report %(name)s. Details: %(err)s"),
+    "GGBDR0006E": _("You should give a name for the debug report file."),
+    "GGBDR0007E": _("Debug report name must be a string. Only letters, digits, underscore ('_') and "
+                    "hyphen ('-') are allowed."),
+    "GGBDR0008E": _("The debug report with specified name \"%(name)s\" already exists. Please use another one."),
+
+    "GGBPART0001E": _("Partition %(name)s does not exist in the host"),
+
+    "GGBHOST0001E": _("Unable to shutdown host machine as there are running virtual machines"),
+    "GGBHOST0002E": _("Unable to reboot host machine as there are running virtual machines"),
+    "GGBHOST0005E": _("When specifying CPU topology, each element must be an integer greater than zero."),
+
+    "GGBPKGUPD0001E": _("No packages marked for update"),
+    "GGBPKGUPD0002E": _("Package %(name)s is not marked to be updated."),
+    "GGBPKGUPD0003E": _("Error while getting packages marked to be updated. Details: %(err)s"),
+    "GGBPKGUPD0004E": _("There is no compatible package manager for this system."),
+
+
+    "GGBREPOS0001E": _("YUM Repository ID must be one word only string."),
+    "GGBREPOS0002E": _("Repository URL must be an http://, ftp:// or file:// URL."),
+    "GGBREPOS0003E": _("Repository configuration is a dictionary with specific values according to repository type."),
+    "GGBREPOS0004E": _("Distribution to DEB repository must be a string"),
+    "GGBREPOS0005E": _("Components to DEB repository must be listed in a array"),
+    "GGBREPOS0006E": _("Components to DEB repository must be a string"),
+    "GGBREPOS0007E": _("Mirror list to repository must be a string"),
+    "GGBREPOS0008E": _("YUM Repository name must be string."),
+    "GGBREPOS0009E": _("GPG check must be a boolean value."),
+    "GGBREPOS0010E": _("GPG key must be a URL pointing to the ASCII-armored file."),
+    "GGBREPOS0011E": _("Could not update repository %(repo_id)s."),
+    "GGBREPOS0012E": _("Repository %(repo_id)s does not exist."),
+    "GGBREPOS0013E": _("Specify repository base URL,  mirror list or metalink in order to create or "
+                       "update a YUM repository."),
+    "GGBREPOS0014E": _("Repository management tool was not recognized for your system."),
+    "GGBREPOS0015E": _("Repository %(repo_id)s is already enabled."),
+    "GGBREPOS0016E": _("Repository %(repo_id)s is already disabled."),
+    "GGBREPOS0017E": _("Could not remove repository %(repo_id)s."),
+    "GGBREPOS0018E": _("Could not write repository configuration file %(repo_file)s"),
+    "GGBREPOS0019E": _("Specify repository distribution in order to create a DEB repository."),
+    "GGBREPOS0020E": _("Could not enable repository %(repo_id)s."),
+    "GGBREPOS0021E": _("Could not disable repository %(repo_id)s."),
+    "GGBREPOS0022E": _("YUM Repository ID already exists"),
+    "GGBREPOS0023E": _("YUM Repository name must be a string"),
+    "GGBREPOS0024E": _("Unable to list repositories. Details: '%(err)s'"),
+    "GGBREPOS0025E": _("Unable to retrieve repository information. Details: '%(err)s'"),
+    "GGBREPOS0026E": _("Unable to add repository. Details: '%(err)s'"),
+    "GGBREPOS0027E": _("Unable to remove repository. Details: '%(err)s'"),
+    "GGBREPOS0028E": _("Configuration items: '%(items)s' are not supported by repository manager"),
+    "GGBREPOS0029E": _("Repository metalink must be an http://, ftp:// or file:// URL."),
+    "GGBREPOS0030E": _("Cannot specify mirrorlist and metalink at the same time."),
+
+
+    "GGBCPUINF0001E": _("The number of vCPUs is too large for this system."),
+    "GGBCPUINF0002E": _("Invalid vCPU/topology combination."),
+    "GGBCPUINF0003E": _("This host (or current configuration) does not allow CPU topology."),
+    "GGBCPUINF0004E": _("This host (or current configuration) does not allow to fetch lscpu details."),
+    "GGBCPUINF0005E": _("This host (or current configuration) does not provide Socket(s) information."),
+    "GGBCPUINF0006E": _("This host (or current configuration) does not provide Core(s) per socket information."),
+    "GGBCPUINF0007E": _("This host (or current configuration) does not provide Thread(s) per core information."),
+
+}
diff --git a/src/wok/plugins/gingerbase/lscpu.py b/src/wok/plugins/gingerbase/lscpu.py
new file mode 100644
index 0000000..0fc1e72
--- /dev/null
+++ b/src/wok/plugins/gingerbase/lscpu.py
@@ -0,0 +1,126 @@
+#
+# Project Ginger Base
+#
+# Copyright IBM, Corp. 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
+import logging
+
+from wok.utils import run_command
+from wok.exception import NotFoundError
+
+
+class LsCpu(object):
+    """
+    Get CPU information about a CPU hyper threading/architecture on x86
+    """
+    def log_error(e):
+        """
+            param e: error details to be logged
+        """
+        log = logging.getLogger('Util')
+        log.warning('Exception in fetching the CPU architecture details: %s',
+                    e)
+
+    def __init__(self):
+        self.lsCpuInfo = {}
+        try:
+            # lscpu - display information about the CPU architecture
+            out, error, rc = run_command(['lscpu'])
+            # Output of lscpu on x86 is expected to be:
+            # Architecture:          x86_64
+            # CPU op-mode(s):        32-bit, 64-bit
+            # Byte Order:            Little Endian
+            # CPU(s):                4
+            # On-line CPU(s) list:   0-3
+            # Thread(s) per core:    2
+            # Core(s) per socket:    2
+            # Socket(s):             1
+            # NUMA node(s):          1
+            # Vendor ID:             GenuineIntel
+            # CPU family:            6
+            # Model:                 42
+            # Model name:            Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
+            # Stepping:              7
+            # CPU MHz:               976.421
+            # CPU max MHz:           3300.0000
+            # CPU min MHz:           800.0000
+            # BogoMIPS:              5182.99
+            # Virtualization:        VT-x
+            # L1d cache:             32K
+            # L1i cache:             32K
+            # L2 cache:              256K
+            # L3 cache:              3072K
+            # NUMA node0 CPU(s):     0-3
+
+            if not rc and (not out.isspace()):
+                lscpuout = out.split('\n')
+                if lscpuout and len(lscpuout) > 0:
+                    for line in lscpuout:
+                        if ":" in line and (len(line.split(':')) == 2):
+                            self.lsCpuInfo[line.split(':')[0].strip()] = \
+                                line.split(':')[1].strip()
+                        else:
+                            continue
+        except Exception, e:
+            self.log_error(e)
+            raise NotFoundError("GGBCPUINF0004E")
+
+    def get_sockets(self):
+        """
+            param self: object of the class self
+            return: Socket(s) (information about the CPU architecture)
+        """
+        try:
+            sockets = "Socket(s)"
+            if len(self.lsCpuInfo) > 0 and sockets in self.lsCpuInfo.keys():
+                return int(self.lsCpuInfo[sockets])
+            else:
+                raise NotFoundError("GGBCPUINF0005E")
+        except IndexError, e:
+            self.log_error(e)
+            raise NotFoundError("GGBCPUINF0005E")
+
+    def get_cores_per_socket(self):
+        """
+            param self: object of the class self
+            return: Core(s) per socket (information about the CPU architecture)
+        """
+        try:
+            cores_per_socket = "Core(s) per socket"
+            if len(self.lsCpuInfo) > 0 and cores_per_socket \
+                    in self.lsCpuInfo.keys():
+                return int(self.lsCpuInfo[cores_per_socket])
+            else:
+                raise NotFoundError("GGBCPUINF0006E")
+        except IndexError, e:
+            self.log_error(e)
+            raise NotFoundError("GGBCPUINF0006E")
+
+    def get_threads_per_core(self):
+        """
+            param self: object of the class self
+            return: Thread(s) per core (information about the CPU architecture)
+        """
+        try:
+            threads_per_core = "Thread(s) per core"
+            if len(self.lsCpuInfo) > 0 and threads_per_core \
+                    in self.lsCpuInfo.keys():
+                return int(self.lsCpuInfo[threads_per_core])
+            else:
+                raise NotFoundError("GGBCPUINF0007E")
+        except IndexError, e:
+            self.log_error(e)
+            raise NotFoundError("GGBCPUINF0007E")
diff --git a/src/wok/plugins/gingerbase/mockmodel.py b/src/wok/plugins/gingerbase/mockmodel.py
new file mode 100644
index 0000000..62ea509
--- /dev/null
+++ b/src/wok/plugins/gingerbase/mockmodel.py
@@ -0,0 +1,298 @@
+#
+# Project Ginger Base
+#
+# Copyright IBM, Corp. 2015
+#
+# Code derived from Project Kimchi
+#
+# 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 lxml.etree as ET
+import os
+import random
+import time
+
+from wok.objectstore import ObjectStore
+from wok.utils import add_task, wok_log
+
+import config
+from model import cpuinfo
+from model.debugreports import DebugReportsModel
+from model.model import Model
+
+fake_user = {'root': 'letmein!'}
+mockmodel_defaults = {'domain': 'test', 'arch': 'i686'}
+
+
+class MockModel(Model):
+
+    def __init__(self, objstore_loc=None):
+        # Override osinfo.defaults to ajust the values according to
+        # test:///default driver
+
+        self._mock_devices = MockDevices()
+        self._mock_partitions = MockPartitions()
+        self._mock_swupdate = MockSoftwareUpdate()
+        self._mock_repositories = MockRepositories()
+
+        cpuinfo.get_topo_capabilities = \
+            MockModel.get_topo_capabilities
+
+        super(MockModel, self).__init__(objstore_loc)
+        self.objstore_loc = objstore_loc
+        self.objstore = ObjectStore(objstore_loc)
+
+        # The MockModel methods are instantiated on runtime according to Model
+        # and BaseModel
+        # Because that a normal method override will not work here
+        # Instead of that we also need to do the override on runtime
+        for method in dir(self):
+            if method.startswith('_mock_'):
+                mock_method = getattr(self, method)
+                if not callable(mock_method):
+                    continue
+
+                m = method[6:]
+                model_method = getattr(self, m)
+                setattr(self, '_model_' + m, model_method)
+                setattr(self, m, mock_method)
+
+        DebugReportsModel._gen_debugreport_file = self._gen_debugreport_file
+
+    def reset(self):
+        self._mock_swupdate = MockSoftwareUpdate()
+        self._mock_repositories = MockRepositories()
+
+        if hasattr(self, 'objstore'):
+            self.objstore = ObjectStore(self.objstore_loc)
+
+    @staticmethod
+    def get_topo_capabilities(conn):
+        # The libvirt test driver doesn't return topology.
+        xml = "<topology sockets='1' cores='2' threads='2'/>"
+        return ET.fromstring(xml)
+
+    def _gen_debugreport_file(self, name):
+        return add_task('/plugins/gingerbase/debugreports/%s' % name,
+                        self._create_log, self.objstore, name)
+
+    def _create_log(self, cb, name):
+        path = config.get_debugreports_path()
+        tmpf = os.path.join(path, name + '.tmp')
+        realf = os.path.join(path, name + '.txt')
+        length = random.randint(1000, 10000)
+        with open(tmpf, 'w') as fd:
+            while length:
+                fd.write('I am logged')
+                length = length - 1
+        os.rename(tmpf, realf)
+        cb("OK", True)
+
+    def _mock_host_shutdown(self, *name):
+        wok_log.info("The host system will be shutted down")
+
+    def _mock_host_reboot(self, *name):
+        wok_log.info("The host system will be rebooted")
+
+    def _mock_partitions_get_list(self):
+        return self._mock_partitions.partitions.keys()
+
+    def _mock_partition_lookup(self, name):
+        return self._mock_partitions.partitions[name]
+
+    def _mock_packagesupdate_get_list(self):
+        return self._mock_swupdate.pkgs.keys()
+
+    def _mock_packageupdate_lookup(self, pkg_name):
+        return self._mock_swupdate.pkgs[pkg_name]
+
+    def _mock_host_swupdate(self, args=None):
+        task_id = add_task('/plugins/gingerbase/host/swupdate',
+                           self._mock_swupdate.doUpdate,
+                           self.objstore)
+        return self.task_lookup(task_id)
+
+    def _mock_repositories_get_list(self):
+        return self._mock_repositories.repos.keys()
+
+    def _mock_repositories_create(self, params):
+        # Create a repo_id if not given by user. The repo_id will follow
+        # the format gingerbase_repo_<integer>, where integer is the number of
+        # seconds since the Epoch (January 1st, 1970), in UTC.
+        repo_id = params.get('repo_id', None)
+        if repo_id is None:
+            repo_id = "gingerbase_repo_%s" % str(int(time.time() * 1000))
+            params.update({'repo_id': repo_id})
+
+        config = params.get('config', {})
+        info = {'repo_id': repo_id,
+                'baseurl': params['baseurl'],
+                'enabled': True,
+                'config': {'repo_name': config.get('repo_name', repo_id),
+                           'gpgkey': config.get('gpgkey', []),
+                           'gpgcheck': True,
+                           'mirrorlist': params.get('mirrorlist', '')}}
+        self._mock_repositories.repos[repo_id] = info
+        return repo_id
+
+    def _mock_repository_lookup(self, repo_id):
+        return self._mock_repositories.repos[repo_id]
+
+    def _mock_repository_delete(self, repo_id):
+        del self._mock_repositories.repos[repo_id]
+
+    def _mock_repository_enable(self, repo_id):
+        self._mock_repositories.repos[repo_id]['enabled'] = True
+
+    def _mock_repository_disable(self, repo_id):
+        self._mock_repositories.repos[repo_id]['enabled'] = False
+
+    def _mock_repository_update(self, repo_id, params):
+        self._mock_repositories.repos[repo_id].update(params)
+        return repo_id
+
+
+class MockPartitions(object):
+    def __init__(self):
+        self.partitions = {"vdx": {"available": True, "name": "vdx",
+                                   "fstype": "", "path": "/dev/vdx",
+                                   "mountpoint": "", "type": "disk",
+                                   "size": "2147483648"},
+                           "vdz": {"available": True, "name": "vdz",
+                                   "fstype": "", "path": "/dev/vdz",
+                                   "mountpoint": "", "type": "disk",
+                                   "size": "2147483648"}}
+
+
+class MockDevices(object):
+    def __init__(self):
+        self.devices = {
+            'computer': {'device_type': 'system',
+                         'firmware': {'release_date': '01/01/2012',
+                                      'vendor': 'LENOVO',
+                                      'version': 'XXXXX (X.XX )'},
+                         'hardware': {'serial': 'PXXXXX',
+                                      'uuid':
+                                      '9d660370-820f-4241-8731-5a60c97e8aa6',
+                                      'vendor': 'LENOVO',
+                                      'version': 'ThinkPad T420'},
+                         'name': 'computer',
+                         'parent': None,
+                         'product': '4180XXX'},
+            'pci_0000_03_00_0': {'bus': 3,
+                                 'device_type': 'pci',
+                                 'domain': 0,
+                                 'driver': {'name': 'iwlwifi'},
+                                 'function': 0,
+                                 'iommuGroup': 7,
+                                 'name': 'pci_0000_03_00_0',
+                                 'parent': 'computer',
+                                 'path':
+                                 '/sys/devices/pci0000:00/0000:03:00.0',
+                                 'product': {
+                                     'description':
+                                     'Centrino Advanced-N 6205 [Taylor Peak]',
+                                     'id': '0x0085'},
+                                 'slot': 0,
+                                 'vendor': {'description': 'Intel Corporation',
+                                            'id': '0x8086'}},
+            'pci_0000_0d_00_0': {'bus': 13,
+                                 'device_type': 'pci',
+                                 'domain': 0,
+                                 'driver': {'name': 'sdhci-pci'},
+                                 'function': 0,
+                                 'iommuGroup': 7,
+                                 'name': 'pci_0000_0d_00_0',
+                                 'parent': 'computer',
+                                 'path':
+                                 '/sys/devices/pci0000:00/0000:0d:00.0',
+                                 'product': {'description':
+                                             'PCIe SDXC/MMC Host Controller',
+                                             'id': '0xe823'},
+                                 'slot': 0,
+                                 'vendor': {'description': 'Ricoh Co Ltd',
+                                            'id': '0x1180'}},
+            'scsi_host0': {'adapter': {'fabric_wwn': '37df6c1efa1b4388',
+                                       'type': 'fc_host',
+                                       'wwnn': 'efb6563f06434a98',
+                                       'wwpn': '742f32073aab45d7'},
+                           'device_type': 'scsi_host',
+                           'host': 0,
+                           'name': 'scsi_host0',
+                           'parent': 'computer',
+                           'path': '/sys/devices/pci0000:00/0000:40:00.0/0'},
+            'scsi_host1': {'adapter': {'fabric_wwn': '542efa5dced34123',
+                                       'type': 'fc_host',
+                                       'wwnn': 'b7433a40c9b84092',
+                                       'wwpn': '25c1f485ae42497f'},
+                           'device_type': 'scsi_host',
+                           'host': 0,
+                           'name': 'scsi_host1',
+                           'parent': 'computer',
+                           'path': '/sys/devices/pci0000:00/0000:40:00.0/1'},
+            'scsi_host2': {'adapter': {'fabric_wwn': '5c373c334c20478d',
+                                       'type': 'fc_host',
+                                       'wwnn': 'f2030bec4a254e6b',
+                                       'wwpn': '07dbca4164d44096'},
+                           'device_type': 'scsi_host',
+                           'host': 0,
+                           'name': 'scsi_host2',
+                           'parent': 'computer',
+                           'path': '/sys/devices/pci0000:00/0000:40:00.0/2'}}
+
+
+class MockSoftwareUpdate(object):
+    def __init__(self):
+        self.pkgs = {
+            'udevmountd': {'repository': 'openSUSE-13.1-Update',
+                           'version': '0.81.5-14.1',
+                           'arch': 'x86_64',
+                           'package_name': 'udevmountd'},
+            'sysconfig-network': {'repository': 'openSUSE-13.1-Extras',
+                                  'version': '0.81.5-14.1',
+                                  'arch': 'x86_64',
+                                  'package_name': 'sysconfig-network'},
+            'libzypp': {'repository': 'openSUSE-13.1-Update',
+                        'version': '13.9.0-10.1',
+                        'arch': 'noarch',
+                        'package_name': 'libzypp'}}
+        self._num2update = 3
+
+    def doUpdate(self, cb, params):
+        msgs = []
+        for pkg in self.pkgs.keys():
+            msgs.append("Updating package %s" % pkg)
+            cb('\n'.join(msgs))
+            time.sleep(1)
+
+        time.sleep(2)
+        msgs.append("All packages updated")
+        cb('\n'.join(msgs), True)
+
+        # After updating all packages any package should be listed to be
+        # updated, so reset self._packages
+        self.pkgs = {}
+
+
+class MockRepositories(object):
+    def __init__(self):
+        self.repos = {"gingerbase_repo_1392167832":
+                      {"repo_id": "gingerbase_repo_1392167832",
+                       "enabled": True,
+                       "baseurl": "http://www.fedora.org",
+                       "config": {"repo_name": "gingerbase_repo_1392167832",
+                                  "gpgkey": [],
+                                  "gpgcheck": True,
+                                  "mirrorlist": ""}}}
-- 
2.1.0




More information about the Kimchi-devel mailing list