On 09/20/10 - 10:25:02AM, Mohammed Morsi wrote:
> ---
>  src/app/models/instance_event.rb |    5 +++++
>  src/dbomatic/dbomatic            |   19 ++++++++++++++++---
>  2 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/src/app/models/instance_event.rb 
> b/src/app/models/instance_event.rb
> index 5076f8a..e5c619a 100644
> --- a/src/app/models/instance_event.rb
> +++ b/src/app/models/instance_event.rb
> @@ -23,4 +23,9 @@ class InstanceEvent < ActiveRecord::Base
>  
>    validates_presence_of :instance_id
>    validates_presence_of :event_type
> +
> +  EVENT_TYPE_STARTED = 'InstanceStarted'
> +  EVENT_TYPE_STOPPED = 'InstanceStopped'
> +  EVENT_TYPES = [EVENT_TYPE_STARTED, EVENT_TYPE_STOPPED]
> +

Hm, I don't think we need to introduce new states here; we already have
Instance::STATE_PENDING, Instance::STATE_STOPPED, etc.  I think we can just
use those states in the instance_event table.

>  end
> diff --git a/src/dbomatic/dbomatic b/src/dbomatic/dbomatic
> index 7434d36..88dad26 100755
> --- a/src/dbomatic/dbomatic
> +++ b/src/dbomatic/dbomatic
> @@ -61,6 +61,16 @@ end
>  CONDOR_EVENT_LOG_FILE   =   "#{condor_event_log_dir}/EventLog"
>  EVENT_LOG_POS_FILE      =   "#{dbomatic_run_dir}/event_log_position"
>  
> +# Simple translation helper, map condor event types to dbomatic ones
> +def condor_event_to_dbomatic_event(condor_event)
> +  case condor_event
> +    when 'ExecuteEvent' then InstanceEvent::EVENT_TYPE_STARTED
> +    when 'JobTerminted' then InstanceEvent::EVENT_TYPE_STOPPED

This is a typo, and given what we've found out subsequently about condor
events', the condor event_type isn't sufficient for figuring out what state
we are putting things into.  I'll follow up with a patch that does the right
thing here.

NACK for now.

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

Reply via email to