[openstack-dev] Discuss the option delete_on_termination

黎林果 lilinguo8212 at gmail.com
Thu Jan 9 06:35:45 UTC 2014

Hi Chris,
Thanks for you reply.

It's not only hard coded for swap volumes. In function
'_create_instance' which for creating instance of nova/compute/api.py,
the '_prepare_image_mapping' function will be called. And it hard code
to True, too.

values = block_device.BlockDeviceDict({
                'device_name': bdm['device'],
                'source_type': 'blank',
                'destination_type': 'local',
                'device_type': 'disk',
                'guest_format': guest_format,
                'delete_on_termination': True,
                'boot_index': -1})

I found it set to true when creating a new instance and set to false
for an exist instance.


2014/1/9 Christopher Yeoh <cbkyeoh at gmail.com>:
> On Thu, Jan 9, 2014 at 9:25 AM, 黎林果 <lilinguo8212 at gmail.com> wrote:
>> Hi All,
>>    Attach a volume when creating a server, the API contains
>> 'block_device_mapping', such as:
>> "block_device_mapping": [
>>             {
>>                 "volume_id": "<VOLUME_ID>",
>>                 "device_name": "/dev/vdc",
>>                 "delete_on_termination": "true"
>>             }
>> ]
>> It allows the option 'delete_on_termination', but in the code it's
>> hardcoded to True. Why?
> I don't think it does hardcode it to true. The API appears to be passing it
> down
> correctly. I can see one case of delete_on_termination being set to true,
> though thats
> for ephemeral or swap volumes.
>>     Another situation, attach a volume to an exists server, there is
>> not the option 'delete_on_termination'.
>>   Should we add the 'delete_on_termination' when attach a volume to an
>> exists server or modify the value from the params?
> I think adding delete_on_termination option when attaching a volume to an
> existing server
> is reasonable. Perhaps add it to the v3 API?
> Regards,
> Chris
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

More information about the OpenStack-dev mailing list