-
Notifications
You must be signed in to change notification settings - Fork 7
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
Added remote_copy_manager.rb file #5
base: master
Are you sure you want to change the base?
Conversation
end | ||
|
||
def get_remote_copy_info() | ||
response, body = @http.get('/remotecopy') |
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.
Add the endpoint urls in the initialize method for 'remotecopy' and 'remotecopygroups'
And change it to response, body = @http.get(@host_uri) and similarly make changes everywhere else for remotecopy and remotecopygroup
class RemoteCopyManager | ||
def initialize(http, ssh) | ||
@http = http | ||
@ssh = ssh |
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.
Add here
@remotecopy_uri = '/remotecopy'
@remotecopygroup_uri = '/remotecopygroups'
end | ||
|
||
def remove_remote_copy_group(name, keep_snap = false) | ||
if keep_snap |
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.
This check is not needed, you can directly pass the keep_snap in the query.
@http.delete('/remotecopygroups/#{name}?keepSnap=#{keep_snap}'
end | ||
|
||
def rcopy_link_exists(targetName, local_port, target_system_peer_port) | ||
rcopylink_exits = false |
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.
rename it to rcopylink_exists
begin | ||
response = get_remote_copy_link(link_name) | ||
if response and response['address'] == target_system_peer_port | ||
rcopylink_exits = true |
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.
rename it to rcopylink_exists
end | ||
|
||
def recover_remote_copy_group(name, action, optional = nil) | ||
info = { 'action' => action } |
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.
Add the action value to the constants and remove it from the method definition.
info = { 'action' => 5 } | ||
info = Util.merge_hash(info, optional) if optional | ||
volumes_url = '/remotecopygroups/#{name}' | ||
@http.put(volumes_url, body: info) |
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.
Add the volumes_url to the this line, no need to create a variable.
info = { 'action' => action } | ||
info = Util.merge_hash(info, optional) if optional | ||
volumes_url = '/remotecopygroups/#{name}' | ||
response, body = @http.put(volumes_url, body: info) |
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.
Add the volumes_url to the this line, no need to create a variable.
return true | ||
end | ||
end | ||
rescue Hpe3parSdk::HPE3PARException => ex |
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.
Are we not doing anything in the exception?
contents = self.get_remote_copy_group(remote_copy_group_name) | ||
for item in contents['targets'] | ||
if item['target'] == target_name | ||
return true |
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.
Are we returning true for all items? or we need to do it once all the items are iterated?
Please start working on writing Unit Tests |
end | ||
end | ||
|
||
def create_schedule(schedule_name, task, taskfreq='@hourly') |
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.
Move schedule client methods to new file. Also, move check_reponse() in the new file.
No description provided.