You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:19:45 UTC
svn commit: r962054 - in /incubator/deltacloud/trunk/framework:
app/controllers/ app/models/ app/views/storage_volumes/ config/
lib/converters/ lib/deltacloud/
Author: lutter
Date: Thu Jul 8 23:19:45 2010
New Revision: 962054
URL: http://svn.apache.org/viewvc?rev=962054&view=rev
Log:
Add models and conversion for storage-volumes.
Adjust driver SPI to be consistent with "storage-volumes" instead of simply "volumes"
Added:
incubator/deltacloud/trunk/framework/app/models/storage_volume.rb
Modified:
incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb
incubator/deltacloud/trunk/framework/app/views/storage_volumes/index.html.erb
incubator/deltacloud/trunk/framework/app/views/storage_volumes/show.html.erb
incubator/deltacloud/trunk/framework/config/environment.rb
incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb
incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb
Modified: incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb?rev=962054&r1=962053&r2=962054&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/storage_volumes_controller.rb Thu Jul 8 23:19:45 2010
@@ -6,7 +6,7 @@ class StorageVolumesController < Applica
around_filter :catch_auth
def index
- @volumes = driver.volumes( credentials )
+ @volumes = driver.storage_volumes( credentials, :id=>params[:id] )
puts @volumes.inspect
respond_to do |format|
format.html
@@ -18,7 +18,7 @@ class StorageVolumesController < Applica
end
def show
- @volume = driver.volume( credentials, :id => params[:id] )
+ @volume = driver.storage_volume( credentials, :id => params[:id] )
respond_to do |format|
format.html
format.json
Added: incubator/deltacloud/trunk/framework/app/models/storage_volume.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/models/storage_volume.rb?rev=962054&view=auto
==============================================================================
--- incubator/deltacloud/trunk/framework/app/models/storage_volume.rb (added)
+++ incubator/deltacloud/trunk/framework/app/models/storage_volume.rb Thu Jul 8 23:19:45 2010
@@ -0,0 +1,10 @@
+
+class StorageVolume < BaseModel
+
+ attr_accessor :created
+ attr_accessor :state
+ attr_accessor :capacity
+ attr_accessor :instance_id
+ attr_accessor :device
+
+end
Modified: incubator/deltacloud/trunk/framework/app/views/storage_volumes/index.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/storage_volumes/index.html.erb?rev=962054&r1=962053&r2=962054&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/storage_volumes/index.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/storage_volumes/index.html.erb Thu Jul 8 23:19:45 2010
@@ -19,16 +19,16 @@
<% for volume in @volumes %>
<tr>
<td>
- <%= link_to volume[:id], storage_volume_url( volume[:id] ) %>
+ <%= link_to volume.id, storage_volume_url( volume.id ) %>
</td>
<td>
- <%= volume[:created] %>
+ <%= volume.created %>
</td>
<td>
- <%= volume[:capacity] %> GB
+ <%= volume.capacity %> GB
</td>
<td>
- <%= volume[:state] %>
+ <%= volume.state %>
</td>
</tr>
<% end %>
Modified: incubator/deltacloud/trunk/framework/app/views/storage_volumes/show.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/storage_volumes/show.html.erb?rev=962054&r1=962053&r2=962054&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/storage_volumes/show.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/storage_volumes/show.html.erb Thu Jul 8 23:19:45 2010
@@ -1,5 +1,5 @@
-<h1><%= @volume[:id] %></h1>
+<h1><%= @volume.id %></h1>
<dl>
<di>
@@ -7,7 +7,7 @@
Created
</dt>
<dd>
- <%= @volume[:created] %>
+ <%= @volume.created %>
</dd>
</di>
<di>
@@ -15,7 +15,7 @@
Capacity
</dt>
<dd>
- <%= @volume[:capacity] %> GB
+ <%= @volume.capacity %> GB
</dd>
</di>
<di>
@@ -23,7 +23,7 @@
State
</dt>
<dd>
- <%= @volume[:state] %>
+ <%= @volume.state %>
</dd>
</di>
<di>
@@ -31,7 +31,9 @@
Attached
</dt>
<dd>
- <%= @volume[:instance_id] %> <%= @volume[:device] %>
+ <% if ( @volume.instance_id ) %>
+ <%= link_to @volume.instance_id, instance_url( @volume.instance_id ) %> - <%= @volume.device %>
+ <% end %>
</dd>
</di>
</dl>
Modified: incubator/deltacloud/trunk/framework/config/environment.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/config/environment.rb?rev=962054&r1=962053&r2=962054&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/config/environment.rb (original)
+++ incubator/deltacloud/trunk/framework/config/environment.rb Thu Jul 8 23:19:45 2010
@@ -51,8 +51,8 @@ Rails::Initializer.run do |config|
end
-DRIVER=:ec2
-#DRIVER=:mock
+#DRIVER=:ec2
+DRIVER=:mock
DRIVER_ROOT = File.dirname( __FILE__ ) + "/../../deltacloud-driver-#{DRIVER}"
$: << DRIVER_ROOT+'/lib'
Modified: incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb?rev=962054&r1=962053&r2=962054&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb (original)
+++ incubator/deltacloud/trunk/framework/lib/converters/xml_converter.rb Thu Jul 8 23:19:45 2010
@@ -73,7 +73,20 @@ module Converters
builder.address( address )
end
}
- }
+ }
+ when StorageVolume
+ builder.__send__('storage-volume', :href=>@link_builder.send( :storage_volume_url, obj.id )) {
+ builder.id( obj.id )
+ builder.created( obj.created )
+ builder.state( obj.state )
+ builder.capacity( obj.capacity )
+ builder.device( obj.device )
+ if ( obj.instance_id )
+ builder.instance( :href=>@link_builder.send( :instance_url, obj.instance_id ) )
+ else
+ builder.instance()
+ end
+ }
end
end
return builder.target!
Modified: incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb?rev=962054&r1=962053&r2=962054&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb (original)
+++ incubator/deltacloud/trunk/framework/lib/deltacloud/base_driver.rb Thu Jul 8 23:19:45 2010
@@ -36,14 +36,14 @@ module DeltaCloud
def reboot_instance(credentials, id)
end
- def volume(credentials, opts)
- volumes = volumes(credentials, opts)
+ def storage_volume(credentials, opts)
+ volumes = storage_volumes(credentials, opts)
return volumes.first unless volumes.empty?
nil
end
- def snapshot(credentials, opts)
- snapshots = snapshots(credentials, opts)
+ def storage_snapshot(credentials, opts)
+ snapshots = storage_snapshots(credentials, opts)
return snapshots.first unless snapshots.empty?
nil
end