You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Ian Main <im...@redhat.com> on 2012/11/01 19:27:49 UTC
[PATCH] Set name in hardware profile in openstack driver.
Name was not being set which is crucial for heat usage.
Signed-off-by: Ian Main <im...@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)
--
1.7.11.7
Re: [PATCH] Set name in hardware profile in openstack driver.
Posted by "marios@redhat.com" <ma...@redhat.com>.
On 06/11/12 18:16, Ian Main wrote:
> On Fri, Nov 02, 2012 at 12:07:56PM +0200, marios@redhat.com wrote:
>> 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.
>
> Believe it or not it's so that humans can tell which one to use.. :) No
> need to change deltacloud code as we will pass the ID into deltacloud
> API.
ok - thanks for the clarification. I just pushed this patch with commit
id cf5a3ae7b2e27b1e28d1e9cb33629e6ae8a9a824 - should make its way into
release 1.0.5 which we are working to cut this week,
(waiting for your input on the user-data patch - likely any changes
there won't make their way into this release as we are getting the rc
out asap)
thanks, marios
>
>> 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?
>
> I think that depends on the configuration of the cloud.. I would think
> in 99% of cases it would be unique.
>
> Ian
>
Re: [PATCH] Set name in hardware profile in openstack driver.
Posted by Ian Main <im...@redhat.com>.
On Fri, Nov 02, 2012 at 12:07:56PM +0200, marios@redhat.com wrote:
> 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.
Believe it or not it's so that humans can tell which one to use.. :) No
need to change deltacloud code as we will pass the ID into deltacloud
API.
> 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?
I think that depends on the configuration of the cloud.. I would think
in 99% of cases it would be unique.
Ian
Re: [PATCH] Set name in hardware profile in openstack driver.
Posted by "marios@redhat.com" <ma...@redhat.com>.
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 <im...@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)
>
Re: [PATCH] Set name in hardware profile in openstack driver.
Posted by Michal Fojtik <mf...@redhat.com>.
On 11/01/2012 07:27 PM, Ian Main wrote:
> Name was not being set which is crucial for heat usage.
Nice catch Ian! ACK.
Do you have ICLA signed[1]? If not, can you please do it, so I can push
this patch. Alternatively, you can fill a JIRA ticket and attach the
patch to the ticket and check 'Accept ICLA..' checkbox :-)
Thanks!
-- Michal
>
> Signed-off-by: Ian Main <im...@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)
>
--
Michal Fojtik <mf...@redhat.com>
Deltacloud API, CloudForms