-
Notifications
You must be signed in to change notification settings - Fork 44
[OEP 3916]: First pass at volume cloning implementation #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: Adam Charnock <[email protected]>
d324f0a to
201b3d3
Compare
| let request = request.into_inner(); | ||
| debug!("create_volume parameters: {:#?}", request); | ||
|
|
||
| let _permit = self.create_volume_permit().await?; | ||
| let name = request.name.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We seem to have removed the permit from here. We shouldn't do that. More over I think we should not change the order of any existing validations, that can change failure behaviour.
| Some(VolumeContentSourceInfo::Volume(source_volume_uuid)) => { | ||
| // Create volume from another volume (clone) | ||
| debug!( | ||
| "Creating volume clone {} from source volume {}", | ||
| uuid, source_volume_uuid | ||
| ); | ||
|
|
||
| // Append the 'fsId' : 'volume id' to the context if change was requested for the | ||
| // clone. | ||
| if volume.spec.content_source.is_some() | ||
| && context.clone_fs_id_as_volume_id().unwrap_or(false) | ||
| { | ||
| volume_context.insert("fsId".to_string(), volume_uuid.clone()); | ||
| // Check if source volume exists | ||
| match RestApiClient::get_client().get_volume(&source_volume_uuid).await { | ||
| Ok(_source_volume) => { | ||
| // Create a temporary snapshot of the source volume | ||
| let temp_snapshot_id = Uuid::new_v4(); | ||
|
|
||
| // Create the temporary snapshot | ||
| let snapshot = match RestApiClient::get_client() | ||
| .create_volume_snapshot(&source_volume_uuid, &temp_snapshot_id) | ||
| .await | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to keep the other code as it is and just change this section in this order:
- Get source volume, if exists --> next step, else bail.
- If exists create a snapshot, if fails --> delete the snapshot and bail.
- If succeeds get the snapshot object, if exists, create restore.
- If fails then delete the snapshot and restore, and bail.
- If succeeds, goes through usual success flow.
Let's hear from @tiagolobocastro and @dsharma-dc
|
Hey @adam-lithus quick nudge, are you still working on this or intend to? |
🚨 Huge disclaimer 🚨