-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Set nfsVersion in ssvm agent.properties only if it is not null #12445
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
base: 4.20
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #12445 +/- ##
=========================================
Coverage 16.23% 16.23%
- Complexity 13381 13382 +1
=========================================
Files 5657 5657
Lines 499024 499025 +1
Branches 60562 60562
=========================================
+ Hits 81029 81033 +4
+ Misses 408959 408957 -2
+ Partials 9036 9035 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@abh1sar 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 16391 |
DaanHoogland
left a comment
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.
@abh1sar , this looks good, but you mention, "in CopyCommand and some other commands”. Does this mean this construct needs to be applied in several locations? (and hence methodised)
...roller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
Outdated
Show resolved
Hide resolved
All the commands take the value from the same place. |
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.
Pull request overview
This PR fixes a bug where the string literal "null" is written to the SSVM agent.properties file when the global setting secstorage.nfs.version is not configured. This causes NFS mount failures in the secondary storage VM because it attempts to mount with vers=null option.
Changes:
- Added a null check before appending nfsVersion to boot arguments in
finalizeVirtualMachineProfilemethod
Comments suppressed due to low confidence (1)
services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java:333
- The same issue exists here where nfsVersion could be the string literal 'null' when secstorage.nfs.version is not configured. Consider adding a null check similar to the fix applied in finalizeVirtualMachineProfile (lines 1228-1230) to prevent setting null values on the command. This would be: if (nfsVersion != null) { setupCmd.setNfsVersion(nfsVersion); }
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(ssStore.getId());
setupCmd.setNfsVersion(nfsVersion);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...roller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
meaning they all pass through this big ass |
DaanHoogland
left a comment
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.
clgtm, (of course this method needs chopping up.)
Yes, they all read the value of nfsVersion from agent.properties which is set via |
|
@blueorangutan package |
|
@DaanHoogland 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 16393 |
RosiKyu
left a comment
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.
LGTM
Fixes: #12415 - secstorage.nfs.version = NULL results in vers=null mount option and SSVM NFS mount failure
Pre-Test Configuration
Confirmed secstorage.nfs.version is NULL (the bug trigger condition):
mysql> SELECT name, value FROM configuration WHERE name='secstorage.nfs.version';
+------------------------+-------+
| name | value |
+------------------------+-------+
| secstorage.nfs.version | NULL |
+------------------------+-------+
1 row in set (0.00 sec)
Test 1: Verify nfsVersion Not in SSVM Boot Arguments
root@s-1-VM:~# cat /var/cache/cloud/cmdline | tr ' ' '\n' | grep -i nfs root@s-1-VM:~#
root@s-1-VM:~# grep -i nfsversion /etc/cloudstack/agent/agent.properties
grep: /etc/cloudstack/agent/agent.properties: No such file or directory
Result: PASS - nfsVersion parameter is ABSENT from boot arguments (not nfsVersion=null)
Test 2: Verify Existing NFS Mounts Working
root@s-1-VM:~# mount | grep nfs
10.0.32.4:/acs/secondary/ref-trl-10637-k-Mol9-rositsa-kyuchukova/ref-trl-10637-k-Mol9-rositsa-kyuchukova-sec1 on /mnt/SecStorage/db6cac5e-bd12-3be8-ad93-324d1bd6a5a9 type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,acdirmin=0,acdirmax=0,soft,proto=tcp,timeo=133,retrans=2147483647,sec=sys,clientaddr=10.0.37.116,local_lock=none,addr=10.0.32.4)
10.0.32.4:/acs/secondary/ref-trl-10637-k-Mol9-rositsa-kyuchukova/ref-trl-10637-k-Mol9-rositsa-kyuchukova-sec2 on /mnt/SecStorage/41c5fac8-5833-3769-a25b-d326c94bf416 type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,acdirmin=0,acdirmax=0,soft,proto=tcp,timeo=133,retrans=2147483647,sec=sys,clientaddr=10.0.37.116,local_lock=none,addr=10.0.32.4)
Result: PASS - Both sec1 and sec2 mounted successfully with auto-negotiated vers=4.2
Test 3: Verify No vers=null Errors in Logs
root@s-1-VM:~# grep -i "vers=null" /var/log/cloud.log
root@s-1-VM:~#
Result: PASS - No vers=null mount errors found in SSVM logs
Test 4: Add New Secondary Storage (Critical Test)
Added new secondary storage sec3. This is the operation that failed in the bug report.
root@s-1-VM:~# mount | grep sec3
10.0.32.4:/acs/secondary/ref-trl-10637-k-Mol9-rositsa-kyuchukova/ref-trl-10637-k-Mol9-rositsa-kyuchukova-sec3 on /mnt/SecStorage/809fc3bc-3a29-335e-ac0d-eb1acc7551bb type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,acdirmin=0,acdirmax=0,soft,proto=tcp,timeo=133,retrans=2147483647,sec=sys,clientaddr=10.0.37.116,local_lock=none,addr=10.0.32.4)
Result: PASS - sec3 mounted successfully with auto-negotiated vers=4.2, NO vers=null error
Test 5: Verify Template Copy Operations
[root@mgmt1 ~]# tail -500 /var/log/cloudstack/management/management-server.log | grep -i "sec3"
2026-01-18 07:40:34,984 INFO [o.a.c.s.i.TemplateServiceImpl] (pool-378-thread-2:[]) (logid:793cfd5b) Copied template [routing-3] to image store [sec3].
2026-01-18 07:40:51,369 INFO [o.a.c.s.i.TemplateServiceImpl] (pool-378-thread-1:[]) (logid:793cfd5b) Copied template [centos55-x86_64] to image store [sec3].
2026-01-18 07:41:11,790 DEBUG [c.c.s.StatsCollector] (secstorage-1:[ctx-7ae0f021]) (logid:a61f3242) Verifying image storage [ImageStore {"id":3,"name":"sec3","uuid":"60472c35-d821-46cb-a5cc-7c94abbb6da8"}]. Capacity: total=[2.6357 TB], used=[1.5384 TB], threshold=[95.00%].
Result: PASS - Templates copied successfully to new secondary storage
Test 6: Verify SSVM Initialization
root@s-1-VM:~# journalctl -u cloud --no-pager | tail -5
Jan 18 07:40:28 s-1-VM _run.sh[3439]: 07:40:28,384 INFO NfsSecondaryStorageResource:3168 - Determined host 10.0.32.4 corresponds to IP 10.0.32.4
Jan 18 07:40:28 s-1-VM _run.sh[3439]: 07:40:28,685 INFO NfsSecondaryStorageResource:3232 - snapshots directory created/exists on Secondary Storage.
Jan 18 07:40:28 s-1-VM _run.sh[3439]: 07:40:28,689 INFO NfsSecondaryStorageResource:3232 - volumes directory created/exists on Secondary Storage.
Jan 18 07:40:49 s-1-VM _run.sh[3439]: 07:40:49,349 INFO NfsSecondaryStorageResource:3168 - Determined host 10.0.32.4 corresponds to IP 10.0.32.4
Result: PASS - Secondary storage initialized successfully, required directories created
Summary
| Test | Result |
|---|---|
| Existing NFS mounts (sec1, sec2) | PASS - vers=4.2 |
| Add new secondary storage (sec3) | PASS - vers=4.2 |
| Template copy to sec3 | PASS |
| SSVM initialization | PASS |
Conclusion
LGTM
The fix correctly omits the nfsVersion parameter from SSVM boot arguments when secstorage.nfs.version is NULL, allowing the OS to auto-negotiate the NFS version instead of failing with mount.nfs: parsing error on 'vers=' option.
|
@blueorangutan test |
|
@abh1sar a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-15203) |
Description
This PR fixes #12415
The agent.properties contains "nfsVersion = null" if the global settings
secstorage.nfs.versionis not set.NfsSecondaryStorageResourcepicks up the nfsVersion as "null" String inCopyCommandand some other commands, and tries to mount the secondary storage withvers=nulloption leading to mount failures in logs.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?