[Ovirt-devel] [PATCH] initial push of smart pool code. (revised)
David Lutterkort
lutter at redhat.com
Thu Sep 4 00:25:51 UTC 2008
On Wed, 2008-09-03 at 12:12 -0400, Scott Seago wrote:
> This isn't complete, but I want to get it committed before the repo
> refactoring. This patch includes the controller refactoring needed for
> adding the new smart pool controllers, but I have not yet added any
> code to the new controllers. The models are in place for smart pools,
> but they aren't used anywhere yet. In addition, I've added a new
> DirectoryPool pool type that is used solely as a placeholder -- so
> that we can have a common root for all hardware and smart pools, and
> that we can organize smart pools by user.
>
> Since we need this pushed before the repo refactoring, this patch
> should be acked if it doesn't break anything. Separate review comments
> are, of course, welcome -- but anything that doesn't break the WUI
> will be fixed in a subsequent (post-repo-reorg) patch)
>
> Signed-off-by: Scott Seago <sseago at redhat.com>
Looks good overall.
> diff --git a/wui/src/app/controllers/hardware_controller.rb b/wui/src/app/controllers/hardware_controller.rb
> index 7c1d916..091ce97 100644
> --- a/wui/src/app/controllers/hardware_controller.rb
> +++ b/wui/src/app/controllers/hardware_controller.rb
> @@ -18,7 +18,7 @@
> # also available at http://www.gnu.org/copyleft/gpl.html.
> #
>
> -class HardwareController < ApplicationController
> +class HardwareController < PoolController
>
> XML_OPTS = {
> :include => [ :storage_pools, :hosts, :quota ]
XML_OPTS also needs to be moved to PoolController, since it's used in show.
> diff --git a/wui/src/app/models/pool.rb b/wui/src/app/models/pool.rb
> index 6599c72..9d71fa5 100644
> --- a/wui/src/app/models/pool.rb
> +++ b/wui/src/app/models/pool.rb
> + def self.find_by_path(path)
> + segs = path.split("/")
> + unless segs.shift.empty?
> + raise "Path must be absolute, but is #{path}"
> + end
> + default_pool = DirectoryPool.get_directory_root
> + if segs.shift == default_pool.name
> + segs.inject(default_pool) do |pool, seg|
> + pool.children.find { |p| p.name == seg } if pool
> + end
> + end
> + end
This should probably be changed a little - I don't think there's a need
to expose the internal /root prefix, i.e. we should have paths
like /hardware/default/mypool and /users/joe/hispool.
David
More information about the ovirt-devel
mailing list