Jump to: navigation, search

Difference between revisions of "Glance-image-recover"

(References)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{OldDesignPage}}
 +
 
== Overview ==
 
== Overview ==
 
This proposal aims to recover an image which is in 'pending-delete' state so as to provide the revert capability for the purposes of allowing emergency operational action to recover from an accidental delete
 
This proposal aims to recover an image which is in 'pending-delete' state so as to provide the revert capability for the purposes of allowing emergency operational action to recover from an accidental delete
Line 10: Line 12:
  
 
== Design Details ==
 
== Design Details ==
Now in my PoC, I'm using 'PUT' as the REST API method. But TBO, I'm not sure if 'PUT' is a good condidate for image recover. Since PUT need to support **Idempotent**.  
+
===REST API===
 +
Now in my PoC, I'm using 'PUT' as the REST API method. But TBO, I'm not sure if 'PUT' is a good condidate for image recover, given 'PUT' need to support **Idempotent**.  
 
<pre>
 
<pre>
 
HTTP Request - PUT /v2/images/12345678-1234-1234-1234-123456789abc
 
HTTP Request - PUT /v2/images/12345678-1234-1234-1234-123456789abc
Line 40: Line 43:
 
</pre>
 
</pre>
  
== Known code impact ==
+
===CLI (Glance client)===
 +
A new sub command 'image-recover' will be added to Glance python client. Then user can recover an 'pending_delete' image by issuing below command:
 +
<pre>
 +
glance image-recover b55b5e54-b7d8-4629-847f-6f180313db88
 +
</pre>
 +
 
 +
== Precondition ==
 
1. List pending-delete image <br/>
 
1. List pending-delete image <br/>
2. Only the image which in 'active' status can be recovered to 'pending-delete'
+
    Current image-list should be extended to support listing the images which in 'pending_delete' status, so that user can get the iamge id to do image recover.
 +
2. Only the image which in 'active' status can be updated to 'pending_delete'
 +
    After investigated current code, this has been met. See https://review.openstack.org/#/c/53997/ as a reference.
  
 
== References ==
 
== References ==
 
<references />
 
<references />
 
blueprint: https://blueprints.launchpad.net/glance/+spec/image-recover
 
blueprint: https://blueprints.launchpad.net/glance/+spec/image-recover

Latest revision as of 20:25, 17 December 2014

Warning.svg Old Design Page

This page was used to help design a feature for a previous release of OpenStack. It may or may not have been implemented. As a result, this page is unlikely to be updated and could contain outdated information. It was last updated on 2014-12-17

Overview

This proposal aims to recover an image which is in 'pending-delete' state so as to provide the revert capability for the purposes of allowing emergency operational action to recover from an accidental delete

General Workflow

  1. The 'delayed_delete' config entry is enabled in glance-api.conf
  2. Delete the specific image
  3. List the images which are 'pending-delete'
  4. User PUT /v2/images/{image-uuid} on the requested image to recover it
  5. Eventually, the requested image should be in 'active' state after recovering successfully.

Design Details

REST API

Now in my PoC, I'm using 'PUT' as the REST API method. But TBO, I'm not sure if 'PUT' is a good condidate for image recover, given 'PUT' need to support **Idempotent**.

HTTP Request - PUT /v2/images/12345678-1234-1234-1234-123456789abc
Response: 200 OK
{
    "status":"active",
    "name":"cirros-0.3.1-x86_64-uec",
    "tags":[
    ],
    "kernel_id":"be50418b-a03c-4947-9122-b80a57f47ac4",
    "container_format":"ami",
    "created_at":"2013-11-19T08:42:14Z",
    "ramdisk_id":"e1256074-9f7b-4067-8356-4a5759c1db11",
    "disk_format":"ami",
    "updated_at":"2013-11-19T08:42:16Z",
    "visibility":"public",
    "self":"/v2/images/26c16e07-24ca-4abc-a523-bec068012363",
    "protected":false,
    "id":"26c16e07-24ca-4abc-a523-bec068012363",
    "file":"/v2/images/26c16e07-24ca-4abc-a523-bec068012363/file",
    "checksum":"f8a2eeee2dc65b3d9b6e63678955bd83",
    "min_disk":0,
    "size":25165824,
    "min_ram":0,
    "schema":"/v2/schemas/image"
}

CLI (Glance client)

A new sub command 'image-recover' will be added to Glance python client. Then user can recover an 'pending_delete' image by issuing below command:

glance image-recover b55b5e54-b7d8-4629-847f-6f180313db88

Precondition

1. List pending-delete image

   Current image-list should be extended to support listing the images which in 'pending_delete' status, so that user can get the iamge id to do image recover.

2. Only the image which in 'active' status can be updated to 'pending_delete'

   After investigated current code, this has been met. See https://review.openstack.org/#/c/53997/ as a reference.

References

blueprint: https://blueprints.launchpad.net/glance/+spec/image-recover