Skip to content

Add methods ex_add/ex_delete port_forwarding_rule to CloudstackNode (similar to ip_forwarding_rule) - #196

Closed
gigimon wants to merge 1 commit into
apache:trunkfrom
gigimon:fix-delete-portforwarding
Closed

Add methods ex_add/ex_delete port_forwarding_rule to CloudstackNode (similar to ip_forwarding_rule)#196
gigimon wants to merge 1 commit into
apache:trunkfrom
gigimon:fix-delete-portforwarding

Conversation

@gigimon

@gigimon gigimon commented Dec 16, 2013

Copy link
Copy Markdown
Contributor

Hi!

I have added port forwarding method to CloudstackNode object because class CloudstackPortForwardingRule has a method delete which doesn't work. And change call signature because node object was not in first place

And want ask about naming of port forwarding methods. We have ex_add_ip_forwarding_rule and ex_create_port_forwarding_rule maybe rename one of this?

@sebgoa

sebgoa commented Dec 16, 2013

Copy link
Copy Markdown
Member

I am not sure what you mean by 'has a method delete which doesn't work' ? what exactly does not work ? you did not seem to modify that method.

Also what do you mean by "change call signature...'

Ok to rename ex_add_ip_forwarding_rule to ex_create_ip_frowarding_rule, but we will have to keep track of the fact this will break backward compatibility.

@gigimon

gigimon commented Dec 16, 2013

Copy link
Copy Markdown
Contributor Author

ex_create_port_forwarding_rule was:

def ex_create_port_forwarding_rule(self, address, private_port,
                                       public_port, protocol, node,
                                       public_end_port=None,
                                       private_end_port=None,
                                       openfirewall=True):

Now it:

def ex_create_port_forwarding_rule(self, node, address,
                                       private_port, public_port,
                                       protocol,
                                       public_end_port=None,
                                       private_end_port=None,
                                       openfirewall=True):

Because in all methods argument 'node' in first place.

About method delete:
Class CloudStackPortForwardingRule has method delete, it call self.node.ex_delete_port_forwarding_rule(self), but CloudstackNode doesn't has a method ex_delete_port_forwarding_rule - I fix this.

Ok, I'm rename method and fix test.

Sorry for bad english :(

@Kami

Kami commented Dec 16, 2013

Copy link
Copy Markdown
Member

@gigimon Can you please also add tests which cover those newly added methods?

@gigimon

gigimon commented Dec 17, 2013

Copy link
Copy Markdown
Contributor Author

@Kami ok, later today I add tests

@gigimon

gigimon commented Dec 17, 2013

Copy link
Copy Markdown
Contributor Author

@Kami I've added tests, please check, if all good I create one commit with all changess

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just went over the pull request again and I'm kinda confused now.

Why did you rename methods from add to create (ex_add_ip_forwarding_rule -> ex_create_ip_forwarding_rule)? Is it for consistency reasons or is it something else?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's for consistency reason. In pull request @Runseb say me rename to create

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, sounds good. Need to note this in the changelog though since it's a backward incompatible change.

@Kami

Kami commented Dec 18, 2013

Copy link
Copy Markdown
Member

(I also plan open a corresponding JIRA ticket so it will be easier to track this issue)

@Runseb While reviewing this pull request I noticed a couple of unrelated issues in the driver.

ex_allocate_public_ip and ex_release_public_ip method on the CloudStackNode class seems to be broken.

Both of those methods call methods on the driver class with invalid arguments. They pass node object to the driver method, but the driver method doesn't take a node object.

See:

We have two options:

  1. Fix those methods to actually do what the docstring says - allocate the IP and bind it to the node
  2. Remove those methods from the CloudStackNode class since in the current form, they don't belong there.

We also need better test coverage to detect issues like this automatically in the future.

Edit: I've opened a JIRA issue for it - https://issues.apache.org/jira/browse/LIBCLOUD-462. We can move this off topic debate there.

@Kami

Kami commented Dec 18, 2013

Copy link
Copy Markdown
Member

@gigimon Rebased the commits and merged those changes into trunk. This PR can be closed now.

Thanks.

…Node object (similar to ip_forwarding_rule)

* rename ex_add_ip_forwarding_rule to ex_create_ip_forwarding_rule
* add tests for CloudStackNode.ex_create/ex_delete_port_forwarding_rule
@gigimon

gigimon commented Dec 18, 2013

Copy link
Copy Markdown
Contributor Author

@Kami done

@gigimon gigimon closed this Dec 18, 2013
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.

3 participants