mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user