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>
  • Loading branch information
tserong committed Mar 27, 2024
1 parent e87416c commit 1cff527
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 1cff527

Please sign in to comment.