[Ovirt-devel] [PATCH server 5/8] Factor StorageVolume functionality out of StorageController

Scott Seago sseago at physical.priv.ovirt.org
Tue Feb 3 16:15:29 UTC 2009


On Mon, Feb 02, 2009 at 12:35:34PM -0800, David Lutterkort wrote:
> Storage volumes can now be accessed through their own controller. This is
> needed to expose them in the API.
> ---
> diff --git a/src/app/controllers/storage_volume_controller.rb b/src/app/controllers/storage_volume_controller.rb
> new file mode 100644
> index 0000000..ba486d2
> --- /dev/null
> +++ b/src/app/controllers/storage_volume_controller.rb
> @@ -0,0 +1,228 @@
> +#
> +# Copyright (C) 2009 Red Hat, Inc.
> +# Written by Scott Seago <sseago at redhat.com>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 2 of the License.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA  02110-1301, USA.  A copy of the GNU General Public License is
> +# also available at http://www.gnu.org/copyleft/gpl.html.
> +
> +class StorageVolumeController < ApplicationController
> +
> +  before_filter :pre_create, :only => [:create]
This before_filter isn't necessary since it's already defined in application.rb -- all you need to do here is define the before_filter method implementation

One thing that I did find missing was another reference to the new_volume action -- but this was in jguiddita's new code that wasn't there when the original patches were created -- and since it was new, it didn't come up as a merge conflict:

diff --git a/src/app/views/vm/_form.rhtml b/src/app/views/vm/_form.rhtml
index 7cbe16d..d1c0e45 100644
--- a/src/app/views/vm/_form.rhtml
+++ b/src/app/views/vm/_form.rhtml
@@ -71,10 +71,10 @@
             {if item.create_volume}
               <%=image_tag("icon_addstorage.png")%>
               {if item.is_pool}
-              <a href="<%= url_for :controller => 'storage', :action => 'new_volume'%>?storage_pool_id=${item.id}&return_to_workflow=true"
+              <a href="<%= url_for :controller => 'storage_volume', :action => 'new'%>?storage_pool_id=${item.id}&return_to_workflow=true"
                 rel="facebox[.bolder]" class="selection_facebox"></a>
               {else}
-              <a href="<%= url_for :controller => 'storage', :action => 'new_volume'%>?source_volume_id=${item.id}&return_to_workflow=true"
+              <a href="<%= url_for :controller => 'storage_volume', :action => 'new'%>?source_volume_id=${item.id}&return_to_workflow=true"
                 rel="facebox[.bolder]" class="selection_facebox"></a>
               {/if}
             {/if}

Scott




More information about the ovirt-devel mailing list