Add NULL check during restoreVM operation when host is removed - #13779
Add NULL check during restoreVM operation when host is removed#13779nvazquez wants to merge 4 commits into
Conversation
…e#571) * Add NULL check during restore VM operation when host is not available/removed * fix line ending pre commit failure * update logging with details of removed host and vm --------- Co-authored-by: Sachin R Doddaguni <s_rudrappadoddagu@apple.com> (cherry picked from commit 1dbda12ccdca1aaf86ef8f9b185986c9d22b567e)
| // host row may have been hard-deleted from DB, treat like removed | ||
| if (host == null) { | ||
| logger.warn("Host {} not found", hostId); | ||
| s_logger.warn(String.format("Host with id %s not found in DB for VM %s (%s)", |
There was a problem hiding this comment.
s_logger doesn't exist in this class. It only has logger (see the line right below this one). This won't compile.
| // host row may have been hard-deleted from DB, treat like removed | ||
| if (host == null) { | ||
| logger.warn("Host {} not found", hostId); | ||
| s_logger.warn(String.format("Host with id %s not found in DB for VM %s (%s)", |
There was a problem hiding this comment.
Use {} placeholders here to match the branch below, instead of String.format.
| import org.apache.cloudstack.acl.SecurityChecker; | ||
| import org.apache.cloudstack.api.ApiCommandResourceType; | ||
| import org.apache.cloudstack.api.ApiConstants; | ||
| import com.cloud.host.Status; |
There was a problem hiding this comment.
com.cloud.host.Status is out of place here, mixed into the org.apache.cloudstack.* block.
| } | ||
|
|
||
| @Test | ||
| public void testRestoreVirtualMachineWhenHostRemoved() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { |
There was a problem hiding this comment.
Should we also add a test for the host-row-missing case, not just Removed?
|
@blueorangutan package |
|
@vladimirpetrov a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18790 |
|
@blueorangutan package |
|
@vladimirpetrov a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18791 |
|
@blueorangutan package |
|
@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #13779 +/- ##
============================================
+ Coverage 17.69% 17.71% +0.01%
- Complexity 15835 15848 +13
============================================
Files 5925 5925
Lines 533539 533544 +5
Branches 65274 65275 +1
============================================
+ Hits 94427 94518 +91
+ Misses 428435 428326 -109
- Partials 10677 10700 +23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18792 |
|
@blueorangutan package |
|
@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18794 |
|
@blueorangutan package |
|
@vladimirpetrov a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18795 |
|
@blueorangutan package |
|
@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18800 |
|
@blueorangutan test |
|
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-16726)
|
vladimirpetrov
left a comment
There was a problem hiding this comment.
LGTM based on manual testing, on the patched version the restore VM command doesn't fail and no additional volumes are left after the operation.
Description
This PR addresses a fix for the following use case:
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?