Skip to content

Commit

Permalink
Always set VM volume bus and disk type when changing image type
Browse files Browse the repository at this point in the history
The onImageChange() function sets the VM volume type="cd-rom" and
bus="sata" when an ISO image is selected, but it only works for
the first volume.  This commit enables the automatic type and bus
selection for all volumes attached to a VM.

Related issue: harvester/harvester#5142

Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit 90e6535)
  • Loading branch information
tserong authored and a110605 committed Aug 16, 2024
1 parent d073cf3 commit d3bbeb1
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ export default {
onImageChange() {
const imageResource = this.$store.getters['harvester/all'](HCI.IMAGE)?.find( I => this.value.image === I.id);
if (this.idx === 0) {
if (/iso$/i.test(imageResource?.imageSuffix)) {
this.$set(this.value, 'type', 'cd-rom');
this.$set(this.value, 'bus', 'sata');
} else {
this.$set(this.value, 'type', 'disk');
this.$set(this.value, 'bus', 'virtio');
}
if (/iso$/i.test(imageResource?.imageSuffix)) {
this.$set(this.value, 'type', 'cd-rom');
this.$set(this.value, 'bus', 'sata');
} else {
this.$set(this.value, 'type', 'disk');
this.$set(this.value, 'bus', 'virtio');
}
this.update();
Expand Down

0 comments on commit d3bbeb1

Please sign in to comment.