Repository navigation
deal with xcpng refactors - #14287
DaanHoogland wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14287 +/- ##
=========================================
Coverage 18.34% 18.34%
- Complexity 16679 16682 +3
=========================================
Files 5940 5940
Lines 537840 537840
Branches 65940 65940
=========================================
+ Hits 98668 98680 +12
+ Misses 427946 427935 -11
+ Partials 11226 11225 -1
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:
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open findings
In the fallback branch,vhdutilis referenced without being imported in this block. Ifvhdutil… · New This SM-compatibility shim is duplicated (also inxenserver84/vmopsSnapshot). To reduce the risk… · New The PR description is still the template and doesn’t explain the behavioral change or validation.… · New
What changed in this PR
Adds compatibility shims for XCP-ng SM refactors so the XenServer/XCP-ng storage scripts work across “old” and “new” SM module layouts/APIs.
Changes:
- Add try/except import fallbacks to support the SM >= 3.2.12-18 refactor (vhdutil as class, lvhdutil folded into constants/lvmcowutil).
- Update call sites to use compatibility wrapper functions and VG constants.
- Update NFSSR locking constant usage to handle LOCK_TYPE_SR moving modules.
| File | Description |
|---|---|
| scripts/vm/hypervisor/xenserver/xenserver84/vmopsSnapshot | Adds vhdutil/lvhdutil compatibility layer and updates callers to use shimmed functions/constants. |
| scripts/vm/hypervisor/xenserver/xenserver84/cloud-plugin-storage | Mirrors the compatibility layer approach and updates VHD parent discovery paths accordingly. |
| scripts/vm/hypervisor/xenserver/xcpserver83/NFSSR.py | Adapts to LOCK_TYPE_SR relocation while keeping backwards compatibility. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| try: | ||
| # sm >= 3.2.12-18 (e.g. XCP-ng 8.3), where LOCK_TYPE_SR moved to lock.py | ||
| from lock import LOCK_TYPE_SR | ||
| except ImportError: | ||
| # older sm (XenServer and XCP-ng releases prior to the 8.3 SM refactor) | ||
| LOCK_TYPE_SR = vhdutil.LOCK_TYPE_SR |
| try: | ||
| # sm >= 3.2.12-18 (e.g. XCP-ng 8.3), where lvhdutil was folded into | ||
| # constants/lvmcowutil and vhdutil became a class | ||
| from constants import VG_PREFIX, VG_LOCATION | ||
| from lvmcowutil import LvmCowUtil | ||
| from vhdutil import VhdUtil | ||
| _vhdutil = VhdUtil() | ||
| lvhdutil_extractUuid = LvmCowUtil.extractUuid | ||
| vhdutil_getParent = _vhdutil.getParent | ||
| vhdutil_getVHDInfoLVM = _vhdutil.getInfoFromLVM | ||
| except ImportError: | ||
| # older sm (XenServer and XCP-ng releases prior to the 8.3 SM refactor) | ||
| import vhdutil | ||
| import lvhdutil | ||
| VG_PREFIX = lvhdutil.VG_PREFIX | ||
| VG_LOCATION = lvhdutil.VG_LOCATION | ||
| lvhdutil_extractUuid = lvhdutil.extractUuid | ||
| vhdutil_getParent = vhdutil.getParent | ||
| vhdutil_getVHDInfoLVM = vhdutil.getVHDInfoLVM |
| try: | ||
| # sm >= 3.2.12-18 (e.g. XCP-ng 8.3), where lvhdutil was folded into | ||
| # constants/lvmcowutil and vhdutil became a class | ||
| from constants import VG_PREFIX, VG_LOCATION | ||
| from lvmcowutil import LvmCowUtil | ||
| from vhdutil import VhdUtil |
|
Hi Daan, instead of patching the old NFSSR.py, can't we just use the stock version that comes with XCP-NG? The code to create SR's already contains the -nosub parameter. It would be one less file to patch and maintain. Or do you know of any other reason that driver was forked? |
@mvds-bbtk , I'm fine with that. I am not a daily xen user and am willing to drop this. |
f2d5e10 to
7140e43
Compare
|




Description
This PR...
Fixes: #13292
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?