Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Change SnapshotStatus enum to a boolean #307

Merged

Conversation

xing-yang
Copy link
Contributor

This PR changes SnapshotStatus enum to a boolean is_ready_to_use
and tries to use "processing" instead of "uploading" if possible
to make it less specific.

fixes #302

Copy link
Contributor

@julian-hj julian-hj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@xing-yang xing-yang force-pushed the snapshot_status branch 2 times, most recently from 8de19ce to 35c9d13 Compare November 8, 2018 17:52
@xing-yang
Copy link
Contributor Author

Thanks @julian-hj .
@saad-ali @jdef Please take a look.

spec.md Outdated
// LIST_SNAPSHOTS is NOT REQUIRED. For plugins that need to
// process a snapshot after it is being cut, LIST_SNAPSHOTS
// COULD be used with the snapshot_id as the filter to query
// whether the processing is complete or not.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For plugins that need to a snapshot after it is being cut, LIST_SNAPSHOTS COULD be used with the snapshot_id as the filter to query whether the processing is complete or not.

^^This is no longer required right? CO should call CreateVolume again to poll the is_ready_to_use to use state.
If so, let's remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
@@ -1405,12 +1405,12 @@ A Controller Plugin MUST implement this RPC call if it has `CREATE_DELETE_SNAPSH
This RPC will be called by the CO to create a new snapshot from a source volume on behalf of a user.

This operation MUST be idempotent.
If a snapshot corresponding to the specified snapshot `name` is already successfully cut and uploaded (if upload is part of the process) and is compatible with the specified `source_volume_id` and `parameters` in the `CreateSnapshotRequest`, the Plugin MUST reply `0 OK` with the corresponding `CreateSnapshotResponse`.
If a snapshot corresponding to the specified snapshot `name` is already successfully cut and processed (i.e., if upload is part of the process) and is compatible with the specified `source_volume_id` and `parameters` in the `CreateSnapshotRequest`, the Plugin MUST reply `0 OK` with the corresponding `CreateSnapshotResponse`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to:

If a snapshot corresponding to the specified snapshot name is successfully cut and ready to use (meaning it may be specified as a volume_content_source in a CreateSnapshotRequest) , the Plugin MUST reply 0 OK with the corresponding CreateSnapshotResponse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated

If an error occurs before a snapshot is cut, `CreateSnapshot` SHOULD return a corresponding gRPC error code that reflects the error condition.

For plugins that implement snapshot uploads, `CreateSnapshot` SHOULD return `10 ABORTED`, a gRPC code that indicates the operation is pending for snapshot, during the snapshot uploading processs.
If an error occurs during the uploading process, `CreateSnapshot` SHOULD return a corresponding gRPC error code that reflects the error condition.
For plugins that supports snapshot post processing such as uploading, `CreateSnapshot` SHOULD return `0 OK` and `is_ready_to_use` SHOULD be set to `false` after the snapshot is cut but still being processed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the following:

CO SHOULD then reissue the same CreateSnapshotRequest periodically until boolean isReadyToUse flips to true indicating the volume has been "processed" and is ready to use to create new Snapshots.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
// Additional information to describe why a snapshot ended up in the
// `ERROR_UPLOADING` status. This field is OPTIONAL.
string details = 2;
// Indicates if a snapshot is ready to use. The default value is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indicates if a snapshot is ready to use. -> Indicates if a snapshot is ready to use as a volume_content_source in a CreateSnapshotRequest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
A controller plugin COULD implement the `LIST_SNAPSHOTS` capability and call it repeatedly with the `snapshot_id` as a filter to query whether the uploading process is complete or not if it needs to upload a snapshot after it is being cut.

##### Snapshot Statuses
A controller plugin COULD implement the `LIST_SNAPSHOTS` capability and call it repeatedly with the `snapshot_id` as a filter to query whether the process is complete or not if it needs to do post processing such as uploading a snapshot after it is being cut.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's drop this line. We should recommend calling CreateSnapshot again instead of List, so they can get an error code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
If the cloud provider or storage system needs to upload the snapshot after the snapshot is cut, the status returned by CreateSnapshot SHALL be `UPLOADING`.
CO MAY continue to call CreateSnapshot while waiting for the upload to complete until the status becomes `READY`.
If the cloud provider or storage system does not need to process the snapshot (i.e., upload the snapshot) after it is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `true`.
If the cloud provider or storage system needs to process the snapshot after the snapshot is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `false`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this line to right after lines 1646-1647

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
CO MAY continue to call CreateSnapshot while waiting for the upload to complete until the status becomes `READY`.
If the cloud provider or storage system does not need to process the snapshot (i.e., upload the snapshot) after it is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `true`.
If the cloud provider or storage system needs to process the snapshot after the snapshot is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `false`.
CO MAY continue to call CreateSnapshot while waiting for the process to complete until `is_ready_to_use` becomes `true`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is very similar to 1654. Delete and combine with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
Note that CreateSnapshot no longer blocks after the snapshot is cut.

Alternatively, ListSnapshots can be called repeatedly with snapshot_id as filtering to wait for the upload to complete.
Alternatively, ListSnapshots can be called repeatedly with snapshot_id as filtering to wait for the process to complete.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not recommend this. Suggest dropping this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
ListSnapshots SHALL return with current information regarding the snapshots on the storage system.
When upload is complete, the status of the snapshot from ListSnapshots SHALL become `READY`.
When the process is complete, the `is_ready_to_use` parameter of the snapshot from ListSnapshots SHALL become `true`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the process is complete -> When processing is complete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated

A snapshot could have the following statusus: UPLOADING, READY, and ERROR.
##### The is_ready_to_use Parameter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this section (everything from line 1635 to 1658) up to the CreateSnapshot section of the doc. It doesn't make sense under ListSnapshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm still seeing this under ListSnapshots? Move everything from here to line 1656

Copy link
Contributor Author

@xing-yang xing-yang Nov 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm moving the entire "##### The is_ready_to_use Parameter" section until line 1656 to the "#### CreateSnapshot" section. I believed that is what you meant? This current section is called "##### CreateSnapshot, DeleteSnapshot, ListSnapshots". So I am a little confused when you said "under ListSnapshot".

Copy link
Contributor Author

@xing-yang xing-yang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed review comments. Thanks.

spec.md Outdated
// LIST_SNAPSHOTS is NOT REQUIRED. For plugins that need to
// process a snapshot after it is being cut, LIST_SNAPSHOTS
// COULD be used with the snapshot_id as the filter to query
// whether the processing is complete or not.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
@@ -1405,12 +1405,12 @@ A Controller Plugin MUST implement this RPC call if it has `CREATE_DELETE_SNAPSH
This RPC will be called by the CO to create a new snapshot from a source volume on behalf of a user.

This operation MUST be idempotent.
If a snapshot corresponding to the specified snapshot `name` is already successfully cut and uploaded (if upload is part of the process) and is compatible with the specified `source_volume_id` and `parameters` in the `CreateSnapshotRequest`, the Plugin MUST reply `0 OK` with the corresponding `CreateSnapshotResponse`.
If a snapshot corresponding to the specified snapshot `name` is already successfully cut and processed (i.e., if upload is part of the process) and is compatible with the specified `source_volume_id` and `parameters` in the `CreateSnapshotRequest`, the Plugin MUST reply `0 OK` with the corresponding `CreateSnapshotResponse`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated

If an error occurs before a snapshot is cut, `CreateSnapshot` SHOULD return a corresponding gRPC error code that reflects the error condition.

For plugins that implement snapshot uploads, `CreateSnapshot` SHOULD return `10 ABORTED`, a gRPC code that indicates the operation is pending for snapshot, during the snapshot uploading processs.
If an error occurs during the uploading process, `CreateSnapshot` SHOULD return a corresponding gRPC error code that reflects the error condition.
For plugins that supports snapshot post processing such as uploading, `CreateSnapshot` SHOULD return `0 OK` and `is_ready_to_use` SHOULD be set to `false` after the snapshot is cut but still being processed.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
// Additional information to describe why a snapshot ended up in the
// `ERROR_UPLOADING` status. This field is OPTIONAL.
string details = 2;
// Indicates if a snapshot is ready to use. The default value is
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
A controller plugin COULD implement the `LIST_SNAPSHOTS` capability and call it repeatedly with the `snapshot_id` as a filter to query whether the uploading process is complete or not if it needs to upload a snapshot after it is being cut.

##### Snapshot Statuses
A controller plugin COULD implement the `LIST_SNAPSHOTS` capability and call it repeatedly with the `snapshot_id` as a filter to query whether the process is complete or not if it needs to do post processing such as uploading a snapshot after it is being cut.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
If the cloud provider or storage system does not need to upload the snapshot after it is cut, the status returned by CreateSnapshot SHALL be `READY`.
If the cloud provider or storage system needs to upload the snapshot after the snapshot is cut, the status returned by CreateSnapshot SHALL be `UPLOADING`.
CO MAY continue to call CreateSnapshot while waiting for the upload to complete until the status becomes `READY`.
If the cloud provider or storage system does not need to process the snapshot (i.e., upload the snapshot) after it is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `true`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
If the cloud provider or storage system needs to upload the snapshot after the snapshot is cut, the status returned by CreateSnapshot SHALL be `UPLOADING`.
CO MAY continue to call CreateSnapshot while waiting for the upload to complete until the status becomes `READY`.
If the cloud provider or storage system does not need to process the snapshot (i.e., upload the snapshot) after it is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `true`.
If the cloud provider or storage system needs to process the snapshot after the snapshot is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `false`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
CO MAY continue to call CreateSnapshot while waiting for the upload to complete until the status becomes `READY`.
If the cloud provider or storage system does not need to process the snapshot (i.e., upload the snapshot) after it is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `true`.
If the cloud provider or storage system needs to process the snapshot after the snapshot is cut, the `is_ready_to_use` parameter returned by CreateSnapshot SHALL be `false`.
CO MAY continue to call CreateSnapshot while waiting for the process to complete until `is_ready_to_use` becomes `true`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
Note that CreateSnapshot no longer blocks after the snapshot is cut.

Alternatively, ListSnapshots can be called repeatedly with snapshot_id as filtering to wait for the upload to complete.
Alternatively, ListSnapshots can be called repeatedly with snapshot_id as filtering to wait for the process to complete.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
ListSnapshots SHALL return with current information regarding the snapshots on the storage system.
When upload is complete, the status of the snapshot from ListSnapshots SHALL become `READY`.
When the process is complete, the `is_ready_to_use` parameter of the snapshot from ListSnapshots SHALL become `true`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated

A snapshot could have the following statusus: UPLOADING, READY, and ERROR.
##### The is_ready_to_use Parameter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm still seeing this under ListSnapshots? Move everything from here to line 1656

spec.md Outdated
Some cloud providers will upload the snapshot to a location in the cloud (i.e., an object store) after the snapshot is cut.
Uploading may be a long process that could take hours.
If a `freeze` operation was done on the application before taking the snapshot, it could be a long time before the application can be running again if we wait until the upload is complete to `thaw` the application.
Some cloud providers will process the snapshot after the snapshot is cut, i.e., uploading the snapshot to a location in the cloud (i.e., an object store) after the snapshot is cut.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some cloud providers will process... -> Some SPs MAY "process"...
...cut, i.e., uploading... -> ...cut, for example, maybe uploading...
...to a location in the cloud (i.e., an object store) after the snapshot is cut. -> ...somewhere after the snapshot is cut.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
Uploading may be a long process that could take hours.
If a `freeze` operation was done on the application before taking the snapshot, it could be a long time before the application can be running again if we wait until the upload is complete to `thaw` the application.
Some cloud providers will process the snapshot after the snapshot is cut, i.e., uploading the snapshot to a location in the cloud (i.e., an object store) after the snapshot is cut.
A process such as uploading may be a long process that could take hours.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A process such as uploading may... -> The post-cut process may...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
If a `freeze` operation was done on the application before taking the snapshot, it could be a long time before the application can be running again if we wait until the upload is complete to `thaw` the application.
Some cloud providers will process the snapshot after the snapshot is cut, i.e., uploading the snapshot to a location in the cloud (i.e., an object store) after the snapshot is cut.
A process such as uploading may be a long process that could take hours.
If a `freeze` operation was done on the application before taking the snapshot, it could be a long time before the application can be running again if we wait until the process is complete to `thaw` the application.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this line to:

The CO may freeze the application using the source volume before taking the snapshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated

For cloud providers and storage systems that don't have the uploading process, the status should be `READY` after the snapshot is cut.
`thaw` can be done when the status is `READY` in this case.
For cloud providers and storage systems that don't have the process, the `is_ready_to_use` parameter should be `true` after the snapshot is cut.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find and replace all instances of
should -> SHOULD
may -> MAY
must -> MUST

At least the bits you are touching in this PR. I will open a PR addressing the rest of the spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated

The SnapshotStatus parameter provides guidance to the CO on what action can be taken in the process of snapshotting.
The `is_ready_to_use` parameter provides guidance to the CO on what action can be taken in the process of snapshotting.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this before line 1647.
Change on what action can be taken -> on when it can "thaw" the application

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@j-griffith j-griffith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

But I'm coming in late on this discussion so I may have missed a detail in there

Copy link
Member

@saad-ali saad-ali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry one last (promise no more) set of changes.

csi.proto Outdated
// a snapshot after it is being cut, LIST_SNAPSHOTS COULD be used
// with the snapshot_id as the filter to query whether the
// uploading process is complete or not.
// LIST_SNAPSHOTS is NOT REQUIRED.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this comment at all now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

csi.proto Outdated
// Indicates if a snapshot is ready to use as a
// `volume_content_source` in a `CreateVolumeRequest`. The default
// value is false. This field is REQUIRED.
bool is_ready_to_use = 5;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to ready_to_use

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

spec.md Outdated
During the snapshot processing phase, since the snapshot is already cut, a `thaw` operation can be performed so application can start running without waiting for the process to complete.
The `is_ready_to_use` parameter of the snapshot will become `true` after the process is complete.

For cloud providers and storage systems that don't have the process, the `is_ready_to_use` parameter SHOULD be `true` after the snapshot is cut.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to:

For SPs that do not do additional processing after cut, the is_ready_to_use parameter SHOULD be true after the snapshot is cut.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@xing-yang xing-yang force-pushed the snapshot_status branch 3 times, most recently from 7a51cbf to 0d1fd2a Compare November 9, 2018 03:55
Copy link
Member

@saad-ali saad-ali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

This PR changes SnapshotStatus enum to a boolean is_ready_to_use
and tries to use "processing" instead of "uploading" if possible
to make it less specific.
@saad-ali saad-ali merged commit 5d436c6 into container-storage-interface:master Nov 9, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider replacing SnapshotStatus enum with booleans
5 participants