feat: allow user to attach volume to muliple VMs (#620) (#622)

(cherry picked from commit d94003f8c28876b4e5803bb04a6049ab63f812e6)

Signed-off-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
mergify[bot] 2025-11-27 14:30:44 +08:00 committed by GitHub
parent 5f8d556ea2
commit 2f956d5946
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View File

@ -62,7 +62,7 @@ export default {
return false;
}
return !pvc.attachVM;
return true;
})
.map((pvc) => {
return {

View File

@ -99,7 +99,6 @@ export default {
this.allPVCs
.filter( (pvc) => {
let isAvailable = true;
let isBeingUsed = false;
this.rows.forEach( (O) => {
if (O.volumeName === pvc.metadata.name) {
@ -111,17 +110,16 @@ export default {
return false;
}
// already used as image volume
if (this.idx > 0 && pvc.metadata?.annotations?.[HCI_ANNOTATIONS.IMAGE_ID]) {
return false;
}
if (pvc.isGoldenImageVolume) {
return false;
}
if (pvc.attachVM && isAvailable && pvc.attachVM?.id === this.vm?.id && this.isEdit) {
isBeingUsed = false;
} else if (pvc.attachVM) {
isBeingUsed = true;
}
return isAvailable && !isBeingUsed && pvc.isAvailable;
return isAvailable && pvc.isAvailable;
})
.map((pvc) => {
return {