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

Enhanced support for associating NICs with Load Balancers #1101

Merged
merged 10 commits into from
Sep 26, 2016
Merged

Enhanced support for associating NICs with Load Balancers #1101

merged 10 commits into from
Sep 26, 2016

Conversation

martinsawicki
Copy link

@martinsawicki martinsawicki commented Sep 23, 2016

Backend: simple usage to associate an existing NIC (primary IP config) with an existing LB backend:

nic.update()  
    .withExistingLoadBalancerBackend(lb, "backend1")  
    .apply();

same idea for NIC definition.

NAT rule:

nic.update()
    .withExistingLoadBalancerInboundNatRule(lb,  "natrule1")
    .apply();

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

@azuresdkci
Copy link
Contributor

Runtime changes detected. pull request created. CI running: Build Status

@azuresdkci
Copy link
Contributor

Runtime changes detected. pull request created. CI running: Build Status

@azuresdkci
Copy link
Contributor

Runtime changes detected. pull request created. CI running: Build Status

}
}

return null;
Copy link
Member

@anuchandy anuchandy Sep 24, 2016

Choose a reason for hiding this comment

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

We should return this here right? otherwise null ptr exception while running the next stage wither?

same with withExistingLoadBalancerInboundNatRule as well.

Copy link
Author

Choose a reason for hiding this comment

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

null is returned because the user cannot proceed here - the user is pointing at a Backend that does not exist, so the logic should fail fast here.

Copy link
Author

Choose a reason for hiding this comment

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

...so to make their error checking robust, the user code should fist ensure that the backend exists:

if (!lb.backends().contains(backendName)) {
    // Missing backend
} else {
    // Call the code in question
}

Copy link
Member

Choose a reason for hiding this comment

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

ah ok. I do have similar situation in VMSS, there i just throw ArgumentException with a message so that user knows whats wrong, returning null seems fine.

Copy link
Author

Choose a reason for hiding this comment

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

the reason I figured returning null would be ok in scenarios involving the passing of a child's name as an argument is because it seems equivalent to trying to access LoadBalancer.backends().get(backendName) and similar child access scenarios, where children are returned as a Map. The Map doesn't throw in the case of a bad name.

@azuresdkci
Copy link
Contributor

Runtime changes detected. pull request created. CI running: Build Status

@martinsawicki martinsawicki merged commit 56bba66 into Azure:master Sep 26, 2016
jianghaolu pushed a commit to jianghaolu/azure-sdk-for-java that referenced this pull request Feb 27, 2017
remerging - for some reason it's still showing up as open...
jianghaolu pushed a commit to jianghaolu/azure-sdk-for-java that referenced this pull request Feb 27, 2017
remerging - for some reason it's still showing up as open...
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.

4 participants