incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jprov...@redhat.com
Subject [PATCH aggregator 5/5] hacked condormatic - absolutely not sure if this change is correct
Date Tue, 14 Sep 2010 15:53:48 GMT
From: Jan Provaznik <jprovazn@redhat.com>

---
 src/app/util/condormatic.rb |   58 ++++++++++++++++++++-----------------------
 1 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index 3491f7f..42d0c3a 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -36,12 +36,12 @@ def condormatic_instance_create(task)
     Rails.logger.info "universe = grid\n"
     pipe.puts "executable = #{job_name}\n"
     Rails.logger.info "executable = #{job_name}\n"
-    pipe.puts "grid_resource = dcloud $$(provider_url) $$(username) $$(password) $$(image_key)
#{instance.name} $$(realm_key) $$(hardwareprofile_key)\n"
-    Rails.logger.info "grid_resource = dcloud $$(provider_url) $$(username) $$(password)
$$(image_key) #{instance.name} $$(realm_key) $$(hardwareprofile_key)\n"
+    pipe.puts "grid_resource = dcloud $$(provider_url) $$(username) $$(password) #{instance.name}
$$(realm_key) $$(hardwareprofile_key)\n"
+    Rails.logger.info "grid_resource = dcloud $$(provider_url) $$(username) $$(password)
#{instance.name} $$(realm_key) $$(hardwareprofile_key)\n"
     pipe.puts "log = #{job_log}\n"
     Rails.logger.info "log = #{job_log}\n"
 
-    requirements = "requirements = hardwareprofile == \"#{instance.hardware_profile.id}\"
&& image == \"#{instance.image.id}\""
+    requirements = "requirements = hardwareprofile == \"#{instance.hardware_profile.id}\""
     requirements += " && realm == \"#{realm.name}\"" if realm != nil
     requirements += "\n"
 
@@ -174,34 +174,30 @@ def condormatic_classads_sync
 
   providers.each do |provider|
     provider.cloud_accounts.each do |account|
-      provider.images.each do |image|
-        provider.hardware_profiles.each do |hwp|
-          provider.realms.each do |realm|
-            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=\"#{image.aggregator_images[0].id}\""
-            pipe.puts "realm=\"#{realm.name}\""
-            pipe.puts "\n# Backend info to complete this job:"
-            pipe.puts "image_key=\"#{image.external_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.close_write
-
-            out = pipe.read
-            pipe.close
-
-            Rails.logger.error "Unable to submit condor classad: #{out}" if $? != 0
-
-            index += 1
-          end
+      provider.hardware_profiles.each do |hwp|
+        provider.realms.each do |realm|
+          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 "realm=\"#{realm.name}\""
+          pipe.puts "\n# Backend info to complete this job:"
+          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.close_write
+
+          out = pipe.read
+          pipe.close
+
+          Rails.logger.error "Unable to submit condor classad: #{out}" if $? != 0
+
+          index += 1
         end
       end
     end
-- 
1.7.2.2


Mime
View raw message