Added remote_copy_manager.rb file - #5
Conversation
| end | ||
|
|
||
| def get_remote_copy_info() | ||
| response, body = @http.get('/remotecopy') |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Move schedule client methods to new file. Also, move check_reponse() in the new file.
No description provided.