Piotr Kliczewski has uploaded a new change for review.

Change subject: packaging: Jsonrpc packages deployment
......................................................................

packaging: Jsonrpc packages deployment

User can choose to use optional jsonrpc transport. In order to have it
fully functional on vdsm end it is required to deploy 2 additonal
packages: vdsm-jsonrpc and vdsm-yajsonrpc.

Change-Id: I8b690891cd0cae7e77cb188b7d7e6262cb2ef760
Signed-off-by: pkliczewski <piotr.kliczew...@gmail.com>
---
M ChangeLog
M README.environment
M configure.ac
M po/POTFILES.in
M src/ovirt_host_deploy/constants.py
M src/plugins/ovirt-host-deploy/Makefile.am
A src/plugins/ovirt-host-deploy/vdsm-json/Makefile.am
A src/plugins/ovirt-host-deploy/vdsm-json/__init__.py
A src/plugins/ovirt-host-deploy/vdsm-json/packages.py
9 files changed, 185 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-host-deploy 
refs/changes/89/23089/1

diff --git a/ChangeLog b/ChangeLog
index 4ce6fa8..cb1897c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
    vdsm-bootstrap doings. rhbz#1008328.
  * openstack: rename quantum to neutron due to project rename,
    rhbz#1032890.
+ * vdsm-json: packages: optional deployment of json packages for vdsm.
 
 2013-08-26 - Version 1.1.0
 
diff --git a/README.environment b/README.environment
index fb06a86..1d567ea 100644
--- a/README.environment
+++ b/README.environment
@@ -70,6 +70,9 @@
 GLUSTER/enable(bool) [False]
     Install gluster support.
 
+VDSMJSON/enable(bool) [False]
+    Install json packages for vdsm.
+
 OPENSTACK/neutronEnable(bool) [False]
     Enable Neutron configuration.
 
diff --git a/configure.ac b/configure.ac
index a1fd8c6..b62a335 100644
--- a/configure.ac
+++ b/configure.ac
@@ -178,6 +178,7 @@
        src/plugins/ovirt-host-deploy/node/Makefile
        src/plugins/ovirt-host-deploy/gluster/Makefile
        src/plugins/ovirt-host-deploy/openstack/Makefile
+       src/plugins/ovirt-host-deploy/vdsm-json/Makefile
        src/java/Makefile
        src/java/pom.xml
        src/interface-3/Makefile
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 638005b..b1f829a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -26,3 +26,5 @@
 ./src/plugins/ovirt-host-deploy/vdsm/pki.py
 ./src/plugins/ovirt-host-deploy/vdsm/software.py
 ./src/plugins/ovirt-host-deploy/vdsm/vdsmid.py
+./src/plugins/ovirt-host-deploy/vdsm-json/__init__.py
+./src/plugins/ovirt-host-deploy/vdsm-json/packages.py
diff --git a/src/ovirt_host_deploy/constants.py 
b/src/ovirt_host_deploy/constants.py
index eaf1fe1..2413761 100644
--- a/src/ovirt_host_deploy/constants.py
+++ b/src/ovirt_host_deploy/constants.py
@@ -121,6 +121,12 @@
 
 @util.export
 @util.codegen
+class VdsmJsonEnv(object):
+    ENABLE = 'VDSMJSON/enable'
+
+
+@util.export
+@util.codegen
 class OpenStackEnv(object):
     NEUTRON_ENABLE = 'OPENSTACK/neutronEnable'
     NEUTRON_CONFIG_PREFIX = 'OPENSTACK_NEUTRON_CONFIG/'
diff --git a/src/plugins/ovirt-host-deploy/Makefile.am 
b/src/plugins/ovirt-host-deploy/Makefile.am
index 6287580..5154ff7 100644
--- a/src/plugins/ovirt-host-deploy/Makefile.am
+++ b/src/plugins/ovirt-host-deploy/Makefile.am
@@ -29,6 +29,7 @@
        node \
        gluster \
        openstack \
+       vdsm-json \
        $(NULL)
 
 install-data-local:
diff --git a/src/plugins/ovirt-host-deploy/vdsm-json/Makefile.am 
b/src/plugins/ovirt-host-deploy/vdsm-json/Makefile.am
new file mode 100644
index 0000000..84a580c
--- /dev/null
+++ b/src/plugins/ovirt-host-deploy/vdsm-json/Makefile.am
@@ -0,0 +1,38 @@
+#
+# ovirt-host-deploy - ovirt host deployer
+# Copyright (C) 2012-2013 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+include $(top_srcdir)/build/python.inc
+
+MAINTAINERCLEANFILES = \
+       $(srcdir)/Makefile.in \
+       $(NULL)
+
+mydir=$(ovirthostdeployplugindir)/ovirt-host-deploy/vdsm-json
+dist_my_PYTHON = \
+       __init__.py \
+       packages.py \
+       $(NULL)
+
+clean-local: \
+       python-clean \
+       $(NULL)
+
+all-local: \
+       python-syntax-check \
+       $(NULL)
diff --git a/src/plugins/ovirt-host-deploy/vdsm-json/__init__.py 
b/src/plugins/ovirt-host-deploy/vdsm-json/__init__.py
new file mode 100644
index 0000000..d39188c
--- /dev/null
+++ b/src/plugins/ovirt-host-deploy/vdsm-json/__init__.py
@@ -0,0 +1,35 @@
+#
+# ovirt-host-deploy -- ovirt host deployer
+# Copyright (C) 2012-2013 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+
+"""vdsm-json plugin."""
+
+
+from otopi import util
+
+
+from . import packages
+
+
+@util.export
+def createPlugins(context):
+    packages.Plugin(context=context)
+
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/plugins/ovirt-host-deploy/vdsm-json/packages.py 
b/src/plugins/ovirt-host-deploy/vdsm-json/packages.py
new file mode 100644
index 0000000..97aac2b
--- /dev/null
+++ b/src/plugins/ovirt-host-deploy/vdsm-json/packages.py
@@ -0,0 +1,98 @@
+#
+# ovirt-host-deploy -- ovirt host deployer
+# Copyright (C) 2012-2013 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+
+"""vdsm-json packages plugin."""
+
+
+import gettext
+_ = lambda m: gettext.dgettext(message=m, domain='ovirt-host-deploy')
+
+
+from otopi import util
+from otopi import plugin
+
+
+from ovirt_host_deploy import constants as odeploycons
+
+
+@util.export
+class Plugin(plugin.PluginBase):
+    """vdsm-json pacakges.
+
+    Environment:
+        VdsmJsonEnv.ENABLE -- perform json customization.
+
+    """
+    def __init__(self, context):
+        super(Plugin, self).__init__(context=context)
+        self._enabled = False
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_INIT,
+    )
+    def _setup(self):
+        self.environment[odeploycons.VdsmJsonEnv.ENABLE] = False
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_VALIDATION,
+        condition=lambda self: (
+            not self.environment[
+                odeploycons.VdsmEnv.OVIRT_NODE
+            ] and
+            self.environment[odeploycons.VdsmJsonEnv.ENABLE]
+        ),
+    )
+    def _validation(self):
+        if not self.packager.queryPackages(patterns=('vdsm-jsonrpc',)):
+            raise RuntimeError(
+                _(
+                    'Cannot locate vdsm-jsonrpc package, '
+                    'possible cause is incorrect channels'
+                )
+            )
+        if not self.packager.queryPackages(patterns=('vdsm-yajsonrpc',)):
+            raise RuntimeError(
+                _(
+                    'Cannot locate vdsm-yajsonrpc package, '
+                    'possible cause is incorrect channels'
+                )
+            )
+        self._enabled = True
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_PACKAGES,
+        condition=lambda self: self._enabled,
+    )
+    def _packages(self):
+        self.packager.installUpdate(('vdsm-jsonrpc', 'vdsm-yajsonrpc'))
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CLOSEUP,
+        condition=lambda self: (
+            self._enabled and
+            not self.environment[
+                odeploycons.CoreEnv.FORCE_REBOOT
+            ]
+        ),
+    )
+    def _closeup(self):
+        self.logger.info(_('vdsm-json installed'))
+
+# vim: expandtab tabstop=4 shiftwidth=4


-- 
To view, visit http://gerrit.ovirt.org/23089
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b690891cd0cae7e77cb188b7d7e6262cb2ef760
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-host-deploy
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczew...@gmail.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to