[PATCH conductor] Add schema.rb back to .gitignore
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
Chris' latest patch accidentally removed the schema.rb file from .gitignore.
This puts it back in.
---
.gitignore | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 7b7e496..3030ad6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ database.yml
*~
*.swp
+src/db/schema.rb
# compass compiled and temporary files
src/tmp
--
1.7.4.4
13 years
(no subject)
by Tomas Hrcka
Implements Task #1527, I have also added src/.idea to gitignore because I am using RubyMine.
13 years
[PATCH] Remove condor_refreshd.
by Chris Lalancette
As pointed out by Mark McLoughlin, the whole system for
doing matching was much too complicated. Matching is a
pretty simple problem, so instead of letting condor do
it, just do it inline in the conductor. We still use
condor to launch and monitor the jobs.
Doing this saves us 750 lines of code, allows us to get rid
of condor_refreshd, allows us to get rid of the quota plugin,
and lets us get rid of autotools. This makes the whole
system much simpler and more reliable.
This version removes password file support and fixes rpm
version (0.2.0 -> 0.3.0) so rpms upgrade properly - Ian.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
.gitignore | 15 +-
Makefile | 68 +++++
Makefile.am | 68 -----
aeolus-all.spec.in | 2 +
aeolus-conductor.spec.in | 25 +--
autogen.sh | 68 -----
conf/aeolus-conductor.logrotate | 7 -
conf/conductor-condor_refreshd | 78 -----
configure.ac | 48 ---
.../controllers/hardware_profiles_controller.rb | 4 -
src/app/controllers/image_imports_controller.rb | 1 -
.../controllers/provider_accounts_controller.rb | 2 -
src/app/controllers/providers_controller.rb | 3 -
src/app/util/condormatic.rb | 299 ++++++--------------
src/classad_plugin/Makefile.am | 15 -
src/classad_plugin/conductor_classad_plugin.cpp | 221 ---------------
src/condor_refreshd/condor_refreshd | 137 ---------
17 files changed, 163 insertions(+), 898 deletions(-)
create mode 100644 Makefile
delete mode 100644 Makefile.am
delete mode 100755 autogen.sh
delete mode 100755 conf/conductor-condor_refreshd
delete mode 100644 configure.ac
delete mode 100644 src/classad_plugin/Makefile.am
delete mode 100644 src/classad_plugin/conductor_classad_plugin.cpp
delete mode 100755 src/condor_refreshd/condor_refreshd
diff --git a/.gitignore b/.gitignore
index 1002928..7b7e496 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,18 +1,5 @@
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache
-config.h
-config.h.in
-config.log
-config.status
-configure
-depcomp
-install-sh
-missing
-stamp-h1
+aeolus-all.spec
aeolus-conductor.spec
-schema.rb
log/
database.yml
.project
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f3a40f4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,68 @@
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA. A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+CONDUCTOR_CACHE_DIR ?= $(HOME)/conductor-cache
+
+VERSION = 0.3.0
+
+# For Release: 0..., set _conductor_dev=1 so that we get extra_release.GIT-
+# annotated rpm version strings.
+_conductor_dev = $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
+ aeolus-conductor.spec.in && echo 1 || :)
+
+# use $(shell...) here to collect the git head and date *once* per make target.
+# that ensures that if multiple actions happen in the same target (like the
+# multiple RPM builds in the rpms target), they all use the same date
+git_head = $(shell git log -1 --pretty=format:%h)
+date = $(shell date --utc +%Y%m%d%H%M%S)
+GIT_RELEASE = $(date)git$(git_head)
+RPMDIR = $$(rpm --eval '%{_rpmdir}')
+RPM_FLAGS = --define "conductor_cache_dir $(CONDUCTOR_CACHE_DIR)"
+RPM_FLAGS += $(if $(_conductor_dev),--define "extra_release .$(GIT_RELEASE)")
+RAKE_EXTRA_RELEASE = $(if $(_conductor_dev),"extra_release=.$(GIT_RELEASE)")
+
+dist:
+ sed -e 's/@VERSION@/$(VERSION)/' aeolus-all.spec.in > aeolus-all.spec
+ sed -e 's/@VERSION@/$(VERSION)/' aeolus-conductor.spec.in > aeolus-conductor.spec
+ mkdir -p dist/aeolus-conductor-$(VERSION)
+ cp -a aeolus-conductor.spec AUTHORS conf COPYING Makefile src \
+ dist/aeolus-conductor-$(VERSION)
+ tar -C dist -zcvf aeolus-conductor-$(VERSION).tar.gz aeolus-conductor-$(VERSION)
+
+
+rpms: dist
+ cd services/image_factory/console; rake rpms $(RAKE_EXTRA_RELEASE)
+ cd services/image_factory/image_factory_connector; rake rpms $(RAKE_EXTRA_RELEASE)
+ rpmbuild $(RPM_FLAGS) -ta aeolus-conductor-$(VERSION).tar.gz
+ rpmbuild $(RPM_FLAGS) -ba aeolus-all.spec
+
+srpms: dist
+ rpmbuild $(RPM_FLAGS) -ts aeolus-conductor-$(VERSION).tar.gz
+
+publish: rpms
+ mkdir -p $(CONDUCTOR_CACHE_DIR)
+ rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(CONDUCTOR_CACHE_DIR)/conductor/
+ rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(CONDUCTOR_CACHE_DIR)/conductor/src
+ createrepo $(CONDUCTOR_CACHE_DIR)/conductor
+
+genlangs:
+ cd src && rake updatepo && rake makemo
+
+clean:
+ rm -rf dist aeolus-conductor-$(VERSION).tar.gz aeolus-all.spec aeolus-conductor.spec
+
+.PHONY: dist rpms publish srpms genlangs
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index de2d888..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright (C) 2008 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-CONDUCTOR_CACHE_DIR ?= $(HOME)/conductor-cache
-
-EXTRA_DIST = \
- .gitignore \
- aeolus-conductor.spec \
- aeolus-conductor.spec.in \
- conf \
- src
-
-DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz
-
-# For Release: 0..., set _conductor_dev=1 so that we get extra_release.GIT-
-# annotated rpm version strings.
-_conductor_dev = \
- $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \
- $(srcdir)/*.spec.in && echo 1 || :)
-
-# use $(shell...) here to collect the git head and date *once* per make target.
-# that ensures that if multiple actions happen in the same target (like the
-# multiple RPM builds in the rpms target), they all use the same date
-git_head = $(shell git log -1 --pretty=format:%h)
-date = $(shell date --utc +%Y%m%d%H%M%S)
-GIT_RELEASE = $(date)git$(git_head)
-RPMDIR = $$(rpm --eval '%{_rpmdir}')
-RPM_FLAGS = --define "conductor_cache_dir $(CONDUCTOR_CACHE_DIR)"
-RPM_FLAGS += $(if $(_conductor_dev),--define "extra_release .$(GIT_RELEASE)")
-RAKE_EXTRA_RELEASE = $(if $(_conductor_dev),"extra_release=.$(GIT_RELEASE)")
-
-SUBDIRS = src/classad_plugin
-
-ACLOCAL_AMFLAGS = -I m4
-
-rpms: dist
- cd services/image_factory/console; rake rpms $(RAKE_EXTRA_RELEASE)
- cd services/image_factory/image_factory_connector; rake rpms $(RAKE_EXTRA_RELEASE)
- rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
- rpmbuild $(RPM_FLAGS) -ba aeolus-all.spec
-
-srpms: dist
- rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz
-
-publish: rpms
- mkdir -p $(CONDUCTOR_CACHE_DIR)
- rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(CONDUCTOR_CACHE_DIR)/conductor/
- rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(CONDUCTOR_CACHE_DIR)/conductor/src
- createrepo $(CONDUCTOR_CACHE_DIR)/conductor
-
-genlangs:
- cd src && rake updatepo && rake makemo
-
-.PHONY: rpms publish srpms genlangs
diff --git a/aeolus-all.spec.in b/aeolus-all.spec.in
index aac9657..c23ae9b 100644
--- a/aeolus-all.spec.in
+++ b/aeolus-all.spec.in
@@ -18,6 +18,8 @@ Requires: rubygem(image_factory_connector)
Requires: mongodb-server
Requires: mod_ssl
+BuildArch: noarch
+
%description
This is the aeolus meta-package. If you want to install aeolus and all of its
dependencies on a single machine, you should install this package and then
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 42913f1..006bad6 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -39,19 +39,12 @@ Requires: rubygem(uuidtools)
Requires: postgresql
Requires: postgresql-server
Requires: ruby-postgres
-Requires: classads >= 1.0
-Requires: glib2 >= 2.0
-Requires: rest >= 0.6
# to ensure the service is actually started
# and is accessible in the init script
Requires: curl
-BuildRequires: ruby
-BuildRequires: ruby-devel
-BuildRequires: classads-devel >= 1.0
-BuildRequires: glib2-devel >= 2.0
-BuildRequires: rest-devel >= 0.6
+BuildArch: noarch
%description
The Aeolus Conductor, a web UI for managing cloud instances.
@@ -99,8 +92,6 @@ Tests and other development tools for the Aeolus Conductor.
%setup -q
%build
-%configure
-make
%pre
getent group aeolus >/dev/null || /usr/sbin/groupadd -g 451 -r aeolus 2>/dev/null || :
@@ -123,9 +114,6 @@ getent passwd aeolus >/dev/null || \
%{__mkdir} -p %{buildroot}%{_localstatedir}/log/%{name}
%{__mkdir} -p %{buildroot}%{_localstatedir}/run/%{name}
-# this will install the classad plugin
-%makeinstall
-
# now copy over the rails source files. This is a bit verbose, but only
# takes in the stuff we need (and no backup files, etc)
@@ -209,16 +197,12 @@ done
%{__mkdir} -p %{buildroot}%{app_root}/warehouse_sync
%{__cp} src/warehouse_sync/warehouse_sync-server %{buildroot}%{app_root}/warehouse_sync
-%{__mkdir} -p %{buildroot}%{app_root}/condor_refreshd
-%{__cp} src/condor_refreshd/condor_refreshd %{buildroot}%{app_root}/condor_refreshd
-
# move documentation to the correct place
%{__cp} src/doc/* %{buildroot}/%{doc_root}
# copy over init scripts and various config
%{__cp} conf/aeolus-conductor %{buildroot}%{_initrddir}
%{__cp} conf/conductor-dbomatic %{buildroot}%{_initrddir}
-%{__cp} conf/conductor-condor_refreshd %{buildroot}%{_initrddir}
%{__cp} conf/conductor-warehouse_sync %{buildroot}%{_initrddir}
%{__cp} conf/conductor-delayed_job %{buildroot}%{_initrddir}
%{__cp} conf/aeolus-conductor-httpd.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/aeolus-conductor.conf
@@ -236,7 +220,6 @@ touch %{buildroot}%{_localstatedir}/log/%{name}/mongrel.log
touch %{buildroot}%{_localstatedir}/log/%{name}/rails.log
touch %{buildroot}%{_localstatedir}/log/%{name}/dbomatic.log
touch %{buildroot}%{_localstatedir}/run/%{name}/event_log_position
-touch %{buildroot}%{_localstatedir}/log/%{name}/condor_refreshd.log
touch %{buildroot}%{_localstatedir}/log/%{name}/warehouse_sync.log
%{__mkdir} -p %{buildroot}%{app_root}/log
@@ -280,7 +263,6 @@ fi
# Register the services
/sbin/chkconfig --add aeolus-conductor
/sbin/chkconfig --add conductor-dbomatic
-/sbin/chkconfig --add conductor-condor_refreshd
/sbin/chkconfig --add conductor-warehouse_sync
/sbin/chkconfig --add conductor-delayed_job
@@ -290,8 +272,6 @@ if [ $1 = 0 ]; then
/sbin/chkconfig --del aeolus-conductor
/sbin/service conductor-dbomatic stop > /dev/null 2>&1
/sbin/chkconfig --del conductor-dbomatic
- /sbin/service conductor-condor_refreshd stop > /dev/null 2>&1
- /sbin/chkconfig --del conductor-condor_refreshd
/sbin/service conductor-warehouse_sync stop > /dev/null 2>&1
/sbin/chkconfig --del conductor-warehouse_sync
/sbin/service conductor-delayed_job stop > /dev/null 2>&1
@@ -302,8 +282,6 @@ fi
%defattr(-,root,root,-)
%dir %{app_root}
%{app_root}/app
-%{app_root}/classad_plugin
-%{app_root}/condor_refreshd
%{app_root}/config
%{app_root}/config.ru
%{app_root}/db
@@ -323,7 +301,6 @@ fi
%defattr(-,root,root,-)
%{_initrddir}/aeolus-conductor
%{_initrddir}/conductor-dbomatic
-%{_initrddir}/conductor-condor_refreshd
%{_initrddir}/conductor-warehouse_sync
%{_initrddir}/conductor-delayed_job
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 24aae29..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-# Run this to generate configure and Makefile
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-THEDIR=`pwd`
-(
- cd $srcdir
- die=0
-
- (autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "You must have autoconf installed."
- echo "Download the appropriate package for your distribution,"
- echo "or see http://www.gnu.org/software/autoconf"
- die=1
- }
-
- # Require libtool only if one of of LT_INIT,
- # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac.
- grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \
- && {
- (libtool --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "You must have libtool installed."
- echo "Download the appropriate package for your distribution,"
- echo "or see http://www.gnu.org/software/libtool"
- die=1
- }
- }
-
- (automake --version) < /dev/null > /dev/null 2>&1 || {
- echo
- die=1
- echo "You must have automake installed."
- echo "Download the appropriate package for your distribution,"
- echo "or see http://www.gnu.org/software/automake"
- }
-
- test $die = 1 && exit 1
-
- test -f aeolus-conductor.spec.in || {
- echo "You must run this script in the top-level directory"
- exit 1
- }
-
- if test -z "$*"; then
- echo "I am going to run ./configure with no arguments - if you wish "
- echo "to pass any to it, please specify them on the $0 command line."
- fi
-
- libtoolize --force
- aclocal
-
- # Run autoheader only if needed
- grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader
-
- autoheader
- autoconf
- automake --add-missing
- ./configure "$@"
-)
-
-if test "x$OBJ_DIR" != x; then
- mkdir -p "$OBJ_DIR"
- cd "$OBJ_DIR"
-fi
diff --git a/conf/aeolus-conductor.logrotate b/conf/aeolus-conductor.logrotate
index 47971d7..312f09b 100644
--- a/conf/aeolus-conductor.logrotate
+++ b/conf/aeolus-conductor.logrotate
@@ -18,13 +18,6 @@ notifempty
endscript
}
-/var/log/aeolus-conductor/condor_refreshd.log {
- sharedscripts
- postrotate
- /etc/init.d/conductor-condor_refreshd restart
- endscript
-}
-
/var/log/aeolus-conductor/dbomatic.log {
sharedscripts
postrotate
diff --git a/conf/conductor-condor_refreshd b/conf/conductor-condor_refreshd
deleted file mode 100755
index 0bdd369..0000000
--- a/conf/conductor-condor_refreshd
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/bash
-#
-#
-# conductor-condor_refreshd startup script for conductor-condor_refreshd
-#
-# chkconfig: - 99 01
-# description: conductor-condor_refreshd populates the Conductor scheduler
-# from the Aeolus Conductor db
-
-[ -r /etc/sysconfig/conductor-rails ] && . /etc/sysconfig/conductor-rails
-
-[ -r /etc/sysconfig/aeolus-conductor ] && . /etc/sysconfig/aeolus-conductor
-
-CONDUCTOR_DIR="${CONDUCTOR_DIR:-/usr/share/aeolus-conductor}"
-REFRESHD_LOG="${REFRESHD_LOG:-/var/log/aeolus-conductor/condor_refreshd.log}"
-REFRESHD_PID="${REFRESHD_PID:-/var/run/aeolus-conductor/condor_refreshd.pid}"
-REFRESHD_LOCKFILE="${REFRESHD_LOCKFILE:-/var/lock/subsys/conductor-condor_refreshd}"
-AEOLUS_USER="${AEOLUS_USER:-aeolus}"
-
-REFRESHD_PATH=$CONDUCTOR_DIR/condor_refreshd
-REFRESHD_PROG=condor_refreshd
-
-. /etc/init.d/functions
-
-start() {
- echo -n "Starting conductor-condor_refreshd: "
-
- daemon --user=$AEOLUS_USER $REFRESHD_PATH/$REFRESHD_PROG
- RETVAL=$?
- if [ $RETVAL -eq 0 ] && touch $REFRESHD_LOCKFILE ; then
- echo_success
- echo
- else
- echo_failure
- echo
- fi
-}
-
-stop() {
- echo -n "Shutting down conductor-condor_refreshd: "
- killproc -p $REFRESHD_PID $REFRESHD_PROG
- RETVAL=$?
- if [ $RETVAL -eq 0 ] && rm -f $REFRESHD_LOCKFILE ; then
- echo_success
- echo
- else
- echo_failure
- echo
- fi
-}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- stop
- start
- ;;
- reload)
- ;;
- force-reload)
- restart
- ;;
- status)
- status -p $REFRESHD_PID $REFRESHD_PROG
- RETVAL=$?
- ;;
- *)
- echo "Usage: conductor-condor_refreshd {start|stop|restart|status}"
- exit 1
- ;;
-esac
-
-exit $RETVAL
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 8fa5849..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,48 +0,0 @@
-AC_INIT([aeolus-conductor], [0.3.0], [aeolus-devel(a)lists.fedorahosted.org])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax])
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_MACRO_DIR([m4])
-
-AC_PROG_CXX
-AC_PROG_CC
-AC_PROG_LIBTOOL
-AC_LANG([C++])
-
-AC_ARG_ENABLE(local,
- [ --enable-local Set this flag if you are planning to run the conductor without installing it.],
- [ CONDUCTOR_INSTALL_DIR=`pwd`/src ], [ CONDUCTOR_INSTALL_DIR=$datadir/aeolus-conductor ])
-AC_SUBST(CONDUCTOR_INSTALL_DIR)
-
-dnl
-dnl check for classads-devel
-dnl
-
-CLASSADS_REQUIRED=1.0.4
-
-AC_ARG_WITH([classads], AC_HELP_STRING([--with-classads=@<:@PFX@:>@],
- [classads location]))
-
-if test "x$with_classads" = xno ; then
- AC_MSG_CHECKING([for classads libraries >= $CLASSADS_REQUIRED])
- AC_MSG_ERROR([classads >= $CLASSADS_REQUIRED is required for conductor])
-elif test "x$with_classads" = "x"; then
- fail=0
- AC_CHECK_HEADERS([classad/classad_distribution.h],, [fail=1],[])
- if test $fail = 1; then
- AC_MSG_ERROR([You must install the classads development package to compile the conductor])
- fi
-fi
-
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.18)
-PKG_CHECK_MODULES(SOUP, libsoup-2.4)
-PKG_CHECK_MODULES(XML, libxml-2.0)
-PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
-PKG_CHECK_MODULES(REST, rest-0.6)
-
-# If using gcc and default CFLAGS, enable some warnings.
-test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \
- && CFLAGS="$CFLAGS -Wshadow -Wall -Werror"
-
-AC_CONFIG_FILES([Makefile aeolus-conductor.spec aeolus-all.spec])
-AC_OUTPUT(src/classad_plugin/Makefile)
-
diff --git a/src/app/controllers/hardware_profiles_controller.rb b/src/app/controllers/hardware_profiles_controller.rb
index 6bbbc90..710c05e 100644
--- a/src/app/controllers/hardware_profiles_controller.rb
+++ b/src/app/controllers/hardware_profiles_controller.rb
@@ -71,11 +71,9 @@ class HardwareProfilesController < ApplicationController
matching_provider_hardware_profiles
render :action => 'new'
end
- kick_condor
end
def delete
- kick_condor
end
def edit
@@ -106,12 +104,10 @@ class HardwareProfilesController < ApplicationController
flash[:notice] = "Hardware Profile updated!"
redirect_to hardware_profiles_path
end
- kick_condor
end
def multi_destroy
HardwareProfile.destroy(params[:hardware_profile_selected])
- kick_condor
redirect_to hardware_profiles_path
end
diff --git a/src/app/controllers/image_imports_controller.rb b/src/app/controllers/image_imports_controller.rb
index 8cff787..90602d3 100644
--- a/src/app/controllers/image_imports_controller.rb
+++ b/src/app/controllers/image_imports_controller.rb
@@ -10,7 +10,6 @@ class ImageImportsController < ApplicationController
Image.import(ProviderAccount.find(params[:provider_account_id]), params[:ami_id], current_user)
flash[:notice]="Image successfully imported"
redirect_to templates_path
- kick_condor
rescue Exception => e
init_provider_vars
# The full message may be multiple lines, including the actual request, so only include the first line:
diff --git a/src/app/controllers/provider_accounts_controller.rb b/src/app/controllers/provider_accounts_controller.rb
index 1fa0277..9ae24c9 100644
--- a/src/app/controllers/provider_accounts_controller.rb
+++ b/src/app/controllers/provider_accounts_controller.rb
@@ -72,7 +72,6 @@ class ProviderAccountsController < ApplicationController
flash[:notice] = "Provider account added."
end
redirect_to provider_account_path(@provider_account)
- kick_condor
end
def edit
@@ -125,7 +124,6 @@ class ProviderAccountsController < ApplicationController
unless failed.empty?
flash[:error] = t 'provider_accounts.index.account_not_deleted', :count => failed.length, :list => failed.join(', ')
end
- kick_condor
redirect_to provider_accounts_url
end
diff --git a/src/app/controllers/providers_controller.rb b/src/app/controllers/providers_controller.rb
index f2ad3bf..2278896 100644
--- a/src/app/controllers/providers_controller.rb
+++ b/src/app/controllers/providers_controller.rb
@@ -72,7 +72,6 @@ class ProvidersController < ApplicationController
flash[:notice] = "Cannot add the provider."
render :action => "new"
end
- kick_condor
end
end
@@ -91,7 +90,6 @@ class ProvidersController < ApplicationController
flash[:notice] = "Cannot update the provider."
render :action => 'edit'
end
- kick_condor
end
end
@@ -99,7 +97,6 @@ class ProvidersController < ApplicationController
Provider.find(params[:provider_selected]).each do |provider|
provider.destroy if check_privilege(Privilege::MODIFY, provider)
end
- kick_condor
redirect_to providers_url
end
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index de92dce..488dd6d 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2010 Red Hat, Inc.
+# Copyright (C) 2010,2011 Red Hat, Inc.
# Written by Ian Main <imain(a)redhat.com>
#
# This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,67 @@
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
-require 'nokogiri'
-require 'socket'
+require 'fileutils'
+require 'tempfile'
+
+class Possible
+ attr_reader :pool_family, :account, :hwp, :provider_image, :realm
+
+ def initialize(pool_family, account, hwp, provider_image, realm)
+ @pool_family = pool_family
+ @account = account
+ @hwp = hwp
+ @provider_image = provider_image
+ @realm = realm
+ end
+end
+
+def match(instance)
+ possibles = []
+
+ template_id = instance.template ? instance.template.id : instance.assembly.templates.first.id
+
+ PoolFamily.all.each do |pool_family|
+ if instance.pool.pool_family.id != pool_family.id
+ next
+ end
+
+ pool_family.provider_accounts.each do |account|
+ # match_provider_hardware_profile returns a single provider
+ # hardware_profile that can satisfy the input hardware_profile
+ hwp = HardwareProfile.match_provider_hardware_profile(account.provider,
+ instance.hardware_profile)
+
+ provider_images = hwp.provider.provider_images.find(:all,
+ :conditions => ['provider_image_key IS NOT NULL'])
+ provider_images.each do |pi|
+ if pi.image.template.id != template_id
+ next
+ end
+
+ if not instance.frontend_realm.nil?
+ instance.frontend_realm.realm_backend_targets.each do |brealm|
+ possibles << Possible.new(pool_family, account, hwp, pi,
+ brealm.realm)
+ end
+ else
+ possibles << Possible.new(pool_family, account, hwp, pi, nil)
+ end
+ end
+ end
+ end
+
+ possibles.each do |match|
+ # FIXME: we should have something smarter here that prioritizes
+ # and/or chooses the "cheapest" possibility. For now, just return the
+ # first that fits under quota
+ if Quota.can_create_instance?(instance, match.account)
+ return match
+ end
+ end
+
+ return nil
+end
def pipe_and_log(pipe, instr)
pipe.puts instr
@@ -26,15 +85,22 @@ def pipe_and_log(pipe, instr)
end
def condormatic_instance_create(task)
+ instance = task.instance
+ found = match(instance)
begin
- instance = task.instance
- realm = instance.frontend_realm rescue nil
+ if found.nil?
+ Rails.logger.error "Couldn't find a match!"
+ raise ("Could not find a matching backend provider")
+ end
job_name = "job_#{instance.name}_#{instance.id}"
instance.condor_job_id = job_name
- instance.save!
+
+ overrides = HardwareProfile.generate_override_property_values(instance.hardware_profile,
+ found.hwp)
+ keyname = found.account.instance_key ? found.account.instance_key.name : ''
# I use the 2>&1 to get stderr and stdout together because popen3 does not
# support the ability to get the exit value of the command in ruby 1.8.
@@ -42,37 +108,27 @@ def condormatic_instance_create(task)
pipe_and_log(pipe, "universe = grid\n")
pipe_and_log(pipe, "executable = #{job_name}\n")
- pipe_and_log(pipe, "grid_resource = deltacloud $$(provider_url)\n")
- pipe_and_log(pipe, "DeltacloudUsername = $$(username)\n")
- pipe_and_log(pipe, "DeltacloudPassword = $$(password)\n")
- pipe_and_log(pipe, "DeltacloudImageId = $$(image_key)\n")
- pipe_and_log(pipe, "DeltacloudHardwareProfile = $$(hardware_profile_key)\n")
pipe_and_log(pipe,
- "DeltacloudHardwareProfileMemory = $$(hardware_profile_memory)\n")
+ "grid_resource = deltacloud #{found.account.provider.url}\n")
+ pipe_and_log(pipe, "DeltacloudUsername = #{found.account.credentials_hash['username']}\n")
+ pipe_and_log(pipe, "DeltacloudPassword = #{found.account.credentials_hash['password']}")
+ pipe_and_log(pipe, "DeltacloudImageId = #{found.provider_image.provider_image_key}\n")
+ pipe_and_log(pipe,
+ "DeltacloudHardwareProfile = #{found.hwp.external_key}\n")
pipe_and_log(pipe,
- "DeltacloudHardwareProfileCPU = $$(hardware_profile_cpu)\n")
+ "DeltacloudHardwareProfileMemory = #{overrides[:memory]}\n")
pipe_and_log(pipe,
- "DeltacloudHardwareProfileStorage = $$(hardware_profile_storage)\n")
- pipe_and_log(pipe, "DeltacloudKeyname = $$(keypair)\n")
- pipe_and_log(pipe, "DeltacloudPoolFamily = $$(pool_family)\n")
+ "DeltacloudHardwareProfileCPU = #{overrides[:cpu]}\n")
+ pipe_and_log(pipe,
+ "DeltacloudHardwareProfileStorage = #{overrides[:storage]}\n")
+ pipe_and_log(pipe, "DeltacloudKeyname = #{keyname}\n")
+ pipe_and_log(pipe, "DeltacloudPoolFamily = #{found.pool_family.id}\n")
- if realm != nil
- pipe_and_log(pipe, "DeltacloudRealmId = $$(realm_key)\n")
+ if found.realm != nil
+ pipe_and_log(pipe, "DeltacloudRealmId = #{found.realm.external_key}\n")
end
- # TODO: for assemblies we grab first template in an assembly
- template_id = instance.template ? instance.template.id : instance.assembly.templates.first.id
- requirements = "requirements = front_end_hardware_profile_id == \"#{instance.hardware_profile.id}\" && image == \"#{template_id}\""
- requirements += " && pool_family == \"#{instance.pool.pool_family.id}\""
- requirements += " && realm == \"#{realm.id}\"" if realm != nil
- # Call into the deltacloud quota plugin. This uses a REST API to call back into the
- # conductor to check quotas as the last thing in the logical AND to match a provider
- # account.
- requirements += " && conductor_quota_check(#{instance.id}, other.provider_account_id)"
- requirements += "\n"
-
- pipe_and_log(pipe, requirements)
-
+ pipe_and_log(pipe, "requirements = true\n")
pipe_and_log(pipe, "notification = never\n")
pipe_and_log(pipe, "queue\n")
@@ -84,47 +140,15 @@ def condormatic_instance_create(task)
raise ("Error calling condor_submit: #{out}") if $? != 0
rescue Exception => ex
- task.state = Task::STATE_FAILED
Rails.logger.error ex.message
Rails.logger.error ex.backtrace
+ task.state = Task::STATE_FAILED
+ instance.state = Instance::STATE_CREATE_FAILED
else
- # FIXME: We're kinda lying here.. we don't know the state for the task but I don't think that matters so much
- # as we are just going to use the 'task' table as a kind of audit log.
task.state = Task::STATE_PENDING
end
- task.instance.save!
-end
-
-# JobStatus for condor jobs:
-#
-# 0 Unexpanded U
-# 1 Idle I
-# 2 Running R
-# 3 Removed X
-# 4 Completed C
-# 5 Held H
-# 6 Submission_err E
-#
-
-def condor_to_instance_state(state_val)
- case state_val
- when '0'
- return Instance::STATE_PENDING
- when '1'
- return Instance::STATE_PENDING
- when '2'
- return Instance::STATE_RUNNING
- when '3'
- return Instance::STATE_STOPPED
- when '4'
- return Instance::STATE_STOPPED
- when '5'
- return Instance::STATE_ERROR
- when '6'
- return Instance::STATE_CREATE_FAILED
- else
- return Instance::STATE_PENDING
- end
+ instance.save!
+ task.save!
end
def condormatic_instance_stop(task)
@@ -162,144 +186,3 @@ def condormatic_instance_destroy(task)
Rails.logger.info("condor_rm return status is #{$?}")
Rails.logger.error("Error calling condor_rm (exit code #{$?}) on job: #{out}") if $? != 0
end
-
-
-def condormatic_classads_sync
- Rails.logger.info "Starting condormatic_classads_sync..."
- index = 0
- providers = Provider.find(:all)
-
-
- # we first need to invalidate old ADS
- # FIXME: this invalidates *all* ads, including those not really
- # related to deltacloud. It would be best if we could find a
- # way to restrict the classads that we actually invalidate,
- # but it seems that the invalidate only matches against Name,
- # Machine, and SlotID. Unfortunately classads don't seem to
- # have a regex match, so we can't regex match on Name. My
- # attempts with Machine also failed, for unknown reasons.
- #
- # The other way we could go about invalidating the ones
- # we care about is with something like:
- #
- # condor_status -startd -f "%s\n" Name
- #
- # which will show only the names of the startd classads.
- # Then we could do the regex matching in ruby, and iterate
- # through the provider_combination_* ones. This is a bit
- # racy, though, so I'm more inclined to just invalidate
- # everything at present.
- Rails.logger.info "Starting classad invalidate..."
- begin
- pipe = IO.popen("condor_advertise INVALIDATE_STARTD_ADS 2>&1", "w+")
- pipe.puts 'MyType="Query"'
- pipe.puts 'TargetType="Machine"'
- pipe.close_write
- out = pipe.read
- pipe.close
-
- Rails.logger.info "Did invalidate, output is #{out}"
-
- if $? != 0
- Rails.logger.error "Unable to invalidate classads: #{out}"
- raise "Unable to invalidate classads, classad sync failed"
- end
- rescue Errno::EPIPE
- # if we failed to run condor_advertise, then in all likelihood condor isn't
- # installed or isn't running. In that case, there can't be any old
- # classads, so we just go on
- end
-
- Rails.logger.info "Syncing classads.."
- ads = []
-
- front_end_hardware_profiles = HardwareProfile.find(:all, :conditions => ["provider_id IS NULL"])
-
- PoolFamily.all.each do |pool_family|
- pool_family.provider_accounts.each do |account|
- # The provider image entry gets put in the database as soon as we ask
- # to have the image built, so we only want to generate classads for it if
- # it is ready to be used. When ready it will have an image key assigned
- # to it.
- provider_images = account.provider.provider_images.find(:all,
- :conditions => ['provider_image_key IS NOT NULL'])
- realms = account.provider.realms
-
- provider_images.each do |provider_img|
- front_end_hardware_profiles.each do |hwp|
- # when user doesn't select any realm
- ads << [account, provider_img, hwp, nil, nil, pool_family]
- # add all backend->frontend mappings
- realms.each do |realm|
- ads += realm.frontend_realms.collect { |frealm|
- [account, provider_img, hwp, realm, frealm, pool_family] }
- end
- # frontend can be mapped to provider (then backend realm is set to
- # nil)
- ads += account.provider.frontend_realms.collect { |frealm|
- [account, provider_img, hwp, nil, frealm, pool_family] }
- end
- end
- end
- end
-
- ads.each { |ad|
- account, provider_image, hwp, realm, frontend_realm, pool_family = *ad
-
- matching_hardware_profile = HardwareProfile.match_provider_hardware_profile(account.provider, hwp)
- if(matching_hardware_profile != nil) && (provider_image.image.template.architecture == hwp.architecture.value)
- overrides = HardwareProfile.generate_override_property_values(hwp, matching_hardware_profile)
- pipe = IO.popen("condor_advertise UPDATE_STARTD_AD 2>&1", "w+")
-
- begin
- pipe.puts "Name=\"provider_combination_#{index}\""
- pipe.puts 'MyType="Machine"'
- pipe.puts 'Requirements=true'
- pipe.puts "\n# Stuff needed to match:"
- pipe.puts "front_end_hardware_profile_id=\"#{hwp.id}\""
- pipe.puts "image=\"#{provider_image.image.template.id}\""
- pipe.puts "realm=\"#{frontend_realm ? frontend_realm.id : ''}\""
- pipe.puts "\n# Backend info to complete this job:"
- pipe.puts "image_key=\"#{provider_image.provider_image_key}\""
- pipe.puts "hardware_profile_key=\"#{matching_hardware_profile.external_key}\""
- pipe.puts "hardware_profile_memory=\"#{overrides[:memory]}\""
- pipe.puts "hardware_profile_storage=\"#{overrides[:storage]}\""
- pipe.puts "hardware_profile_cpu=\"#{overrides[:cpu]}\""
- pipe.puts "realm_key=\"#{realm ? realm.external_key : ''}\""
- pipe.puts "provider_url=\"#{account.provider.url}\""
- pipe.puts "username=\"#{account.credentials_hash['username']}\""
- pipe.puts "password=\"#{account.credentials_hash['password']}\""
- pipe.puts "provider_account_id=\"#{account.id}\""
- pipe.puts "keypair=\"#{account.instance_key ? account.instance_key.name : ''}\""
- pipe.puts "pool_family=\"#{pool_family.id}\""
- rescue Exception => ex
- Rails.logger.error "Error writing provider classad to condor."
- Rails.logger.error ex.message
- Rails.logger.error ex.backtrace
- end
- pipe.close_write
-
- out = pipe.read
- pipe.close
-
- Rails.logger.error "Unable to submit condor classad: #{out}" if $? != 0
-
- index += 1
- end
- }
- Rails.logger.info "done"
-end
-
-def kick_condor
- begin
- socket = UDPSocket.new
- socket.send("kick", 0, "localhost", 7890)
- rescue => e
- # if any of the above failed, it's possible that the condor_refreshd
- # daemon is not running. This is especially useful when running the
- # spec tests, since you don't necessarily want condor running in that
- # circumstance.
- Rails.logger.info "#{e.backtrace.shift}: #{e.message}"
- Rails.logger.info "Kicking condor_refreshd failed; continuing anyway"
- end
-end
diff --git a/src/classad_plugin/Makefile.am b/src/classad_plugin/Makefile.am
deleted file mode 100644
index 33a9176..0000000
--- a/src/classad_plugin/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-AM_CPPFLAGS= $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) \
- $(SOUP_CFLAGS) $(SOUP_GNOME_CFLAGS) \
- $(XML_CFLAGS) $(REST_CFLAGS) \
- -DLOGFILE=\"/var/log/condor/conductor_condor_plugin.log\"
-
-classadplugindir=$(pkgdatadir)/classad_plugin
-
-classadplugin_LTLIBRARIES = conductor_classad_plugin.la
-
-conductor_classad_plugin_la_SOURCES = conductor_classad_plugin.cpp
-conductor_classad_plugin_la_LIBADD = $(GLIB_LIBS) $(GTHREAD_LIBS) \
- $(SOUP_LIBS) $(SOUP_GNOME_LIBS) $(XML_LIBS) $(REST_LIBS)\
- -lclassad
-conductor_classad_plugin_la_LDFLAGS = -module -avoid-version -shared
-
diff --git a/src/classad_plugin/conductor_classad_plugin.cpp b/src/classad_plugin/conductor_classad_plugin.cpp
deleted file mode 100644
index 83d0a19..0000000
--- a/src/classad_plugin/conductor_classad_plugin.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-#include <stdio.h>
-
-#include <iostream>
-#include <sstream>
-
-#include "classad/classad_distribution.h"
-#include "classad/fnCall.h"
-
-#include <rest/rest-proxy.h>
-#include <rest/rest-xml-parser.h>
-
-using namespace std;
-#ifdef WANT_CLASSAD_NAMESPACE
-using namespace classad;
-#endif
-
-#define print_value(fp, val) _print_value(fp, val, #val)
-#define print_type(fp, val) _print_type(fp, val, #val)
-
-static void _print_type(FILE *fp, Value val, const char *name)
-{
- fprintf(fp, "%s type is: ", name);
-
- switch(val.GetType()) {
- case Value::NULL_VALUE:
- fprintf(fp, "NULL");
- break;
- case Value::ERROR_VALUE:
- fprintf(fp, "Error");
- break;
- case Value::UNDEFINED_VALUE:
- fprintf(fp, "Undefined");
- break;
- case Value::BOOLEAN_VALUE:
- fprintf(fp, "Boolean");
- break;
- case Value::INTEGER_VALUE:
- fprintf(fp, "Integer");
- break;
- case Value::REAL_VALUE:
- fprintf(fp, "Real");
- break;
- case Value::LIST_VALUE:
- fprintf(fp, "List");
- break;
- case Value::CLASSAD_VALUE:
- fprintf(fp, "Classad");
- break;
- case Value::RELATIVE_TIME_VALUE:
- fprintf(fp, "RelativeTime");
- break;
- case Value::ABSOLUTE_TIME_VALUE:
- fprintf(fp, "AbsoluteTime");
- break;
- case Value::STRING_VALUE:
- fprintf(fp, "String");
- break;
- }
-
- fprintf(fp, "\n");
-}
-
-static void _print_value(FILE *fp, Value val, const char *name)
-{
- /* AFAICT the only way to get at the string in a 'Value' object is to use
- * the C++ stream operator <<, so we set up a stringstream and write
- * stuff we want into that..
- */
- std::stringstream sstr;
-
- sstr << name << " is " << val;
- fprintf(fp, "%s\n", sstr.str().c_str());
-}
-
-static RestXmlNode *
-get_xml (RestProxyCall *call)
-{
- RestXmlParser *parser;
- RestXmlNode *root;
- GError *error = NULL;
-
- parser = rest_xml_parser_new();
-
- root = rest_xml_parser_parse_from_data(parser,
- rest_proxy_call_get_payload(call),
- rest_proxy_call_get_payload_length(call));
-
- g_object_unref(call);
- g_object_unref(parser);
-
- return root;
-}
-
-
-/*
- * Perform our quota check against the Aeolus Conductor database.
- * The arglist to this function is expected to contain:
- *
- * - Instance ID as handed to condor so that we can map to the instance found
- * in the database.
- * - Account ID of the user that wants to launch the instance so we can check
- * the quota.
- */
-bool
-conductor_quota_check(const char *name, const ArgumentList &arglist,
- EvalState &state, Value &result)
-{
- Value instance_id;
- Value account_id;
- FILE *fp;
- bool val = false;
- RestProxy *proxy;
- RestProxyCall *call;
- RestXmlNode *root;
- std::stringstream rest_call;
- GError *err = NULL;
-
- result.SetBooleanValue(false);
-
- fp = fopen(LOGFILE, "a");
-
- if (arglist.size() != 2) {
- result.SetErrorValue();
- fprintf(fp, "Expected 2 arguments, saw %z\n", arglist.size());
- goto do_ret;
- }
-
- if (!arglist[0]->Evaluate(state, instance_id)) {
- result.SetErrorValue();
- fprintf(fp, "Could not evaluate argument 0 to instance id\n");
- goto do_ret;
- }
- if (!arglist[1]->Evaluate(state, account_id)) {
- result.SetErrorValue();
- fprintf(fp, "Could not evaluate argument 1 to account id\n");
- goto do_ret;
- }
-
- print_type(fp, instance_id);
- print_value(fp, instance_id);
- if (instance_id.GetType() != Value::INTEGER_VALUE) {
- result.SetErrorValue();
- fprintf(fp, "Instance id type was not an integer\n");
- goto do_ret;
- }
-
- print_type(fp, account_id);
- print_value(fp, account_id);
- if (account_id.GetType() != Value::STRING_VALUE) {
- result.SetErrorValue();
- fprintf(fp, "Account ID type was not a string\n");
- goto do_ret;
- }
-
- rest_call << "instances/" << instance_id << "/can_start/" << account_id;
-
- // Call rest API to get answer on quota..
- // FIXME: this should be configurable somehow, maybe passed via condor?
- proxy = rest_proxy_new("http://localhost:3000/conductor", FALSE);
- call = rest_proxy_new_call(proxy);
- rest_proxy_call_set_function(call, rest_call.str().c_str());
-
- fprintf(fp, "Calling REST API with %s\n", rest_call.str().c_str());
- rest_proxy_call_sync(call, &err);
-
- if (err != NULL) {
- fprintf(fp, "Error calling REST API: %s\n", err->message);
- } else {
- root = get_xml(call);
- if (root) {
- RestXmlNode *node;
- gchar *value;
-
- node = rest_xml_node_find(root, "value");
- value = node->content;
-
- fprintf (fp, "return value is %s\n", value);
- if (strncmp(value, "true", 4) == 0) {
- result.SetBooleanValue(true);
- val = true;
- }
- }
- }
-
- g_object_unref(proxy);
-
- do_ret:
- fclose(fp);
-
- return val;
-}
-
-/*
- * Struct containing the names of the functions provided here and a pointer
- * to the function that implements them. Third arg is an int flags that appears
- * to be unused.
- *
- * This is found in fnCall.h
- */
-static ClassAdFunctionMapping classad_functions[] =
-{
- { "conductor_quota_check", (void *) conductor_quota_check, 0 },
- { "", NULL, 0 }
-};
-
-/*
- * This is the 'Init' function that is called after the library is dlopen()'d.
- * This just returns the struct defined above.
- *
- */
-extern "C"
-{
- ClassAdFunctionMapping *
- Init(void) {
- g_thread_init(NULL);
- g_type_init();
-
- return classad_functions;
- }
-}
-
diff --git a/src/condor_refreshd/condor_refreshd b/src/condor_refreshd/condor_refreshd
deleted file mode 100755
index 505b1ca..0000000
--- a/src/condor_refreshd/condor_refreshd
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/env ruby
-
-# Copyright (C) 2010 Red Hat, Inc.
-# Written by Chris Lalancette <clalance(a)redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-$: << File.join(File.dirname(__FILE__), "../dutils")
-$: << File.join(File.dirname(__FILE__), "../config")
-
-require 'rubygems'
-require 'optparse'
-require 'socket'
-require 'dutils'
-
-port = 7890
-help = false
-daemon = true
-refreshd_log_dir = "/var/log/aeolus-conductor"
-refreshd_pid_dir = "/var/run/aeolus-conductor"
-timeout = 5
-
-optparse = OptionParser.new do |opts|
-
- opts.banner = <<BANNER
-Usage: condor_refreshd [options]
-
-Options:
-BANNER
- opts.on( '-f', '--pid-file PATH', "Use PATH to the condor_refreshd pid directory (defaults to #{refreshd_pid_dir})") do |newpath|
- refreshd_pid_dir = newpath
- end
- opts.on( '-h', '--help', '') { help = true }
- opts.on( '-l', '--log PATH', "Use PATH to the condor_refreshd log directory (defaults to #{refreshd_log_dir}). Use '-' for stdout") do |newpath|
- refreshd_log_dir = newpath
- end
- opts.on( '-n', '--nodaemon', 'Do not daemonize (useful in combination with -l for debugging)') { daemon = false }
- opts.on( '-p', '--port PORT', 'Use PORT (default: 7890)') do |newport|
- port = newport
- end
- opts.on( '-t', '--timeout TIMEOUT', 'Automatically refresh classads after TIMEOUT minutes') do |newtime|
- timeout = newtime
- end
-end
-
-begin
- optparse.parse!
-rescue OptionParser::InvalidOption => e
- puts "Invalid option #{e.args}"
- puts
- puts optparse
- exit(1)
-end
-
-if help
- puts optparse
- exit(0)
-end
-
-# setup the logger
-if refreshd_log_dir == '-'
- REFRESHD_LOG_FILE = STDOUT
-else
- REFRESHD_LOG_FILE = File.open("#{refreshd_log_dir}/condor_refreshd.log", "a")
-end
-REFRESHD_LOG_FILE.sync = true
-logger = Logger.new(REFRESHD_LOG_FILE)
-logger.level = Logger::DEBUG
-
-logger.info "Starting condor_refreshd..."
-socket = Socket.new(Socket::AF_INET, Socket::SOCK_DGRAM, 0)
-in_addr = Socket.pack_sockaddr_in(port, '127.0.0.1')
-socket.bind(in_addr)
-
-# daemonize
-if daemon
- Process.daemon
-end
-
-begin
- REFRESHD_PID_FILE = "#{refreshd_pid_dir}/condor_refreshd.pid"
- FileUtils.mkdir_p File.dirname(REFRESHD_PID_FILE)
- open(REFRESHD_PID_FILE, "w") {|f| f.write(Process.pid) }
- File.chmod(0644, REFRESHD_PID_FILE)
-
- begin
- condormatic_classads_sync
- logger.info "Initial classads sync successful"
- rescue => e
- # if the first classads_sycn failed, just log it and go on. Subsequent
- # ones might succeed
- logger.error "Initial classads sync failed, continuing anyway"
- end
-
- while true
- # we do the select outside of the begin..rescue block. That way if
- # somehow the socket fails, we won't start filling the logs by continually
- # trying to select on a bogus socket, and instead we will exit
- results = select([socket], nil, nil, timeout * 60)
-
- begin
- # if results was nil, we timed out waiting, and we need to do a sync
- # but not read from the socket
- if not results.nil? and results[0][0] == socket
- socket.recvfrom(1024)
- logger.info "Doing classad sync after getting data from the socket"
- else
- logger.info "Doing classad sync after timeout"
- end
-
- condormatic_classads_sync
- rescue => e
- logger.error "#{e.backtrace.shift}: #{e.message}"
- e.backtrace.each do |step|
- logger.error "\tfrom #{step}"
- end
- end
- end
-rescue => e
- logger.error "#{e.backtrace.shift}: #{e.message}"
- e.backtrace.each do |step|
- logger.error "\tfrom #{step}"
- end
-end
--
1.7.4.4
13 years
[PATCH conductor 1/2] Introduce pipe_and_log helper.
by Chris Lalancette
This reduces our duplicated debugging code.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/app/util/condormatic.rb | 61 +++++++++++++++++++------------------------
1 files changed, 27 insertions(+), 34 deletions(-)
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index 572c064..de92dce 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -20,6 +20,11 @@
require 'nokogiri'
require 'socket'
+def pipe_and_log(pipe, instr)
+ pipe.puts instr
+ Rails.logger.error instr
+end
+
def condormatic_instance_create(task)
begin
@@ -31,38 +36,28 @@ def condormatic_instance_create(task)
instance.condor_job_id = job_name
instance.save!
- # I use the 2>&1 to get stderr and stdout together because popen3 does not support
- # the ability to get the exit value of the command in ruby 1.8.
+ # I use the 2>&1 to get stderr and stdout together because popen3 does not
+ # support the ability to get the exit value of the command in ruby 1.8.
pipe = IO.popen("condor_submit 2>&1", "w+")
- pipe.puts "universe = grid\n"
- Rails.logger.error "universe = grid\n"
- pipe.puts "executable = #{job_name}\n"
- Rails.logger.error "executable = #{job_name}\n"
-
- pipe.puts "grid_resource = deltacloud $$(provider_url)\n"
- Rails.logger.error "grid_resource = deltacloud $$(provider_url)\n"
- pipe.puts "DeltacloudUsername = $$(username)\n"
- Rails.logger.error "DeltacloudUsername = $$(username)\n"
- pipe.puts "DeltacloudPassword = $$(password)\n"
- Rails.logger.error "DeltacloudPassword = $$(password)\n"
- pipe.puts "DeltacloudImageId = $$(image_key)\n"
- Rails.logger.error "DeltacloudImageId = $$(image_key)\n"
- pipe.puts "DeltacloudHardwareProfile = $$(hardware_profile_key)\n"
- Rails.logger.error "DeltacloudHardwareProfile = $$(hardware_profile_key)\n"
- pipe.puts "DeltacloudHardwareProfileMemory = $$(hardware_profile_memory)\n"
- Rails.logger.error "DeltacloudHardwareProfileMemory = $$(hardware_profile_memory)\n"
- pipe.puts "DeltacloudHardwareProfileCPU = $$(hardware_profile_cpu)\n"
- Rails.logger.error "DeltacloudHardwareProfileCPU = $$(hardware_profile_cpu)\n"
- pipe.puts "DeltacloudHardwareProfileStorage = $$(hardware_profile_storage)\n"
- Rails.logger.error "DeltacloudHardwareProfileStorage = $$(hardware_profile_storage)\n"
- pipe.puts "DeltacloudKeyname = $$(keypair)\n"
- Rails.logger.error "DeltacloudKeyname = $$(keypair)\n"
- pipe.puts "DeltacloudPoolFamily = $$(pool_family)\n"
- Rails.logger.error "DeltacloudPoolFamily = $$(pool_family)\n"
+ pipe_and_log(pipe, "universe = grid\n")
+ pipe_and_log(pipe, "executable = #{job_name}\n")
+
+ pipe_and_log(pipe, "grid_resource = deltacloud $$(provider_url)\n")
+ pipe_and_log(pipe, "DeltacloudUsername = $$(username)\n")
+ pipe_and_log(pipe, "DeltacloudPassword = $$(password)\n")
+ pipe_and_log(pipe, "DeltacloudImageId = $$(image_key)\n")
+ pipe_and_log(pipe, "DeltacloudHardwareProfile = $$(hardware_profile_key)\n")
+ pipe_and_log(pipe,
+ "DeltacloudHardwareProfileMemory = $$(hardware_profile_memory)\n")
+ pipe_and_log(pipe,
+ "DeltacloudHardwareProfileCPU = $$(hardware_profile_cpu)\n")
+ pipe_and_log(pipe,
+ "DeltacloudHardwareProfileStorage = $$(hardware_profile_storage)\n")
+ pipe_and_log(pipe, "DeltacloudKeyname = $$(keypair)\n")
+ pipe_and_log(pipe, "DeltacloudPoolFamily = $$(pool_family)\n")
if realm != nil
- pipe.puts "DeltacloudRealmId = $$(realm_key)\n"
- Rails.logger.error "DeltacloudRealmId = $$(realm_key)\n"
+ pipe_and_log(pipe, "DeltacloudRealmId = $$(realm_key)\n")
end
# TODO: for assemblies we grab first template in an assembly
@@ -76,13 +71,11 @@ def condormatic_instance_create(task)
requirements += " && conductor_quota_check(#{instance.id}, other.provider_account_id)"
requirements += "\n"
- pipe.puts requirements
- Rails.logger.error requirements
+ pipe_and_log(pipe, requirements)
+
+ pipe_and_log(pipe, "notification = never\n")
+ pipe_and_log(pipe, "queue\n")
- pipe.puts "notification = never\n"
- Rails.logger.error "notification = never\n"
- pipe.puts "queue\n"
- Rails.logger.error "queue\n"
pipe.close_write
out = pipe.read
pipe.close
--
1.7.4.4
13 years
[PATCH] Add python-cloudservers to the RPM spec file.
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
imagefactory.spec.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/imagefactory.spec.in b/imagefactory.spec.in
index f929183..70725a4 100644
--- a/imagefactory.spec.in
+++ b/imagefactory.spec.in
@@ -18,6 +18,7 @@ Requires: python-boto
Requires: libxml2-python
Requires: python-httplib2
Requires: python-argparse
+Requires: python-cloudservers
BuildRequires: python
%description
--
1.7.4.4
13 years
Breadcrumb trail for site navigation rev.3
by Jirka Tomasek
This patch implements Redmine tasks #1351 and #1352 Breadcrumbs are
defined to work for Pools, Instances and Deployments. ViewState
functionality is integrated, although it depends on its final
implementation.
The breadcrumb shifting now happens in separate action as before filter
in application controller, so the shifting applies also when going to
action which doesn't save breadcrumb.
13 years
Breadcrumb trail for site navigation rev.2
by Jirka Tomasek
This patch implements Redmine tasks #1351 and #1352 Breadcrumbs are
defined to work for Pools, Instances and Deployments. ViewState
functionality is integrated, although it depends on its final
implementation.
Rebased with next
13 years
[PATCH] Add condor cloud provider type.
by Ian Main
This patch adds a migration to include condor cloud type for using
condor cloud with aeolus.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
...0110511120000_add_condor_cloud_provider_type.rb | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
create mode 100644 src/db/migrate/20110511120000_add_condor_cloud_provider_type.rb
diff --git a/src/db/migrate/20110511120000_add_condor_cloud_provider_type.rb b/src/db/migrate/20110511120000_add_condor_cloud_provider_type.rb
new file mode 100644
index 0000000..8d8dab5
--- /dev/null
+++ b/src/db/migrate/20110511120000_add_condor_cloud_provider_type.rb
@@ -0,0 +1,13 @@
+class AddCondorCloudProviderType < ActiveRecord::Migration
+
+ def self.up
+ provider_type = ProviderType.create!(:name => "CondorCloud", :build_supported => true, :codename =>"condorcloud")
+ CredentialDefinition.create!(:name => 'username', :label => 'API Key', :input_type => 'text', :provider_type_id => provider_type.id)
+ CredentialDefinition.create!(:name => 'password', :label => 'Secret', :input_type => 'password', :provider_type_id => provider_type.id)
+
+ end
+
+ def self.down
+ end
+
+end
--
1.7.4.4
13 years