[openstack-dev] [Heat] Use block_device_mapping_v2 for swap?

Rabi Mishra ramishra at redhat.com
Wed Sep 2 06:40:18 UTC 2015



Rabi Mishra
+91-7757924167

----- Original Message -----
> On 31/08/15 11:19, TIANTIAN wrote:
> > 
> > 
> > At 2015-08-28 21:48:11, "marios" <marios at redhat.com> wrote:
> >> I am working with the OS::Nova::Server resource and looking at the tests
> >> [1], it should be possible to just define 'swap_size' and get a swap
> >> space created on the instance:
> >>
> >>  NovaCompute:
> >>    type: OS::Nova::Server
> >>    properties:
> >>      image:
> >>        {get_param: Image}
> >>      ...
> >>      block_device_mapping_v2:
> >>        - swap_size: 1
> >>
> >> When trying this the first thing I hit is a validation code nit that is
> >> already fixed @ [2] (I have slightly older heat) and I applied that fix.
> >> However, when I try and deploy with a Flavor that has a 2MB swap for
> >> example, and with the above template, I still end up with a 2MB swap.
> >>
> >> Am I right in my assumption that the above template is the equivalent of
> >> specifying --swap on the nova boot cli (i.e. should this work?)? I am
> >> working with the Ironic nova driver btw and when deploying using the
> >> nova cli using --swap works; has anyone used/tested this property
> >> recently? I'm not yet sure if this is worth filing a bug for yet.
> > 
> >>
> > ------According to the codes of heat and novaclient, the above template is
> > the equivalent of
> >        specifying --swap on the nova boot cli:
> > https://github.com/openstack/python-novaclient/blob/master/novaclient/v2/shell.py#L142-L146
> > https://github.com/openstack/heat/blob/master/heat/engine/resources/openstack/nova/server.py#L822-L831
> > 
> > 
> > But don't know much about nova, and not sure how does nova behave if
> > specified different swap size on Flavor
> > 
> > 
> > and Bdm.
> 
> Hey TianTian, thanks very much for the pointers and sanity check. Yeah I
> think it is intended to work that way (e.g. the tests on the heatclient
> also cover this as per my original), I was mostly looking for 'yeah did
> this recently worked ok for me'.

Hi Marios,

This seems to work fine with master and I do see swap created with size of the
'swap_size' specified in the template. 

[fedora at test-stack-novacompute-nwownbcokzra ~]$ swapon -s
Filename				Type		Size	Used	Priority
/dev/vdb                               	partition	524284	0	-1


Though I did face a novaclient issue with python-novaclient==2.26.0.

The above issue has been resolved by the below commit.
https://github.com/openstack/python-novaclient/commit/0a8fffffbaa48083ba2e79abf67096efa59fa18b

When specifying swap_size more than that permitted by the flavor we get
'CREATE_FAILED' with the following error. So I assume it works as expected.


resources.NovaCompute: Swap drive requested is larger                                                                       |
|                       | than instance type allows. (HTTP 400) (Request-ID: req-                                                                     |
|                       | 276150f5-082d-4c00-bb73-645c59e52727)                  


Thanks,
Rabi

> WRT the different swap size on flavor, in this case what is on the
> flavor becomes the effective maximum you can specify (and can override
> with --swap on the nova cli).
> 
> thanks! marios
> 
> > 
> > 
> >> thanks very much for reading! marios > >[1]
> >> >https://github.com/openstack/heat/blob/a1819ff0696635c516d0eb1c59fa4f70cae27d65/heat/tests/nova/test_server.py#L2446
> >> >[2]
> >> >https://review.openstack.org/#/q/I2c538161d88a51022b91b584f16c1439848e7ada,n,z
> >> >
> >> >__________________________________________________________________________
> >> >OpenStack Development Mailing List (not for usage questions)
> >> >Unsubscribe:
> >> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> >> >http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >>
> >>
> >> __________________________________________________________________________
> >> OpenStack Development Mailing List (not for usage questions)
> >> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> >> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 



More information about the OpenStack-dev mailing list