From: Michal Fojtik <mfoj...@redhat.com>

Signed-off-by: Michal fojtik <mfoj...@redhat.com>
---
 server/config/drivers/openstack.yaml               |    3 +
 .../drivers/openstack/openstack_driver.rb          |   47 ++++++++++++++++++++
 .../drivers/rackspace/rackspace_driver.rb          |    3 +-
 3 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 server/config/drivers/openstack.yaml
 create mode 100644 server/lib/deltacloud/drivers/openstack/openstack_driver.rb

diff --git a/server/config/drivers/openstack.yaml 
b/server/config/drivers/openstack.yaml
new file mode 100644
index 0000000..495b38a
--- /dev/null
+++ b/server/config/drivers/openstack.yaml
@@ -0,0 +1,3 @@
+---
+:openstack:
+  :name: Openstack
diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb 
b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
new file mode 100644
index 0000000..d09edf2
--- /dev/null
+++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
@@ -0,0 +1,47 @@
+# 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/rackspace/rackspace_driver.rb'
+module Deltacloud
+  module Drivers
+    module Openstack
+      class OpenstackDriver < Rackspace::RackspaceDriver
+
+        feature :instances, :user_name
+        feature :instances, :authentication_password
+        feature :instances, :user_files
+
+        define_instance_states do
+          start.to( :pending )          .on( :create )
+          pending.to( :running )        .automatically
+          running.to( :running )        .on( :reboot )
+          running.to( :shutting_down )  .on( :stop )
+          shutting_down.to( :stopped )  .automatically
+          stopped.to( :finish )         .automatically
+        end
+
+        def new_client(credentials)
+          safely do
+            CloudServers::Connection.new(:username => credentials.user, 
:api_key => credentials.password, :auth_url => api_provider)
+          end
+        end
+
+        private :new_client
+      end
+    end
+  end
+end
+
diff --git a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb 
b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
index e7c52d7..5125057 100644
--- a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
+++ b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
@@ -356,8 +356,7 @@ class RackspaceDriver < Deltacloud::BaseDriver
     return http, request
   end
 
-private
-
+  private
 
   def new_client(credentials)
     safely do
-- 
1.7.4.4

Reply via email to