[Ovirt-devel] [PATCH server 4/8] API: include storage_volumes; indicate type for individual pools

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


On Mon, Feb 02, 2009 at 12:35:33PM -0800, David Lutterkort wrote:
> ---
>  src/app/controllers/storage_controller.rb |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/app/controllers/storage_controller.rb b/src/app/controllers/storage_controller.rb
> index 160d22e..ee9f116 100644
> --- a/src/app/controllers/storage_controller.rb
> +++ b/src/app/controllers/storage_controller.rb
> @@ -32,7 +32,7 @@ class StorageController < ApplicationController
>      list
>      respond_to do |format|
>        format.html { render :action => 'list' }
> -      format.xml { render :xml => @storage_pools.to_xml }
> +      format.xml { render :xml => @storage_pools.to_xml( :include => :storage_volumes) }
>      end
>    end
One thing this isn't handling is the nesting of LVM volumes. Instead of the lvm volumes showing up as children of the source volume they show up as separate entries.
On the WUI side when we generate the storage tree we filter out top level LvmStorageVolumes and include the LVM volumes as children of the containing iSCSI volume.

At the active_record level this would mean following the lvm_storage_pool association on StorageVolume and then getting the lvm pool's storage volumes. In the UI tree we don't show the LVM pool at all -- a storage volume will belong to at most one LVM pool, and we're currently not allowing multiple source volumes in a volume group, so for the end user all that matters is that a given storage volume (iSCSI lun, etc) may contain several LVM volumes.

Since the API results tend to be a lot closer to the underlying data model, perhaps you want to include the lvm pool in the results. In which case we'd need storage_volumes to include 
:lvm_storage_pool, and that would, in turn, include :storage_volumes. In addition to this we would filter the top level find all query to only find storage pools that aren't LVM pools.

Scott


>  
> @@ -80,7 +80,12 @@ class StorageController < ApplicationController
>      else
>        respond_to do |format|
>          format.html { render :layout => 'selection' }
> -        format.xml { render :xml => @storage_pool.to_xml }
> +        format.xml {
> +          xml_txt = @storage_pool.to_xml(:include => :storage_volumes) do |xml|
> +            xml.type @storage_pool.class.name
> +          end
> +          render :xml => xml_txt
> +        }
>        end
>      end
>    end
> -- 
> 1.6.0.6
> 
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel




More information about the ovirt-devel mailing list