incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] Drivers configuration file splitted to multiple files to help packaging each driver separately.
Date Tue, 28 Jun 2011 14:34:00 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/config/drivers.yaml             |   52 --------------------------------
 server/config/drivers/azure.yaml       |    3 ++
 server/config/drivers/ec2.yaml         |   19 +++++++++++
 server/config/drivers/eucalyptus.yaml  |    8 +++++
 server/config/drivers/gogrid.yaml      |    3 ++
 server/config/drivers/mock.yaml        |    3 ++
 server/config/drivers/opennebula.yaml  |    4 ++
 server/config/drivers/rackspace.yaml   |    3 ++
 server/config/drivers/rhevm.yaml       |    3 ++
 server/config/drivers/rimuhosting.yaml |    3 ++
 server/config/drivers/sbc.yaml         |    2 +
 server/config/drivers/terremark.yaml   |    3 ++
 server/config/drivers/vsphere.yaml     |    8 +++++
 server/lib/drivers.rb                  |    8 ++++-
 14 files changed, 69 insertions(+), 53 deletions(-)
 delete mode 100644 server/config/drivers.yaml
 create mode 100644 server/config/drivers/azure.yaml
 create mode 100644 server/config/drivers/ec2.yaml
 create mode 100644 server/config/drivers/eucalyptus.yaml
 create mode 100644 server/config/drivers/gogrid.yaml
 create mode 100644 server/config/drivers/mock.yaml
 create mode 100644 server/config/drivers/opennebula.yaml
 create mode 100644 server/config/drivers/rackspace.yaml
 create mode 100644 server/config/drivers/rhevm.yaml
 create mode 100644 server/config/drivers/rimuhosting.yaml
 create mode 100644 server/config/drivers/sbc.yaml
 create mode 100644 server/config/drivers/terremark.yaml
 create mode 100644 server/config/drivers/vsphere.yaml

diff --git a/server/config/drivers.yaml b/server/config/drivers.yaml
deleted file mode 100644
index d26d85a..0000000
--- a/server/config/drivers.yaml
+++ /dev/null
@@ -1,52 +0,0 @@
----
-:gogrid:
-  :name: Gogrid
-:mock:
-  :name: Mock
-:rhevm:
-  :name: RHEVM
-:rimuhosting:
-  :name: RimuHosting
-:opennebula:
-  :class: OpennebulaDriver
-  :name: Opennebula
-:sbc:
-  :name: SBC
-:terremark:
-  :name: Terremark
-:rackspace:
-  :name: Rackspace
-:azure:
-  :name: Azure
-:eucalyptus:
-  :name: Eucalyptus
-  :username: Access Key ID
-  :password: Secret Access Key
-  :entrypoints:
-    default:
-      default: "ec2=EUCALYPTUS_IP[:PORT];s3=WALRUS_IP[:PORT]"
-:ec2:
-  :entrypoints:
-    s3:
-      us-west-1: s3-us-west-1.amazonaws.com
-      ap-southeast-1: s3-ap-southeast-1.amazonaws.com
-      eu-west-1: s3-eu-west-1.amazonaws.com
-      us-east-1: s3.amazonaws.com
-    elb:
-      us-west-1: elasticloadbalancing.us-west-1.amazonaws.com
-      ap-southeast-1: elasticloadbalancing.ap-southeast-1.amazonaws.com
-      eu-west-1: elasticloadbalancing.eu-west-1.amazonaws.com
-      us-east-1: elasticloadbalancing.us-east-1.amazonaws.com
-    ec2:
-      us-west-1: ec2.us-west-1.amazonaws.com
-      ap-southeast-1: ec2.ap-southeast-1.amazonaws.com
-      eu-west-1: ec2.eu-west-1.amazonaws.com
-      us-east-1: ec2.us-east-1.amazonaws.com
-  :name: EC2
-:vsphere:
-  :name: VSphere
-  :username: Login Name
-  :password: Password
-  :entrypoints:
-    default:
-      default: "https://vsphere.provider.com/sdk"
diff --git a/server/config/drivers/azure.yaml b/server/config/drivers/azure.yaml
new file mode 100644
index 0000000..329348e
--- /dev/null
+++ b/server/config/drivers/azure.yaml
@@ -0,0 +1,3 @@
+---
+:azure:
+  :name: Azure
diff --git a/server/config/drivers/ec2.yaml b/server/config/drivers/ec2.yaml
new file mode 100644
index 0000000..0840558
--- /dev/null
+++ b/server/config/drivers/ec2.yaml
@@ -0,0 +1,19 @@
+---
+:ec2:
+  :entrypoints:
+    s3:
+      us-west-1: s3-us-west-1.amazonaws.com
+      ap-southeast-1: s3-ap-southeast-1.amazonaws.com
+      eu-west-1: s3-eu-west-1.amazonaws.com
+      us-east-1: s3.amazonaws.com
+    elb:
+      us-west-1: elasticloadbalancing.us-west-1.amazonaws.com
+      ap-southeast-1: elasticloadbalancing.ap-southeast-1.amazonaws.com
+      eu-west-1: elasticloadbalancing.eu-west-1.amazonaws.com
+      us-east-1: elasticloadbalancing.us-east-1.amazonaws.com
+    ec2:
+      us-west-1: ec2.us-west-1.amazonaws.com
+      ap-southeast-1: ec2.ap-southeast-1.amazonaws.com
+      eu-west-1: ec2.eu-west-1.amazonaws.com
+      us-east-1: ec2.us-east-1.amazonaws.com
+  :name: EC2
diff --git a/server/config/drivers/eucalyptus.yaml b/server/config/drivers/eucalyptus.yaml
new file mode 100644
index 0000000..5b716bd
--- /dev/null
+++ b/server/config/drivers/eucalyptus.yaml
@@ -0,0 +1,8 @@
+---
+:eucalyptus:
+  :name: Eucalyptus
+  :username: Access Key ID
+  :password: Secret Access Key
+  :entrypoints:
+    default:
+      default: "ec2=EUCALYPTUS_IP[:PORT];s3=WALRUS_IP[:PORT]"
diff --git a/server/config/drivers/gogrid.yaml b/server/config/drivers/gogrid.yaml
new file mode 100644
index 0000000..4298147
--- /dev/null
+++ b/server/config/drivers/gogrid.yaml
@@ -0,0 +1,3 @@
+---
+:gogrid:
+  :name: Gogrid
diff --git a/server/config/drivers/mock.yaml b/server/config/drivers/mock.yaml
new file mode 100644
index 0000000..2289384
--- /dev/null
+++ b/server/config/drivers/mock.yaml
@@ -0,0 +1,3 @@
+---
+:mock:
+  :name: Mock
diff --git a/server/config/drivers/opennebula.yaml b/server/config/drivers/opennebula.yaml
new file mode 100644
index 0000000..df4e239
--- /dev/null
+++ b/server/config/drivers/opennebula.yaml
@@ -0,0 +1,4 @@
+---
+:opennebula:
+  :class: OpennebulaDriver
+  :name: Opennebula
diff --git a/server/config/drivers/rackspace.yaml b/server/config/drivers/rackspace.yaml
new file mode 100644
index 0000000..ac4ee53
--- /dev/null
+++ b/server/config/drivers/rackspace.yaml
@@ -0,0 +1,3 @@
+---
+:rackspace:
+  :name: Rackspace
diff --git a/server/config/drivers/rhevm.yaml b/server/config/drivers/rhevm.yaml
new file mode 100644
index 0000000..eeed0c9
--- /dev/null
+++ b/server/config/drivers/rhevm.yaml
@@ -0,0 +1,3 @@
+---
+:rhevm:
+  :name: RHEVM
diff --git a/server/config/drivers/rimuhosting.yaml b/server/config/drivers/rimuhosting.yaml
new file mode 100644
index 0000000..acf8a98
--- /dev/null
+++ b/server/config/drivers/rimuhosting.yaml
@@ -0,0 +1,3 @@
+---
+:rimuhosting:
+  :name: RimuHosting
diff --git a/server/config/drivers/sbc.yaml b/server/config/drivers/sbc.yaml
new file mode 100644
index 0000000..6317c7c
--- /dev/null
+++ b/server/config/drivers/sbc.yaml
@@ -0,0 +1,2 @@
+:sbc:
+  :name: SBC
diff --git a/server/config/drivers/terremark.yaml b/server/config/drivers/terremark.yaml
new file mode 100644
index 0000000..759e26a
--- /dev/null
+++ b/server/config/drivers/terremark.yaml
@@ -0,0 +1,3 @@
+---
+:terremark:
+  :name: Terremark
diff --git a/server/config/drivers/vsphere.yaml b/server/config/drivers/vsphere.yaml
new file mode 100644
index 0000000..1f629fc
--- /dev/null
+++ b/server/config/drivers/vsphere.yaml
@@ -0,0 +1,8 @@
+---
+:vsphere:
+  :name: VSphere
+  :username: Login Name
+  :password: Password
+  :entrypoints:
+    default:
+      default: "https://vsphere.provider.com/sdk"
diff --git a/server/lib/drivers.rb b/server/lib/drivers.rb
index 00eaf9d..722e1d7 100644
--- a/server/lib/drivers.rb
+++ b/server/lib/drivers.rb
@@ -32,7 +32,13 @@ module Deltacloud
     DRIVER=ENV['API_DRIVER'] ? ENV['API_DRIVER'].to_sym : :mock
 
     def driver_config
-      YAML::load(File.read(File.join(File.dirname(__FILE__), '..', 'config', 'drivers.yaml')))
+      if Thread::current[:drivers].nil?
+        Thread::current[:drivers] = {}
+        Dir[File.join(File::dirname(__FILE__), '..', 'config', 'drivers', '*.yaml')].each
do |driver_file|
+          Thread::current[:drivers].merge!(YAML::load(File::read(driver_file)))
+        end
+      end
+      Thread::current[:drivers]
     end
 
     def driver_symbol
-- 
1.7.4.1


Mime
View raw message