On Thu, 2010-09-23 at 16:48 -0400, Chris Lalancette wrote:
> Signed-off-by: Chris Lalancette <[email protected]>
> ---
>  src/app/util/condormatic.rb |   39 +++++++++++++++++++++++++++++++++++++--
>  1 files changed, 37 insertions(+), 2 deletions(-)
> 
> diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
> index f6c2ba8..6bcb51a 100644
> --- a/src/app/util/condormatic.rb
> +++ b/src/app/util/condormatic.rb
> @@ -175,11 +175,46 @@ end
>  
> 
>  def condormatic_classads_sync
> -
> +  Rails.logger.info "Starting condormatic_classads_sync..."
>    index = 0
>    providers = Provider.find(:all)
> -  Rails.logger.info "Syncing classads.."
>  
> +
> +  # 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.

I don't think it's an issue to invalidate them all.  If there is a lack
of classads for a period then there just won't be any successful matches
at that time.  I also think it would not be difficult to add matching to
the tool since it is done in many of the other tools..

Anyway, ACK! :)

        Ian


> +  Rails.logger.info "Starting classad invalidate..."
> +  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
> +
> +  Rails.logger.info "Syncing classads.."
>    providers.each do |provider|
>      provider.cloud_accounts.each do |account|
>        provider.images.each do |image|


_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to