..
 This work is licensed under a Creative Commons Attribution 3.0 Unported
 License.

 http://creativecommons.org/licenses/by/3.0/legalcode

==================================
Image boot server backup with data
==================================

https://storyboard.openstack.org/#!/story/1712059

Problem description
===================

Currently, we only protect the original images when protecting image boot
servers. Original images means that the data that generated by the users after
the servers has been created is not included. So when restore it from the
backup, a new server with same original image will be created, but users' data
was not included. In some of our product environment, we use image boot
instance, fox example using distributed file system or DRBD as the backend.
So IMO, this is not suitable and we should protect the users' data as well.

I suggest adding 'image-create' step before doing image backup and using the
new created image id as the backup image id when the image backup is the child
resource in doing server backup.

Use Cases
=========

As explained, users may use distributed file system or DRBD as their backend
for booting servers.

Proposed change
===============

Image Protectable Plugin:
When return a protectable instance, a new field would be added to extra-info.
This field must be in the format of::

        {
                "server_id": "value1",
        }

This can tell the image protection plugin the id of the parent server and do
special treatment.

Image Protection Plugin:
Add a new configuration named 'enable_server_snapshot' to enable create a
snapshot of the server if the resource contains extra_info and the server_id
in extra_info is valid. Then using the new created image id replace with the
resource id and do the final backup.

Alternatives
------------

Do nothing, this is not a mission critical feature.

Data model impact
-----------------

None.

REST API impact
---------------

None

Security impact
---------------

None

Notifications impact
--------------------

None

Other end user impact
---------------------

None

Performance Impact
------------------

The image protection plugin may become slower because new step added.

Other deployer impact
---------------------

The default configuration value of 'enable_server_snapshot' is True, users can
set it to False to disable this feature.

Developer impact
----------------

None


Implementation
==============

Assignee(s)
-----------
Pengju Jiao (jiaopengju@cmss.chinamobile.com)

Work Items
----------

* Add extra_info in getting instances.
* Update the image protection plugin to support doing snapshot in protection.

Dependencies
============

None


Testing
=======

Unit tests in Karbor.


Documentation Impact
====================

New docs to explain how to use and configure the new added options.


References
==========

None
