Simone Tiraboschi has uploaded a new change for review. Change subject: WIP: packaging: setup: deploy Cinder and Glance Docker containers ......................................................................
WIP: packaging: setup: deploy Cinder and Glance Docker containers deploy Cinder and Glance via Docker containers WORK IN PROGRESS! Change-Id: Id192819a95343df9d9d035f8632d17ac76d2d82f Bug-Url: https://bugzilla.redhat.com/1195127 Bug-Url: https://bugzilla.redhat.com/1195131 Signed-off-by: Simone Tiraboschi <stira...@redhat.com> --- M ovirt-engine.spec.in A packaging/setup/ovirt_engine_setup/dockerc/__init__.py A packaging/setup/ovirt_engine_setup/dockerc/constants.py A packaging/setup/plugins/ovirt-engine-setup/dockerc/__init__.py A packaging/setup/plugins/ovirt-engine-setup/dockerc/config.py 5 files changed, 243 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/39519/1 diff --git a/ovirt-engine.spec.in b/ovirt-engine.spec.in index 43a724d..26567cc 100644 --- a/ovirt-engine.spec.in +++ b/ovirt-engine.spec.in @@ -594,6 +594,16 @@ %description setup-plugin-allinone All-in-one plugin for %{ovirt_product_name_short}'s setup +%package setup-plugin-dockerc +Summary: Docker container plugin for %{ovirt_product_name_short}'s setup +Group: %{ovirt_product_group} +Requires: %{name}-setup-plugin-ovirt-engine-common = %{version}-%{release} +Requires: docker +Requires: python-docker-py + +%description setup-plugin-dockerc +Docker container plugin for %{ovirt_product_name_short}'s setup + %prep %setup -c -q @@ -1071,6 +1081,11 @@ %config %{_sysconfdir}/ovirt-host-deploy.conf.d/10-packaging-aio.conf %{engine_data}/firewalld/aio/ +%files setup-plugin-dockerc + +%{engine_data}/setup/ovirt_engine_setup/dockerc/ +%{engine_data}/setup/plugins/*/dockerc/ + %files dbscripts %{engine_data}/dbscripts/ diff --git a/packaging/setup/ovirt_engine_setup/dockerc/__init__.py b/packaging/setup/ovirt_engine_setup/dockerc/__init__.py new file mode 100644 index 0000000..1fa8ed1 --- /dev/null +++ b/packaging/setup/ovirt_engine_setup/dockerc/__init__.py @@ -0,0 +1,25 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +"""ovirt_engine_setup module.""" + + +__all__ = [] + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/ovirt_engine_setup/dockerc/constants.py b/packaging/setup/ovirt_engine_setup/dockerc/constants.py new file mode 100644 index 0000000..ae34ce5 --- /dev/null +++ b/packaging/setup/ovirt_engine_setup/dockerc/constants.py @@ -0,0 +1,61 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +"""Constants.""" + + +import gettext + +from otopi import util + +from ovirt_engine_setup.constants import osetupattrs, osetupattrsclass + + +def _(m): + return gettext.dgettext(message=m, domain='ovirt-engine-setup') + + +@util.export +class Defaults(object): + DEFAULT_KEY_SIZE = 2048 + + +@util.export +@util.codegen +@osetupattrsclass +class ConfigEnv(object): + @osetupattrs( + answerfile=True, + summary=True, + description=_('Deploy Cinder container'), + postinstallfile=True, + ) + def DOCKERC_CINDER(self): + return 'OVESETUP_CONFIG/cinderCDeploy' + + @osetupattrs( + answerfile=True, + summary=True, + description=_('Deploy Glance container'), + postinstallfile=True, + ) + def DOCKERC_GLANCE(self): + return 'OVESETUP_CONFIG/glanceCDeploy' + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-setup/dockerc/__init__.py b/packaging/setup/plugins/ovirt-engine-setup/dockerc/__init__.py new file mode 100644 index 0000000..abccd0f --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-setup/dockerc/__init__.py @@ -0,0 +1,33 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +"""ovirt-engine-setup dockerc plugin.""" + + +from otopi import util + + +from . import config + + +@util.export +def createPlugins(context): + config.Plugin(context=context) + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-setup/dockerc/config.py b/packaging/setup/plugins/ovirt-engine-setup/dockerc/config.py new file mode 100644 index 0000000..98920f0 --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-setup/dockerc/config.py @@ -0,0 +1,109 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +"""ovirt-engine-setup dockerc plugin.""" + + +import gettext + +from otopi import plugin, util + +from ovirt_engine_setup import constants as osetupcons +from ovirt_engine_setup import dialog +from ovirt_engine_setup.dockerc import constants as odockerccons + + +def _(m): + return gettext.dgettext(message=m, domain='ovirt-engine-setup') + + +@util.export +class Plugin(plugin.PluginBase): + """ovirt-engine-setup dockerc plugin.""" + + def __init__(self, context): + super(Plugin, self).__init__(context=context) + self._enabled = True + + @plugin.event( + stage=plugin.Stages.STAGE_INIT, + ) + def _init(self): + self.environment.setdefault( + odockerccons.ConfigEnv.DOCKERC_CINDER, + None + ) + self.environment.setdefault( + odockerccons.ConfigEnv.DOCKERC_GLANCE, + None + ) + + @plugin.event( + stage=plugin.Stages.STAGE_SETUP, + ) + def _setup(self): + self._enabled = not self.environment[ + osetupcons.CoreEnv.DEVELOPER_MODE + ] + if self._enabled: + self.command.detect('docker') + + @plugin.event( + stage=plugin.Stages.STAGE_CUSTOMIZATION, + before=( + osetupcons.Stages.DIALOG_TITLES_E_PRODUCT_OPTIONS, + ), + after=( + osetupcons.Stages.DIALOG_TITLES_S_PRODUCT_OPTIONS, + ), + condition=lambda self: self._enabled, + ) + def _customization(self): + if self.environment[ + odockerccons.ConfigEnv.DOCKERC_CINDER + ] is None: + self.environment[ + odockerccons.ConfigEnv.DOCKERC_CINDER + ] = dialog.queryBoolean( + dialog=self.dialog, + name='OVESETUP_CONFIG_DOCKERC_CINDER', + note=_( + 'Deploy cinder container on this host ' + '(@VALUES@) [@DEFAULT@]: ' + ), + prompt=True, + default=False, + ) + if self.environment[ + odockerccons.ConfigEnv.DOCKERC_GLANCE + ] is None: + self.environment[ + odockerccons.ConfigEnv.DOCKERC_GLANCE + ] = dialog.queryBoolean( + dialog=self.dialog, + name='OVESETUP_CONFIG_DOCKERC_GLANCE', + note=_( + 'Deploy glance container on this host ' + '(@VALUES@) [@DEFAULT@]: ' + ), + prompt=True, + default=False, + ) + + +# vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit https://gerrit.ovirt.org/39519 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id192819a95343df9d9d035f8632d17ac76d2d82f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches