-
Notifications
You must be signed in to change notification settings - Fork 897
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
Volume backup restore, delete. #15891
Merged
agrare
merged 2 commits into
ManageIQ:master
from
alexander-demicev:cloud-volume-backup
Aug 29, 2017
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,61 @@ | ||
class CloudVolumeBackup < ApplicationRecord | ||
include NewWithTypeStiMixin | ||
include ProviderObjectMixin | ||
include SupportsFeatureMixin | ||
include CloudTenancyMixin | ||
|
||
acts_as_miq_taggable | ||
|
||
belongs_to :ext_management_system, :foreign_key => :ems_id, :class_name => "ExtManagementSystem" | ||
belongs_to :availability_zone | ||
belongs_to :cloud_volume | ||
has_one :cloud_tenant, :through => :cloud_volume | ||
|
||
def restore_queue(userid, volumeid) | ||
task_opts = { | ||
:action => "Restoring Cloud Volume Backup for user #{userid}", | ||
:userid => userid | ||
} | ||
queue_opts = { | ||
:class_name => self.class.name, | ||
:method_name => 'restore', | ||
:instance_id => id, | ||
:role => 'ems_operations', | ||
:zone => ext_management_system.my_zone, | ||
:args => [volumeid] | ||
} | ||
MiqTask.generic_action_with_callback(task_opts, queue_opts) | ||
end | ||
|
||
def restore(volume) | ||
raw_restore(volume) | ||
end | ||
|
||
def raw_restore(*) | ||
raise NotImplementedError, _("raw_restore must be implemented in a subclass") | ||
end | ||
|
||
def delete_queue(userid) | ||
task_opts = { | ||
:action => "deleting Cloud Volume Backup for user #{userid}", | ||
:userid => userid | ||
} | ||
queue_opts = { | ||
:class_name => self.class.name, | ||
:method_name => 'delete', | ||
:instance_id => id, | ||
:role => 'ems_operations', | ||
:zone => ext_management_system.my_zone, | ||
:args => [] | ||
} | ||
MiqTask.generic_action_with_callback(task_opts, queue_opts) | ||
end | ||
|
||
def delete | ||
raw_delete | ||
end | ||
|
||
def raw_delete | ||
raise NotImplementedError, _("raw_delete must be implemented in a subclass") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How about
cloud_volume_backup_restore
?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.
@agrare identifiers should be unique and
cloud_volume_backup_restore
is already thereThere 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.
Ah okay 👍
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.
Hm is that feature used anywhere? It sounds like exactly what this does just defined on
CloudVolume
but I don't see any restore methods onCloudVolume
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.
@agrare if you mean
cloud_volume_backup_restore_to_volume
, then it`s used here ManageIQ/manageiq-ui-classic#2037There 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.
Probably, I need a better name for this feature.
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.
@alexander-demichev actually I was wondering if
cloud_volume_backup_restore
could be removed fromCloudVolume
and moved here?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.
@agrare It`s used here
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.
Alright maybe we can refactor this later to use this instead?