Skip to content

Commit

Permalink
Set bus and disk type correctly when creating VMs from ISO images
Browse files Browse the repository at this point in the history
The onImageChange() function in
edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/vmImage.vue
includes logic to set type="cd-rom" and bus="sata" when you select an
ISO image as the source for a volume.  This commit applies the same
logic when initially creating a VM from a given image.

Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit db0a588)
  • Loading branch information
tserong authored and a110605 committed Aug 16, 2024
1 parent c2bc33e commit d073cf3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/harvester/mixins/harvester-vm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,25 @@ export default {
let out = [];

if (_disks.length === 0) {
let bus = 'virtio';
let type = HARD_DISK;

const imageResource = this.images.find( I => this.imageId === I.id);

if (/iso$/i.test(imageResource?.imageSuffix)) {
bus = 'sata';
type = CD_ROM;
}

out.push({
id: randomStr(5),
source: SOURCE_TYPE.IMAGE,
name: 'disk-0',
accessMode: 'ReadWriteMany',
bus: 'virtio',
bus,
volumeName: '',
size: '10Gi',
type: HARD_DISK,
type,
storageClassName: '',
image: this.imageId,
volumeMode: 'Block',
Expand Down

0 comments on commit d073cf3

Please sign in to comment.