Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ansarars
Copy link

@ansarars ansarars commented Nov 5, 2018

No description provided.

end

def get_remote_copy_info()
response, body = @http.get('/remotecopy')
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 }
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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?

@sneharai4
Copy link
Contributor

Please start working on writing Unit Tests

end
end

def create_schedule(schedule_name, task, taskfreq='@hourly')
Copy link
Contributor

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.

@sneharai4 sneharai4 closed this Dec 7, 2018
@sneharai4 sneharai4 reopened this Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants