[PATCH conductor] BZ786535: display failures for instances (rev. 2)

ifarkas at redhat.com ifarkas at redhat.com
Mon Mar 12 13:49:12 UTC 2012


From: Imre Farkas <ifarkas at redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=786535

Resending this patch based on Richard's comment
---
 src/app/controllers/deployments_controller.rb |    8 ++++++++
 src/app/models/task.rb                        |    5 +++++
 src/app/stylesheets/layout.scss               |    1 +
 src/app/util/taskomatic.rb                    |    7 +++++++
 src/config/locales/en.yml                     |    1 +
 5 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index d65dea3..5b2824f 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -205,6 +205,14 @@ class DeploymentsController < ApplicationController
     if params[:details_tab]
       @view = @details_tab[:view]
     end
+
+    failures = []
+    @deployment.instances.each do |instance|
+      last_task = instance.tasks.last
+      failures << I18n.t('deployments.flash.warning.failure_on_instance', :name => instance.name, :message => last_task.message) if last_task.present? && last_task.failed?
+    end
+    flash.now[:warning] = failures.to_sentence if failures.any?
+
     respond_to do |format|
       format.html { render :action => 'show'}
       format.js   { render :partial => @details_tab[:view] }
diff --git a/src/app/models/task.rb b/src/app/models/task.rb
index 86d966c..3825105 100644
--- a/src/app/models/task.rb
+++ b/src/app/models/task.rb
@@ -143,4 +143,9 @@ class Task < ActiveRecord::Base
     errors.add("time_ended", "Tasks ends before it's started") unless time_ended.nil? or time_started.nil? or time_ended >= time_started
     errors.add("time_started", "Tasks starts before it's created") unless time_started.nil? or created_at.nil? or time_started >= created_at
   end
+
+  def failed?
+    state == STATE_FAILED
+  end
+
 end
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index f2671b0..fd14056 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -1037,6 +1037,7 @@ Alert Flash -- v.0.0.1 [flash] (flash.scss)
       font-size: 12px;
       padding-left: 8px;
       list-style: none;
+      width: 880px;
 
       li + li{
         margin-top: 6px;
diff --git a/src/app/util/taskomatic.rb b/src/app/util/taskomatic.rb
index 5ddb782..73900a9 100644
--- a/src/app/util/taskomatic.rb
+++ b/src/app/util/taskomatic.rb
@@ -72,6 +72,13 @@ module Taskomatic
     rescue Exception => ex
       task.state = Task::STATE_FAILED
       task.message = ex.message
+
+      # For RHEV-M, since we need to start up the instance after the vm has been created
+      # we also have to handle create_failed state events separately
+      if task.instance.state == Instance::STATE_STOPPED && task.action == InstanceTask::ACTION_START &&
+          task.instance.provider_account.provider.provider_type.deltacloud_driver == 'rhevm'
+        task.instance.update_attributes(:state => Instance::STATE_CREATE_FAILED)
+      end
     ensure
       task.save! if Task.exists?(task.id)
     end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 67f5b11..99d27c8 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -264,6 +264,7 @@ en:
         disabled_pool: "Cannot launch a Deployment in this Pool. The pool has been disabled."
         failed_to_launch: "Deployment launch failed!"
         deployable_not_selected: "You need to select deployable"
+        failure_on_instance: "Failure reported on %{name}: %{message}"
       error:
         not_launched: "Some assemblies will not be launched:"
         failed_to_launch_assemblies: "Failed to launch following assemblies:"
-- 
1.7.6.5




More information about the aeolus-devel mailing list