You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/05/31 10:28:27 UTC
[PATCH core] EC2: Added the 'metrics' feature to enable CloudWatch in EC2
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 4 ++++
server/lib/deltacloud/drivers/features.rb | 7 +++++++
server/views/instances/new.html.haml | 5 +++++
3 files changed, 16 insertions(+)
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index f7ef826..b915b75 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -37,6 +37,7 @@ module Deltacloud
feature :instances, :authentication_key
feature :instances, :firewalls
feature :instances, :instance_count
+ feature :instances, :metrics
feature :images, :owner_id
feature :images, :image_name
feature :images, :image_description
@@ -223,6 +224,9 @@ module Deltacloud
if opts[:user_data]
instance_options[:user_data] = Base64::decode64(opts[:user_data])
end
+ if opts[:metrics] and !opts[:metrics].empty?
+ instance_options[:monitoring_enabled] = true
+ end
instance_options[:key_name] = opts[:keyname] if opts[:keyname]
instance_options[:availability_zone] = opts[:realm_id] if opts[:realm_id]
instance_options[:instance_type] = opts[:hwp_id] if opts[:hwp_id] && opts[:hwp_id].length > 0
diff --git a/server/lib/deltacloud/drivers/features.rb b/server/lib/deltacloud/drivers/features.rb
index c2af8cb..7e98749 100644
--- a/server/lib/deltacloud/drivers/features.rb
+++ b/server/lib/deltacloud/drivers/features.rb
@@ -58,6 +58,13 @@ module Deltacloud
end
end
+ feature :metrics, :for => :instances do
+ description "Enable more detailed monitoring and metrics reporting for the instance"
+ operation :create do
+ param :metrics, :string, :optional
+ end
+ end
+
feature :user_name, :for => :instances do
description "Allow to set user-defined name for the instance"
operation :create do
diff --git a/server/views/instances/new.html.haml b/server/views/instances/new.html.haml
index 3a1d90c..4141547 100644
--- a/server/views/instances/new.html.haml
+++ b/server/views/instances/new.html.haml
@@ -42,6 +42,11 @@
%label{ :for => :instance_count} # of instances to be launched:
%input{ :type => :text, :id => :instance_count, :name => :instance_count, :value => '1' }
+ - if driver.class.has_feature?(:instances, :metrics)
+ %div{ 'data-role' => :fieldcontain }
+ %label{ :for => :metrics} Enable metrics for this instance
+ %input{ :type => :checkbox, :id => :metrics, :name => :metrics, :checked => 'false' }
+
- if driver.class.has_feature?(:instances, :authentication_key)
%div{ 'data-role' => :fieldcontain }
%label{ :for => :keyname, :class => 'ui-input-text'} Instance SSH key:
--
1.7.10.2