feat: support attaching volumes as shareable disks (#1026)

Show a Shareable checkbox when attaching an existing volume whose
    PVC is RWX Block and not provisioned by Longhorn. Checking it sets
    disk.shareable and shows a data-corruption warning banner.

    Related issue: harvester/harvester#9650

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
This commit is contained in:
freeze
2026-08-03 16:24:33 +08:00
committed by GitHub
parent afe632b723
commit 9a935434c2
4 changed files with 177 additions and 9 deletions
@@ -618,6 +618,7 @@ export default {
type,
storageClassName,
hotpluggable,
shareable: DISK.shareable || false,
volumeStatus,
dataSource,
namespace,
@@ -969,6 +970,14 @@ export default {
const specDisks = this.spec?.template?.spec?.domain?.devices?.disks;
const mergedDisks = this.mergeDeviceList(specDisks, disks);
// `shareable` is an attachment-level opt-in, remove the field
// inherited from the old spec when the disk row no longer requests it
mergedDisks.forEach((disk) => {
if (disk.shareable && !disks.find((D) => D.name === disk.name)?.shareable) {
delete disk.shareable;
}
});
let spec = {
...this.spec,
runStrategy: this.runStrategy,
@@ -1253,6 +1262,10 @@ export default {
out.cdrom = { bus: R.bus };
}
if (R.shareable) {
out.shareable = true;
}
out.bootOrder = index + 1;
return out;