Skip to content

Commit

Permalink
Add the ability to rename a VM
Browse files Browse the repository at this point in the history
Adds a vm_rename operation to VmOrTemplate and a supports feature mixin
feature.

https://bugzilla.redhat.com/show_bug.cgi?id=1559184
  • Loading branch information
agrare committed Jul 2, 2018
1 parent e874281 commit ab665cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/mixins/supports_feature_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ module SupportsFeatureMixin
:remove_security_group => 'Remove Security Group',
:remove_snapshot => 'Remove Snapshot',
:remove_snapshot_by_description => 'Remove snapshot having a description',
:rename => 'Rename a VM',
:reset => 'Reset',
:resize => 'Resizing',
:retire => 'Retirement',
Expand Down
11 changes: 11 additions & 0 deletions app/models/vm_or_template/operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ def vm_destroy
check_policy_prevent(:request_vm_destroy, :raw_destroy)
end

def raw_rename(new_name)
unless ext_management_system
raise _("VM has no Provider, unable to renamey VM")
end
run_command_via_parent(:vm_rename, :new_name => new_name)
end

def rename(new_name)
raw_rename(new_name)
end

private

#
Expand Down

0 comments on commit ab665cd

Please sign in to comment.