-
Notifications
You must be signed in to change notification settings - Fork 1.3k
server: throw exception if fail to cleanup IP resources when release a public IP #9059
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -732,8 +732,9 @@ public boolean disassociatePublicIpAddress(long addrId, long userId, Account cal | |
| PublicIpQuarantine publicIpQuarantine = null; | ||
| // Cleanup all ip address resources - PF/LB/Static nat rules | ||
| if (!cleanupIpResources(addrId, userId, caller)) { | ||
| success = false; | ||
| s_logger.warn("Failed to release resources for ip address id=" + addrId); | ||
| String msg = String.format("Failed to release resources for ip address id=%s", addrId); | ||
| s_logger.error(msg); | ||
| throw new CloudRuntimeException(msg); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this block any other subsequent calls, & changes behavior?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it does, but I think the process should be stopped here if the error happens.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is very much unreadible code:
I agree that some action other than marking for releasing should follow a failure to clean up. Let's investigate the callers and see what can be done.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @weizhouapache should these be addressed here, or later in separate PR?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sureshanaparti @DaanHoogland |
||
| } | ||
|
|
||
| IPAddressVO ip = markIpAsUnavailable(addrId); | ||
|
|
@@ -1567,7 +1568,7 @@ public IPAddressVO associateIPToGuestNetwork(long ipId, long networkId, boolean | |
| if (ip != null) { | ||
| try { | ||
| s_logger.warn("Failed to associate ip address, so releasing ip from the database " + ip); | ||
| _ipAddressDao.markAsUnavailable(ip.getId()); | ||
| _ipAddressDao.markAsReleasing(ip.getId()); | ||
| if (!applyIpAssociations(network, true)) { | ||
| // if fail to apply ip associations again, unassign ip address without updating resource | ||
| // count and generating usage event as there is no need to keep it in the db | ||
|
|
@@ -1981,7 +1982,7 @@ public IPAddressVO doInTransaction(TransactionStatus status) { | |
| } | ||
| } | ||
|
|
||
| return _ipAddressDao.markAsUnavailable(addrId); | ||
| return _ipAddressDao.markAsReleasing(addrId); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
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 the IP resources that are cleaned up by the
cleanupIpResourcesmethod being rolled back when the exception is thrown?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.
@weizhouapache can you check this ^^^