Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface BlockExternalPrimaryStorageFactory {

BlockExternalPrimaryStorageBackend getBlockExternalPrimaryStorageBackend(PrimaryStorageVO vo);

void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable);
void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable, PrimaryStorageVO vo);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

这是破坏性接口变更;请改为真正“重载”,并保持二进制兼容。

PR 说明称“新增重载方法”,但当前是直接替换签名,这会破坏所有实现类与三方插件(运行期易触发 NoSuchMethodError)。根据“向后兼容原则”,保留旧签名,并以 default 方式新增重载。

建议修改:

-    void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable, PrimaryStorageVO vo);
+    // Keep the original abstract method for ABI compatibility
+    void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable);
+
+    /**
+     * Activate an iSCSI volume so the host can access it.
+     *
+     * @param clientIqn      initiator IQN of the client host
+     * @param vol            volume to be activated
+     * @param shareable      whether the volume is shareable
+     * @param primaryStorage PrimaryStorageVO of the target primary storage; may be null
+     */
+    default void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable, PrimaryStorageVO primaryStorage) {
+        // Default to legacy behavior to avoid breaking existing implementors.
+        activeIscsiVolume(clientIqn, vol, shareable);
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable, PrimaryStorageVO vo);
// Keep the original abstract method for ABI compatibility
void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable);
/**
* Activate an iSCSI volume so the host can access it.
*
* @param clientIqn initiator IQN of the client host
* @param vol volume to be activated
* @param shareable whether the volume is shareable
* @param primaryStorage PrimaryStorageVO of the target primary storage; may be null
*/
default void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable, PrimaryStorageVO primaryStorage) {
// Default to legacy behavior to avoid breaking existing implementors.
activeIscsiVolume(clientIqn, vol, shareable);
}
🤖 Prompt for AI Agents
In
storage/src/main/java/org/zstack/storage/addon/primary/BlockExternalPrimaryStorageFactory.java
around line 14, the interface method signature was changed which breaks binary
compatibility; restore the original abstract method signature void
activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean shareable,
PrimaryStorageVO vo); and add the new overloaded method as a default method
(e.g., void activeIscsiVolume(String clientIqn, BaseVolumeInfo vol, boolean
shareable, PrimaryStorageVO vo, /*new params*/)) that delegates to the original
method (or vice versa depending on parameter direction) so existing implementors
keep working and new callers can use the overload without breaking runtime
compatibility.


Map<String, String> getVolumeIscsiInfo(String volInstallPath, HostInventory host);

Expand Down