Return-Path: Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: (qmail 85007 invoked from network); 24 Mar 2011 08:01:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Mar 2011 08:01:50 -0000 Received: (qmail 46679 invoked by uid 500); 24 Mar 2011 08:01:50 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 46660 invoked by uid 500); 24 Mar 2011 08:01:49 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 46652 invoked by uid 99); 24 Mar 2011 08:01:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Mar 2011 08:01:49 +0000 X-ASF-Spam-Status: No, hits=-0.3 required=5.0 tests=RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sang-min.park@eucalyptus.com designates 74.125.149.75 as permitted sender) Received: from [74.125.149.75] (HELO na3sys009aog105.obsmtp.com) (74.125.149.75) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 24 Mar 2011 08:01:41 +0000 Received: from source ([209.85.210.42]) (using TLSv1) by na3sys009aob105.postini.com ([74.125.148.12]) with SMTP ID DSNKTYr6TyGIvTMUyRYsqIQW5o6j+SBi7fP8@postini.com; Thu, 24 Mar 2011 01:01:20 PDT Received: by pzk4 with SMTP id 4so1312099pzk.29 for ; Thu, 24 Mar 2011 01:01:19 -0700 (PDT) Received: by 10.142.131.11 with SMTP id e11mr6157757wfd.51.1300953678578; Thu, 24 Mar 2011 01:01:18 -0700 (PDT) Received: from localhost.localdomain (sbws-cf9a6de1.wrl.impulse.net [207.154.109.225]) by mx.google.com with ESMTPS id w11sm11159625wfh.18.2011.03.24.01.01.16 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Mar 2011 01:01:17 -0700 (PDT) From: sang-min.park@eucalyptus.com To: deltacloud-dev@incubator.apache.org Cc: Sang-Min Park Subject: [PATCH] Eucalyptus driver support Date: Thu, 24 Mar 2011 01:00:51 -0700 Message-Id: <1300953651-31921-2-git-send-email-sang-min.park@eucalyptus.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1300953651-31921-1-git-send-email-sang-min.park@eucalyptus.com> References: <1300953651-31921-1-git-send-email-sang-min.park@eucalyptus.com> X-Virus-Checked: Checked by ClamAV on apache.org From: Sang-Min Park --- server/config/drivers.yaml | 4 + .../drivers/eucalyptus/eucalyptus_driver.rb | 147 ++++++++++++++++++++ 2 files changed, 151 insertions(+), 0 deletions(-) create mode 100644 server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb diff --git a/server/config/drivers.yaml b/server/config/drivers.yaml index d028ca0..8248e05 100644 --- a/server/config/drivers.yaml +++ b/server/config/drivers.yaml @@ -21,6 +21,10 @@ :name: Rackspace :azure: :name: Azure +:eucalyptus: + :name: Eucalyptus + :username: Access Key ID + :password: Secret Access Key :ec2: :entrypoints: s3: diff --git a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb new file mode 100644 index 0000000..a13dc01 --- /dev/null +++ b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb @@ -0,0 +1,147 @@ +# Copyright (C) 2009, 2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +require 'deltacloud/drivers/ec2/ec2_driver.rb' + +module Deltacloud + module Drivers + module Eucalyptus + class EucalyptusDriver < EC2::EC2Driver + + def supported_collections + DEFAULT_COLLECTIONS + [ :keys, :buckets ] + end + + feature :instances, :user_data + feature :instances, :authentication_key + feature :instances, :security_group + feature :instances, :instance_count + feature :images, :owner_id + + define_hardware_profile('m1.small') do + cpu 1 + memory 128 + storage 2 + architecture 'x86_64' + end + + define_hardware_profile('c1.medium') do + cpu 1 + memory 256 + storage 5 + architecture 'x86_64' + end + + define_hardware_profile('m1.large') do + cpu 2 + memory 512 + storage 10 + architecture 'x86_64' + end + + define_hardware_profile('m1.xlarge') do + cpu 2 + memory 1024 + storage 20 + architecture 'x86_64' + end + + define_hardware_profile('c1.xlarge') do + cpu 4 + memory 2048 + storage 20 + architecture 'x86_64' + end + + def self.instance_state_machine + EC2::EC2Driver.instance_state_machine + end + + def instance_state_machine + self.class.instance_state_machine + end + + def default_image_owner + "self" + end + + def default_image_type + nil + end + + def tagging? + false + end + + def tag_instance(credentials, instance, name) + # dummy + end + + def untag_instance(credentials, instance_id) + # dummy + end + + # because load balancer is not on the supported_collections, + # the following methods shouldn't be called. + def load_balancer(credentials, opts={}) + raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") + end + + def load_balancers(credentials, opts=nil) + raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") + end + + def create_load_balancer(credentials, opts={}) + raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") + end + + def destroy_load_balancer(credentials, id) + raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") + end + + def lb_register_instance(credentials, opts={}) + raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") + end + + def lb_unregister_instance(credentials, opts={}) + raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") + end + + def new_client(credentials, type = :ec2) + klass = case type + when :ec2 then Aws::Ec2 + when :s3 then Aws::S3 + when :elb then raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") + end + klass.new(credentials.user, credentials.password, eucalyptus_endpoint) + end + + def eucalyptus_endpoint + endpoint = (Thread.current[:provider] || ENV['API_PROVIDER']) + #parse endpoint string into server, port, service, and protocol + if endpoint + {:server => URI.parse(endpoint).host, :port => URI.parse(endpoint).port, :service => URI.parse(endpoint).path, :protocol => URI.parse(endpoint).scheme, :connection_mode => :per_thread} + else + {:connection_mode => :per_thread} #EC2_URL/S3_URL env variable will be used by AWS + end + end + end + end + end +end + -- 1.7.1