deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: [PATCH] Set name in hardware profile in openstack driver.
Date Fri, 02 Nov 2012 10:07:56 GMT
Hi Ian:

On 01/11/12 20:27, Ian Main wrote:
> Name was not being set which is crucial for heat usage.
> 

patch looks fine - in the sense that there is no problem for us to grab
the 'name' of a flavor being passed back from Openstack and expose this
as the 'name' attribute of a hardware_profile.

HOWEVER, it is not possible to then use this 'name' attribute as a
reference to a hardware profile. For example, lets say there is a flavor
with ID: 1 and name: "256_MB_and_1_CPU":

(against Deltacloud):

GET /api/hardware_profiles/1 ==> 200 OK

GET /api/hardware_profiles/256 MB and 1 CPU  ==> explosions.

Can you explain why is crucial for heat to have 'name'. If you really
need to have lookup/reference to hardware profile by descriptive name,
its possible but we need to change the deltacloud code. So that GET
"256_MB_and_1_CPU" would mean getting a list of all flavors and
filtering for the one with that name.

Only issue here though is that :id is a bona-fide UUID whereas :name is
just a string. I wonder if there can be duplicates?

thanks, marios

> Signed-off-by: Ian Main <imain@redhat.com>
> ---
>  server/lib/deltacloud/drivers/openstack/openstack_driver.rb | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
> index 5b29840..5c40425 100644
> --- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
> +++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
> @@ -363,12 +363,14 @@ private
>  
>          def convert_from_flavor(flavor)
>            op = (flavor.class == Hash)? :fetch : :send
> -          HardwareProfile.new(flavor.send(op, :id).to_s) do
> +          hwp = HardwareProfile.new(flavor.send(op, :id).to_s) do
>              architecture 'x86_64'
>              memory flavor.send(op, :ram).to_i
>              storage flavor.send(op, :disk).to_i
>              cpu flavor.send(op, :vcpus).to_i
>            end
> +	  hwp.name = flavor.send(op, :name)
> +	  return hwp
>          end
>  
>          def convert_from_image(image, owner)
> 


Mime
View raw message