Skip to content

Add snapshot rename action for VM and Instance snapshots - #1343

Merged
agrare merged 5 commits into
ManageIQ:masterfrom
prashantsrivastava6:1418_snapshot_update_and_rename
Oct 3, 2026
Merged

agrare merged 5 commits into
ManageIQ:masterfrom
prashantsrivastava6:1418_snapshot_update_and_rename

Conversation

@prashantsrivastava6

@prashantsrivastava6 prashantsrivastava6 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR adds support for renaming snapshots via the REST API for Virtual Machines and Instances.

Changes

config/api.yml

  • Registers rename_snapshot under snapshot subcollection actions for both VMs and Instances
  • Uses the dedicated vm_snapshot_rename product feature for VMs
  • Uses cloud_volume_snapshot_control for Instances

app/controllers/api/subcollections/snapshots.rb

  • Adds snapshots_rename_snapshot_resource
  • Validates the required name parameter
  • Checks parent.supports?(:rename_snapshot) before queuing
  • Queues the rename task through the ems_operations role

spec/requests/snapshots_spec.rb

  • Adds request specs for VM and Instance snapshot rename
  • Verifies successful task queuing
  • Validates missing name handling
  • Verifies authorization behavior

Related PRs / Issues

@miq-bot add-label enhancement

@miq-bot

miq-bot commented Sep 27, 2026

Copy link
Copy Markdown
Member

@prashantsrivastava6 Cannot apply the following label because they are not recognized:

  • api

All labels for ManageIQ/manageiq-api: https://github.com/ManageIQ/manageiq-api/labels

@agrare agrare self-assigned this Sep 28, 2026
Comment thread config/api.yml Resolved
@agrare

agrare commented Oct 1, 2026

Copy link
Copy Markdown
Member

@prashantsrivastava6 I don't know what 1418 is but can you update the PR description so that it is more helpful/readable?

@agrare

agrare commented Oct 1, 2026

Copy link
Copy Markdown
Member

@miq-bot cross-repo-tests ManageIQ/manageiq#23986

@prashantsrivastava6 prashantsrivastava6 changed the title 1418 snapshot update and rename Add snapshot rename action for VM and Instance snapshots Oct 2, 2026
@prashantsrivastava6

prashantsrivastava6 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

@prashantsrivastava6 I don't know what 1418 is but can you update the PR description so that it is more helpful/readable?

@agrare I've updated the title and description to better describe the purpose of the PR.

@agrare agrare closed this Oct 2, 2026
@agrare agrare reopened this Oct 2, 2026
@agrare

agrare commented Oct 2, 2026

Copy link
Copy Markdown
Member

Core PR merged, FYI this failed on cross-repo https://github.com/ManageIQ/manageiq-cross_repo-tests/actions/runs/37003078981/job/110825009111?pr=1083 so it will likely fail the same way here

@prashantsrivastava6
prashantsrivastava6 force-pushed the 1418_snapshot_update_and_rename branch from a1c0f41 to 40456b5 Compare October 2, 2026 21:03
Comment thread spec/requests/snapshots_spec.rb Outdated
vm = FactoryBot.create(:vm_vmware, :name => "Alice's VM", :host => host, :ext_management_system => ems)
snapshot = FactoryBot.create(:snapshot, :name => "Alice's snapshot", :vm_or_template => vm)

allow(vm).to receive(:supports?).with(:rename_snapshot).and_return(true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have stub_supports for this, look around in these specs there are lots of examples

@prashantsrivastava6
prashantsrivastava6 force-pushed the 1418_snapshot_update_and_rename branch from 40456b5 to cebefd9 Compare October 2, 2026 21:45
@prashantsrivastava6
prashantsrivastava6 force-pushed the 1418_snapshot_update_and_rename branch from cebefd9 to 045ac3a Compare October 3, 2026 16:22
@miq-bot

miq-bot commented Oct 3, 2026

Copy link
Copy Markdown
Member

Checked commits prashantsrivastava6/manageiq-api@15e3cc1~...045ac3a with ruby 3.3.12, rubocop 1.91.0, haml-lint 0.78.0, and yamllint 1.37.1
2 files checked, 0 offenses detected
Everything looks fine. 👍

@agrare
agrare merged commit 2ff872d into ManageIQ:master Oct 3, 2026
2 checks passed
@agrare

agrare commented Oct 3, 2026

Copy link
Copy Markdown
Member

@prashantsrivastava6 you have to update the API documentation as well, https://github.com/ManageIQ/manageiq-documentation/tree/master/api/reference

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants