Skip to content

Conversation

@adam-lithus
Copy link

🚨 Huge disclaimer 🚨

  • I'm not a rust developer
  • This was coded with Claude 3.7 Thinking
  • I was careful with prompting, but it could still be a bunch of nonsense
  • My main goal is to do the leg-work for someone who actually knows what they are doing (@tiagolobocastro )
  • If this isn't useful then that is totally fine

@adam-lithus adam-lithus requested a review from a team as a code owner April 30, 2025 14:51
Comment on lines +309 to +312
let request = request.into_inner();
debug!("create_volume parameters: {:#?}", request);

let _permit = self.create_volume_permit().await?;
let name = request.name.clone();
Copy link
Member

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.

Comment on lines +621 to +638
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
{
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 suggest to keep the other code as it is and just change this section in this order:

  1. Get source volume, if exists --> next step, else bail.
  2. If exists create a snapshot, if fails --> delete the snapshot and bail.
  3. If succeeds get the snapshot object, if exists, create restore.
  4. If fails then delete the snapshot and restore, and bail.
  5. If succeeds, goes through usual success flow.

Let's hear from @tiagolobocastro and @dsharma-dc

@Abhinandan-Purkait
Copy link
Member

Hey @adam-lithus quick nudge, are you still working on this or intend to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants