[PATCH] Fix provider account setting in dbomatic
by Ian Main
With new condor, the grid job is laid out differently and the
username/password is no longer logged (which is good). This patch uses
the 'DeltacloudUsername' only to find the provider account. This also
requires that you add DeltacloudUsername to the logging list in your
condor config.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
src/dbomatic/dbomatic | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/dbomatic/dbomatic b/src/dbomatic/dbomatic
index 406388d..61746ff 100755
--- a/src/dbomatic/dbomatic
+++ b/src/dbomatic/dbomatic
@@ -90,7 +90,7 @@ end
# Handle the event log's xml
class CondorEventLog < Nokogiri::XML::SAX::Document
- attr_accessor :tag, :event_type, :event_cmd, :event_time, :trigger_type, :grid_resource, :execute_host, :hold_reason, :private_addresses, :public_addresses
+ attr_accessor :tag, :event_type, :event_cmd, :event_time, :trigger_type, :grid_resource, :execute_host, :username, :hold_reason, :private_addresses, :public_addresses
def initialize(logger)
@logger = logger
@@ -116,6 +116,8 @@ class CondorEventLog < Nokogiri::XML::SAX::Document
@grid_resource = string
elsif @tag == "ExecuteHost"
@execute_host = string
+ elsif @tag == "DeltacloudUsername"
+ @username = string
elsif @tag == "HoldReason"
@hold_reason = string
elsif @tag == "DeltacloudPublicNetworkAddresses"
@@ -177,7 +179,7 @@ class CondorEventLog < Nokogiri::XML::SAX::Document
def update_instance_cloud_id(inst)
# The GridResource/ExecuteHost string looks like this:
- # dcloud http://localhost:3001/api <username> <password> <image_name> <instance_name> <realm_name> <hardware_profile_name>
+ # dcloud http://localhost:3001/api
if !(a)grid_resource.nil?
resource = @grid_resource
@@ -190,12 +192,15 @@ class CondorEventLog < Nokogiri::XML::SAX::Document
args = resource.split
link = args[1]
- username = args[2]
- password = args[3]
- if link.nil? or username.nil? or password.nil?
+
+ if link.nil?
@logger.error "Unexpected nil data from #{resource}, skipping cloud id update"
return
end
+ if @username.nil?
+ @logger.error "Unexpected nil username, skipping cloud id update"
+ return
+ end
provider = Provider.find(:first, :conditions => ['url = ?', link])
if provider.nil?
@@ -203,19 +208,14 @@ class CondorEventLog < Nokogiri::XML::SAX::Document
return
end
- provider_account = ProviderAccount.find(:first, :conditions => ['provider_id = ? AND username = ? AND password = ?', provider.id, username, password])
+ provider_account = ProviderAccount.find(:first, :conditions => ['provider_id = ? AND username = ?', provider.id, @username])
if provider_account.nil?
- @logger.error "Could not find the cloud account corresponding to #{link}, skipping cloud id update"
+ @logger.error "Could not find the cloud account corresponding to #{link} - #{@username}, skipping cloud id update"
return
end
inst.provider_account_id = provider_account.id
- # FIXME: we are updating the instance_key_id here, but this is really not
- # the right way or place to do this. This will have to be revisited when
- # we come up with a real key management architecture
- inst.instance_key_id = provider_account.instance_key.id
-
inst.save!
end
--
1.7.4
13 years, 2 months
[PATCH aeolus] Task #372-Rename all remaining cloud_account variables
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
src/app/controllers/permissions_controller.rb | 4 ++--
src/app/controllers/quotas_controller.rb | 4 ++--
src/app/models/instance_task.rb | 6 +++---
src/app/models/pool.rb | 2 +-
src/app/models/provider.rb | 2 +-
src/app/models/provider_account.rb | 2 +-
src/app/models/quota.rb | 8 ++++----
src/app/services/data_service_active_record.rb | 14 +++++++-------
src/app/services/graph_service.rb | 20 ++++++++++----------
src/lib/tasks/demo_data.rake | 10 +++++-----
src/spec/models/instance_observer_spec.rb | 4 ++--
src/spec/models/instance_spec.rb | 8 ++++----
src/test/fixtures/instances.yml | 2 +-
src/test/fixtures/pool_accounts.yml | 2 +-
src/test/fixtures/pools.yml | 2 +-
15 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/src/app/controllers/permissions_controller.rb b/src/app/controllers/permissions_controller.rb
index 380b97c..406b991 100644
--- a/src/app/controllers/permissions_controller.rb
+++ b/src/app/controllers/permissions_controller.rb
@@ -73,8 +73,8 @@ class PermissionsController < ApplicationController
@permission_object = Pool.find params[:pool_id]
elsif !params[:provider_id].nil?
@permission_object = Provider.find params[:provider_id]
- elsif !params[:cloud_account_id].nil?
- @permission_object = ProviderAccount.find params[:cloud_account_id]
+ elsif !params[:provider_account_id].nil?
+ @permission_object = ProviderAccount.find params[:provider_account_id]
elsif !params[:base_permission_object_id].nil?
@permission_object = BasePermissionObject.find params[:base_permission_object_id]
else
diff --git a/src/app/controllers/quotas_controller.rb b/src/app/controllers/quotas_controller.rb
index 0beb386..328361b 100644
--- a/src/app/controllers/quotas_controller.rb
+++ b/src/app/controllers/quotas_controller.rb
@@ -76,7 +76,7 @@ class QuotasController < ApplicationController
def get_parent_object(params)
if params[:parent_type] == "pool"
return Pool.find(params[:id])
- elsif params[:parent_type] == "cloud_account"
+ elsif params[:parent_type] == "provider_account"
return ProviderAccount.find(params[:id])
end
#TODO Throw no match to pool or cloud account exception
@@ -85,7 +85,7 @@ class QuotasController < ApplicationController
def get_parent_name(parent, parent_type)
if parent_type == "pool"
return parent.name
- elsif parent_type == "cloud_account"
+ elsif parent_type == "provider_account"
return parent.username
end
#TODO Throw no match to pool or cloud account exception
diff --git a/src/app/models/instance_task.rb b/src/app/models/instance_task.rb
index 42bed29..c431ac1 100644
--- a/src/app/models/instance_task.rb
+++ b/src/app/models/instance_task.rb
@@ -44,10 +44,10 @@ class InstanceTask < Task
# automatic transitions from transient states.
def self.valid_actions_for_instance_state(state, instance, user=nil)
actions = []
- # FIXME: cloud_account won't always be set here, but we're requiring
+ # FIXME: provider_account won't always be set here, but we're requiring
# front end realm for now.
- if cloud_account = instance.provider_account and
- conn = cloud_account.connect and c_state = conn.instance_state(state)
+ if provider_account = instance.provider_account and
+ conn = provider_account.connect and c_state = conn.instance_state(state)
transitions = c_state.transitions
transitions.each do |transition|
# FIXME if we allow actions based on the expected state after
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index 0f9a4fb..475610a 100644
--- a/src/app/models/pool.rb
+++ b/src/app/models/pool.rb
@@ -44,7 +44,7 @@ class Pool < ActiveRecord::Base
:include => [:role],
:order => "permissions.id ASC"
- def cloud_accounts
+ def provider_accounts
accounts = []
instances.each do |instance|
if instance.provider_account and !accounts.include?(instance.provider_account)
diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
index b4c1667..1a04763 100644
--- a/src/app/models/provider.rb
+++ b/src/app/models/provider.rb
@@ -121,7 +121,7 @@ class Provider < ActiveRecord::Base
end
def pools
- cloud_accounts.collect {|account| account.pools}.flatten.uniq
+ provider_accounts.collect {|account| account.pools}.flatten.uniq
end
# returns first provider of provider_type which has at least one cloud account
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 39dce11..8a66b0f 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -139,7 +139,7 @@ class ProviderAccount < ActiveRecord::Base
def populate_realms
client = connect
realms = client.realms
- # FIXME: this should probably be in the same transaction as cloud_account.save
+ # FIXME: this should probably be in the same transaction as provider_account.save
self.transaction do
realms.each do |realm|
#ignore if it exists
diff --git a/src/app/models/quota.rb b/src/app/models/quota.rb
index acb001a..15a664d 100644
--- a/src/app/models/quota.rb
+++ b/src/app/models/quota.rb
@@ -58,8 +58,8 @@ class Quota < ActiveRecord::Base
end
- def self.can_create_instance?(instance, cloud_account)
- [instance.owner, instance.pool, cloud_account].each do |parent|
+ def self.can_create_instance?(instance, provider_account)
+ [instance.owner, instance.pool, provider_account].each do |parent|
if parent
quota = Quota.find(parent.quota_id)
potential_total_instances = quota.total_instances + 1
@@ -71,8 +71,8 @@ class Quota < ActiveRecord::Base
return true
end
- def self.can_start_instance?(instance, cloud_account)
- [instance.owner, instance.pool, cloud_account].each do |parent|
+ def self.can_start_instance?(instance, provider_account)
+ [instance.owner, instance.pool, provider_account].each do |parent|
if parent
quota = Quota.find(parent.quota_id)
potential_running_instances = quota.running_instances + 1
diff --git a/src/app/services/data_service_active_record.rb b/src/app/services/data_service_active_record.rb
index 5833baa..31d33bb 100644
--- a/src/app/services/data_service_active_record.rb
+++ b/src/app/services/data_service_active_record.rb
@@ -65,11 +65,11 @@ class DataServiceActiveRecord
data_points = []
free_instances = 0
- cloud_accounts = ProviderAccount.find(:all, :conditions => {:provider_id => provider.id})
- cloud_accounts.each do |cloud_account|
- quota = cloud_account.quota
+ provider_accounts = ProviderAccount.find(:all, :conditions => {:provider_id => provider.id})
+ provider_accounts.each do |provider_account|
+ quota = provider_account.quota
if quota
- data_points << TotalQuotaUsagePoint.new(cloud_account.username, quota.total_instances)
+ data_points << TotalQuotaUsagePoint.new(provider_account.username, quota.total_instances)
free_instances += (quota.maximum_total_instances - quota.total_instances)
end
end
@@ -175,9 +175,9 @@ class DataServiceActiveRecord
instances = []
if parent.class == Provider
- cloud_accounts = ProviderAccount.find(:all, :conditions => {:provider_id => parent.id})
- cloud_accounts.each do |cloud_account|
- instances.concat(cloud_account.instances)
+ provider_accounts = ProviderAccount.find(:all, :conditions => {:provider_id => parent.id})
+ provider_accounts.each do |provider_account|
+ instances.concat(provider_account.instances)
end
elsif parent.class == Pool || parent.class == ProviderAccount
instances = parent.instances
diff --git a/src/app/services/graph_service.rb b/src/app/services/graph_service.rb
index c5f3065..109455c 100644
--- a/src/app/services/graph_service.rb
+++ b/src/app/services/graph_service.rb
@@ -10,16 +10,16 @@ class GraphService
#if a specific cloud account is given, just return that cloud account's graph.
#otherwise return all graphs user has permission to see.
- if opts[:cloud_account]
- cloud_account = opts[:cloud_account]
- cloud_account_graphs = Hash.new
- cloud_account_graphs[Graph::QUOTA_INSTANCES_IN_USE] = qos_failure_rate_graph(parent, opts = {})
- graphs[cloud_account] = cloud_account_graphs
+ if opts[:provider_account]
+ provider_account = opts[:provider_account]
+ provider_account_graphs = Hash.new
+ provider_account_graphs[Graph::QUOTA_INSTANCES_IN_USE] = qos_failure_rate_graph(parent, opts = {})
+ graphs[provider_account] = provider_account_graphs
else
- ProviderAccount.all.each do |cloud_account|
- cloud_account_graphs = Hash.new
- cloud_account_graphs[Graph::QUOTA_INSTANCES_IN_USE] = quota_instances_in_use_graph(cloud_account,opts)
- graphs[cloud_account] = cloud_account_graphs
+ ProviderAccount.all.each do |provider_account|
+ provider_account_graphs = Hash.new
+ provider_account_graphs[Graph::QUOTA_INSTANCES_IN_USE] = quota_instances_in_use_graph(provider_account,opts)
+ graphs[provider_account] = provider_account_graphs
end
end
graphs
@@ -67,7 +67,7 @@ class GraphService
def self.quota_usage_graph (parent, opts = {})
x = [1,2]
- #we'll just have zero values for the unexpected case where cloud_account has no quota
+ #we'll just have zero values for the unexpected case where provider_account has no quota
y = x.collect { |v| 0 }
if parent.quota
quota = parent.quota
diff --git a/src/lib/tasks/demo_data.rake b/src/lib/tasks/demo_data.rake
index f3326fd..2f6fc35 100644
--- a/src/lib/tasks/demo_data.rake
+++ b/src/lib/tasks/demo_data.rake
@@ -25,17 +25,17 @@ namespace :db do
SHORT_ACC = PROB_SHORT_REPONSE + PROB_FAILURE
MEDIUM_ACC = PROB_MEDIUM_RESPONSE + PROB_SHORT_REPONSE + PROB_FAILURE
- task :demo_data, :cloud_account_id, :user_id, :time_period, :number_of_tasks, :needs => :environment do |t, args|
+ task :demo_data, :provider_account_id, :user_id, :time_period, :number_of_tasks, :needs => :environment do |t, args|
@time_scale = args[:time_period].to_f * 60 * 60
@number_of_tasks = args[:number_of_tasks]
puts @number_of_tasks
- cloud_account = ProviderAccount.find(args[:cloud_account_id])
+ provider_account = ProviderAccount.find(args[:provider_account_id])
user = User.find(args[:user_id])
- instance = create_instance(cloud_account)
+ instance = create_instance(provider_account)
started_at = Time.now
create_tasks(instance, user)
@@ -44,13 +44,13 @@ namespace :db do
print_stats(started_at, ended_at)
end
- def create_instance(cloud_account)
+ def create_instance(provider_account)
instance = Instance.new({:name => "instance" + Time.now.to_s,
:hardware_profile_id => HardwareProfile.find(:first),
:image_id => Image.find(:first),
:state => Instance::STATE_NEW,
:pool_id => 1,
- :cloud_account_id => cloud_account.id
+ :provider_account_id => provider_account.id
})
instance.save!
return instance
diff --git a/src/spec/models/instance_observer_spec.rb b/src/spec/models/instance_observer_spec.rb
index 4acb78c..c5946f4 100644
--- a/src/spec/models/instance_observer_spec.rb
+++ b/src/spec/models/instance_observer_spec.rb
@@ -161,8 +161,8 @@ describe InstanceObserver do
key.stub!(:id).and_return("1_user")
client.stub!(:"feature?").and_return(true)
client.stub!(:"create_key").and_return(key)
- @cloud_account.stub!(:connect).and_return(client)
- @instance.stub!(:cloud_account).and_return(@cloud_account)
+ @provider_account.stub!(:connect).and_return(client)
+ @instance.stub!(:provider_account).and_return(@provider_account)
@instance.state = Instance::STATE_RUNNING
@instance.save!
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index e4d3a9f..bc49fa6 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -121,12 +121,12 @@ describe Instance do
it "should return empty list of instance actions when connect to provider fails" do
provider = Factory.build(:mock_provider2)
- cloud_account = Factory.build(:provider_account, :provider => provider,
+ provider_account = Factory.build(:provider_account, :provider => provider,
:username => 'john doe',
:password => 'asdf')
- cloud_account.stub!(:connect).and_return(nil)
- cloud_account.stub!(:valid_credentials?).and_return(true)
- instance = Factory.create(:instance, :provider_account => cloud_account)
+ provider_account.stub!(:connect).and_return(nil)
+ provider_account.stub!(:valid_credentials?).and_return(true)
+ instance = Factory.create(:instance, :provider_account => provider_account)
instance.get_action_list.should be_empty
end
diff --git a/src/test/fixtures/instances.yml b/src/test/fixtures/instances.yml
index 951258d..4ec5c7d 100644
--- a/src/test/fixtures/instances.yml
+++ b/src/test/fixtures/instances.yml
@@ -7,7 +7,7 @@ test_instance:
image: fedora_13_image_frontend
realm: us_realm
pool: test_pool
- cloud_account: mock_account
+ provider_account: mock_account
public_address:
private_address:
state: stopped
diff --git a/src/test/fixtures/pool_accounts.yml b/src/test/fixtures/pool_accounts.yml
index c5db498..083d254 100644
--- a/src/test/fixtures/pool_accounts.yml
+++ b/src/test/fixtures/pool_accounts.yml
@@ -1,5 +1,5 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
test_pool_mock_account:
- cloud_account: mock_account
+ provider_account: mock_account
pool: test_pool
diff --git a/src/test/fixtures/pools.yml b/src/test/fixtures/pools.yml
index da63a52..a5d96bb 100644
--- a/src/test/fixtures/pools.yml
+++ b/src/test/fixtures/pools.yml
@@ -3,4 +3,4 @@
test_pool
name: test_pool
owner: test_user
- cloud_accounts: mock_account
+ provider_accounts: mock_account
--
1.7.4
13 years, 2 months
[PATCH configure] add timestamp to configure rpm release
by Mo Morsi
---
contrib/deltacloud-configure.spec | 2 +-
rake/rpmtask.rb | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/contrib/deltacloud-configure.spec b/contrib/deltacloud-configure.spec
index 670d401..d190b46 100644
--- a/contrib/deltacloud-configure.spec
+++ b/contrib/deltacloud-configure.spec
@@ -4,7 +4,7 @@
Summary: DeltaCloud Configure Puppet Recipe
Name: deltacloud-configure
Version: 2.0.0
-Release: 2%{?dist}
+Release: 2%{?dist}.%{timestamp}
Group: Applications/Internet
License: GPLv2+
diff --git a/rake/rpmtask.rb b/rake/rpmtask.rb
index ff2ee66..fa21df8 100644
--- a/rake/rpmtask.rb
+++ b/rake/rpmtask.rb
@@ -69,7 +69,10 @@ module Rake
file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do
cp "#{package_dir}/#{@name}-#{(a)version}.tgz", "#{@topdir}/SOURCES/"
cp @rpm_spec, "#{@topdir}/SPECS"
- sh "#{@rpmbuild_cmd} --define '_topdir #{@topdir}' -ba #{@rpm_spec}"
+ sh "#{@rpmbuild_cmd} " +
+ "--define '_topdir #{@topdir}' " +
+ "--define 'timestamp #{Time.now.strftime("%Y%m%d%k%M%s")}' " +
+ "-ba #{@rpm_spec}"
end
end
--
1.7.2.3
13 years, 2 months
[PATCH configure 1/1] Update condor_config.local for new condor version
by Mike Orazi
---
.../deltacloud_recipe/files/condor_config.local | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/recipes/deltacloud_recipe/files/condor_config.local b/recipes/deltacloud_recipe/files/condor_config.local
index 9c15b0c..7105498 100644
--- a/recipes/deltacloud_recipe/files/condor_config.local
+++ b/recipes/deltacloud_recipe/files/condor_config.local
@@ -13,7 +13,7 @@ GRIDMANAGER_DEBUG = D_FULLDEBUG
NEGOTIATOR_DEBUG = D_FULLDEBUG
COLLECTOR_DEBUG = D_FULLDEBUG
-DCLOUD_GAHP = $(SBIN)/dcloud_gahp
+DELTACLOUD_GAHP = $(SBIN)/deltacloud_server
CLASSAD_LIFETIME = 0
--
1.7.4
13 years, 2 months
Upcoming release
by Mike Orazi
All,
We are attempting to tie up a few loose ends before we cut a new release
of conductor/config (with new condor rpms).
Based on the interdependencies between a number of components, I would
like to ask folks not to push any new patches to the next branch of
conductor unless you are explicitly asked to do so to fix a
release-blocking issue. Either Jay or I will issue an all-clear message
when the release has been created and tagged.
In the meantime, any help with end-to-end testing would be greatly
appreciated.
Thanks in advance,
Mike
13 years, 2 months
pgsql updates
by Mike Orazi
These patches were used by Matt on the integrated test enivornment (clean database, ipv6 turned on). There is likely an additional follow-on patch that we need to get past the last of the issues he's seeing.
13 years, 2 months
[PATCH] Update condormatic to use new condor job submission format.
by Ian Main
The latest release of condor changed the job submission format. This
patch updates it to use the new format. Note that this patch requires
the new condor rpms.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
src/app/util/condormatic.rb | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index 39038f4..a129d06 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -40,20 +40,27 @@ def condormatic_instance_create(task)
# 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.info "universe = grid\n"
+ Rails.logger.error "universe = grid\n"
pipe.puts "executable = #{job_name}\n"
- Rails.logger.info "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 = $$(hardwareprofile_key)\n"
+ Rails.logger.error "DeltacloudHardwareProfile = $$(hardwareprofile_key)\n"
+ pipe.puts "DeltacloudKeyname = $$(keypair)\n"
+ Rails.logger.error "DeltacloudKeyname = $$(keypair)\n"
- resource = "grid_resource = dcloud $$(provider_url) $$(username) $$(password) $$(image_key) #{escape(instance.name)}"
if realm != nil
- resource += " $$(realm_key)"
- else
- resource += " NULL"
+ pipe.puts "DeltacloudRealmId = $$(realm_key)\n"
+ Rails.logger.error "DeltacloudRealmId = $$(realm_key)\n"
end
- resource += " $$(hardwareprofile_key) $$(keypair) NULL\n"
-
- pipe.puts resource
- Rails.logger.info resource
requirements = "requirements = hardwareprofile == \"#{instance.hardware_profile.id}\" && image == \"#{instance.template.id}\""
requirements += " && realm == \"#{realm.id}\"" if realm != nil
@@ -64,17 +71,17 @@ def condormatic_instance_create(task)
requirements += "\n"
pipe.puts requirements
- Rails.logger.info requirements
+ Rails.logger.error requirements
pipe.puts "notification = never\n"
- Rails.logger.info "notification = never\n"
+ Rails.logger.error "notification = never\n"
pipe.puts "queue\n"
- Rails.logger.info "queue\n"
+ Rails.logger.error "queue\n"
pipe.close_write
out = pipe.read
pipe.close
- Rails.logger.info "$? (return value?) is #{$?}"
+ Rails.logger.error "$? (return value?) is #{$?}"
raise ("Error calling condor_submit: #{out}") if $? != 0
rescue Exception => ex
--
1.7.4
13 years, 2 months
[PATCH] Tell condor_refreshd to refresh classads every minute.
by Ian Main
This is a sad way to get around a bug where condor_refreshd is not
getting kick'd properly when creating an account in the WUI. We are
going to implement a kick in the model hooks and have a queue set up in
condor_refreshd.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
src/condor_refreshd/condor_refreshd | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/condor_refreshd/condor_refreshd b/src/condor_refreshd/condor_refreshd
index 4f1b93c..629f835 100755
--- a/src/condor_refreshd/condor_refreshd
+++ b/src/condor_refreshd/condor_refreshd
@@ -31,7 +31,7 @@ help = false
daemon = true
refreshd_log_dir = "/var/log/deltacloud-aggregator"
refreshd_pid_dir = "/var/run/deltacloud-aggregator"
-timeout = 15
+timeout = 1
optparse = OptionParser.new do |opts|
--
1.7.4
13 years, 2 months
[PATCH] Wrap pipe output in a rescue block.
by Ian Main
This patch wraps the pipe output in a rescue block so that errors in
this code cannot cause zombie processes as I was seeing in
condor_refreshd.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
src/app/util/condormatic.rb | 43 +++++++++++++++++++++++++++----------------
1 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index 613430b..533241e 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -235,22 +235,33 @@ def condormatic_classads_sync
pipe = IO.popen("condor_advertise UPDATE_STARTD_AD 2>&1", "w+")
- pipe.puts "Name=\"provider_combination_#{index}\""
- pipe.puts 'MyType="Machine"'
- pipe.puts 'Requirements=true'
- pipe.puts "\n# Stuff needed to match:"
- pipe.puts "hardwareprofile=\"#{hwp.aggregator_hardware_profiles[0].id}\""
- pipe.puts "image=\"#{provider_image.image.template.id}\""
- pipe.puts "realm=\"#{realm.frontend_realms[0].id}\""
- pipe.puts "\n# Backend info to complete this job:"
- pipe.puts "image_key=\"#{provider_image.provider_image_key}\""
- pipe.puts "hardwareprofile_key=\"#{hwp.external_key}\""
- pipe.puts "realm_key=\"#{realm.external_key}\""
- pipe.puts "provider_url=\"#{account.provider.url}\""
- pipe.puts "username=\"#{account.username}\""
- pipe.puts "password=\"#{account.password}\""
- pipe.puts "provider_account_id=\"#{account.id}\""
- pipe.puts "keypair=\"#{escape(account.instance_key.name)}\""
+ # This block should be in an exception because if we bail here the
+ # pipe will not get closed and the process will remain a zombie,
+ # filling the process table for this user making the all of dcloud
+ # fall on its face..
+ begin
+ pipe.puts "Name=\"provider_combination_#{index}\""
+ pipe.puts 'MyType="Machine"'
+ pipe.puts 'Requirements=true'
+ pipe.puts "\n# Stuff needed to match:"
+ pipe.puts "hardwareprofile=\"#{hwp.aggregator_hardware_profiles[0].id}\""
+ pipe.puts "image=\"#{provider_image.image.template.id}\""
+ pipe.puts "realm=\"#{realm.frontend_realms[0].id}\""
+ pipe.puts "\n# Backend info to complete this job:"
+ pipe.puts "image_key=\"#{provider_image.provider_image_key}\""
+ pipe.puts "hardwareprofile_key=\"#{hwp.external_key}\""
+ pipe.puts "realm_key=\"#{realm.external_key}\""
+ pipe.puts "provider_url=\"#{account.provider.url}\""
+ pipe.puts "username=\"#{account.username}\""
+ pipe.puts "password=\"#{account.password}\""
+ pipe.puts "provider_account_id=\"#{account.id}\""
+ pipe.puts "keypair=\"#{escape(account.instance_key.name)}\""
+ 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
--
1.7.4
13 years, 2 months
[PATCH] Rename cloud_account to provider_account for consistency.
by Ian Main
This patch just renames the classad variables to keep things more
consistent. No real functional change here.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
src/app/util/condormatic.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index 23aafef..613430b 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -67,7 +67,7 @@ def condormatic_instance_create(task)
# 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 += " && deltacloud_quota_check(#{instance.id}, other.cloud_account_id)"
+ requirements += " && deltacloud_quota_check(#{instance.id}, other.provider_account_id)"
requirements += "\n"
pipe.puts requirements
@@ -249,7 +249,7 @@ def condormatic_classads_sync
pipe.puts "provider_url=\"#{account.provider.url}\""
pipe.puts "username=\"#{account.username}\""
pipe.puts "password=\"#{account.password}\""
- pipe.puts "cloud_account_id=\"#{account.id}\""
+ pipe.puts "provider_account_id=\"#{account.id}\""
pipe.puts "keypair=\"#{escape(account.instance_key.name)}\""
pipe.close_write
--
1.7.4
13 years, 2 months