Alon Bar-Lev has uploaded a new change for review. Change subject: packaging: services: ovirt-engine: move deployuments to tmpdir ......................................................................
packaging: services: ovirt-engine: move deployuments to tmpdir the deployments' content is controlled by ENGINE_APPS, we should run these applications and only these. much easier to re-create on every startup than syncing with existing. this removes the need to remove markers, sync symlinks and other tasks. I failed to make jboss substitute system property within the configuration and within the paths configuration, so I use template substitution. Change-Id: I17e7bc91229e9b05e6fb719a9c15c1036a3ba19b Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M Makefile M ovirt-engine.spec.in M packaging/services/ovirt-engine/ovirt-engine.py M packaging/services/ovirt-engine/ovirt-engine.xml.in 4 files changed, 29 insertions(+), 68 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/78/23278/1 diff --git a/Makefile b/Makefile index 63cfaac..23b8a6f 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,7 @@ PKG_LOG_DIR=$(LOCALSTATE_DIR)/log/$(ENGINE_NAME) PKG_TMP_DIR=$(LOCALSTATE_DIR)/tmp/$(ENGINE_NAME) PKG_STATE_DIR=$(LOCALSTATE_DIR)/lib/$(ENGINE_NAME) +PKG_TMP_DIR=$(LOCALSTATE_DIR)/tmp/$(ENGINE_NAME) JBOSS_HOME=/usr/share/jboss-as PYTHON_DIR=$(PYTHON_SYS_DIR) DEV_PYTHON_DIR= @@ -446,7 +447,6 @@ install -d "$(DESTDIR)$(PKG_TMP_DIR)" install -d "$(DESTDIR)$(PKG_CACHE_DIR)" - install -d "$(DESTDIR)$(PKG_STATE_DIR)/deployments" install -d "$(DESTDIR)$(PKG_STATE_DIR)/content" install -d "$(DESTDIR)$(PKG_STATE_DIR)/setup/answers" install -d "$(DESTDIR)$(PKG_LOG_DIR)/host-deploy" @@ -455,4 +455,6 @@ install -d "$(DESTDIR)$(PKG_LOG_DIR)/engine-manage-domains" install -d "$(DESTDIR)$(PKG_LOG_DIR)/dump" - touch "$(DESTDIR)$(PKG_STATE_DIR)/deployments/engine.ear.deployed" + if [ -e "$(DESTDIR)$(PKG_TMP_DIR)/deployments" ]; then \ + touch "$(DESTDIR)$(PKG_TMP_DIR)/deployments/engine.ear.deployed"; \ + fi diff --git a/ovirt-engine.spec.in b/ovirt-engine.spec.in index 821ce12..6462f6b 100644 --- a/ovirt-engine.spec.in +++ b/ovirt-engine.spec.in @@ -546,7 +546,7 @@ # # /var creation # -install -dm 755 "%{buildroot}/%{engine_state}"/{deployments,content,setup/answers} +install -dm 755 "%{buildroot}/%{engine_state}"/{content,setup/answers} install -dm 755 "%{buildroot}/%{engine_log}"/{host-deploy,setup,notifier,engine-manage-domains,dump} install -dm 755 "%{buildroot}/%{engine_cache}" install -dm 755 "%{buildroot}/%{engine_run}/notifier" @@ -798,7 +798,6 @@ %attr(-, %{engine_user}, %{engine_group}) %{engine_log}/host-deploy %attr(-, %{engine_user}, %{engine_group}) %{engine_state}/content -%attr(-, %{engine_user}, %{engine_group}) %{engine_state}/deployments %config %{_sysconfdir}/logrotate.d/ovirt-engine %config(noreplace) %{engine_etc}/sysprep %dir %attr(-, %{engine_user}, %{engine_group}) %{engine_state} diff --git a/packaging/services/ovirt-engine/ovirt-engine.py b/packaging/services/ovirt-engine/ovirt-engine.py index c7b0f0f..f506781 100755 --- a/packaging/services/ovirt-engine/ovirt-engine.py +++ b/packaging/services/ovirt-engine/ovirt-engine.py @@ -15,7 +15,6 @@ # limitations under the License. -import glob import os import sys import re @@ -55,7 +54,19 @@ with open(out, 'w') as f: if mode is not None: os.chmod(out, mode) - f.write(str(Template(file=template, searchList=[self._config]))) + f.write( + '%s' % ( + Template( + file=template, + searchList=[ + self._config, + { + 'tempdir': self._tempDir.directory, + }, + ], + ) + ), + ) return out def _linkModules(self, directory, modulePath): @@ -132,15 +143,6 @@ writable=True, mustExist=False, ) - for dir in ('.', 'content', 'deployments'): - self.check( - os.path.join( - self._config.get('ENGINE_VAR'), - dir - ), - directory=True, - writable=True, - ) self.check( self._config.get('ENGINE_LOG'), directory=True, @@ -169,6 +171,12 @@ def _setupEngineApps(self): + deploymentsDir = os.path.join( + self._tempDir.directory, + 'deployments', + ) + os.mkdir(deploymentsDir) + # The list of applications to be deployed: for engineAppDir in self._config.get('ENGINE_APPS').split(): self.logger.debug('Deploying: %s', engineAppDir) @@ -188,61 +196,13 @@ ) continue - # Make sure the application is linked in the deployments - # directory, if not link it now: engineAppLink = os.path.join( - self._config.get('ENGINE_VAR'), - 'deployments', + deploymentsDir, os.path.basename(engineAppDir), ) - if not os.path.islink(engineAppLink): - try: - os.symlink(engineAppDir, engineAppLink) - except OSError as e: - self.logger.debug('exception', exc_info=True) - raise RuntimeError( - _( - "Cannot create symbolic link '{file}': " - "{error}" - ).format( - file=engineAppLink, - error=e, - ), - ) - - # Remove all existing deployment markers: - for markerFile in glob.glob('%s.*' % engineAppLink): - try: - os.remove(markerFile) - except OSError as e: - self.logger.debug('exception', exc_info=True) - raise RuntimeError( - _( - "Cannot remove deployment marker file '{file}': " - "{error}" - ).format( - file=markerFile, - error=e, - ), - ) - - # Create the new marker file to trigger deployment - # of the application: - markerFile = "%s.dodeploy" % engineAppLink - try: - with open(markerFile, "w"): - pass - except IOError as e: - self.logger.debug('exception', exc_info=True) - raise RuntimeError( - _( - "Cannot create deployment marker file '{file}': " - "{error}" - ).format( - file=markerFile, - error=e, - ) - ) + os.symlink(engineAppDir, engineAppLink) + with open('%s.dodeploy' % engineAppLink, 'w'): + pass def daemonSetup(self): diff --git a/packaging/services/ovirt-engine/ovirt-engine.xml.in b/packaging/services/ovirt-engine/ovirt-engine.xml.in index 0b335dc..48485cd 100644 --- a/packaging/services/ovirt-engine/ovirt-engine.xml.in +++ b/packaging/services/ovirt-engine/ovirt-engine.xml.in @@ -167,7 +167,7 @@ </subsystem> <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1"> - <deployment-scanner scan-interval="5000" path="$getstring('ENGINE_VAR')/deployments"/> + <deployment-scanner scan-interval="5000" path="$tempdir/deployments"/> </subsystem> <subsystem xmlns="urn:jboss:domain:ee:1.0"/> -- To view, visit http://gerrit.ovirt.org/23278 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I17e7bc91229e9b05e6fb719a9c15c1036a3ba19b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches