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

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


(cherry picked from commit 9a935434c2)

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
Co-authored-by: freeze <1615081+Vicente-Cheng@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2026-08-03 16:53:57 +08:00
committed by GitHub
co-authored by freeze
parent 3b7a0c30a7
commit 1d55319aba
4 changed files with 177 additions and 9 deletions
@@ -616,6 +616,7 @@ export default {
type,
storageClassName,
hotpluggable,
shareable: DISK.shareable || false,
volumeStatus,
dataSource,
namespace,
@@ -967,6 +968,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,
@@ -1251,6 +1260,10 @@ export default {
out.cdrom = { bus: R.bus };
}
if (R.shareable) {
out.shareable = true;
}
out.bootOrder = index + 1;
return out;