Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Jan 18, 2025
1 parent 9ec7eec commit a0d0877
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions api/client/kubeclient/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (v vm) AddVolume(ctx context.Context, name string, opts v1alpha2.VirtualMac
Param("volumeKind", opts.VolumeKind).
Param("pvcName", opts.PVCName).
Param("image", opts.Image).
Param("isCdrom", strconv.FormatBool(opts.IsCdrom)).
Do(ctx).
Error()
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/subresources/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type VirtualMachineAddVolume struct {
VolumeKind string
PVCName string
Image string
AsCdrom bool
IsCdrom bool
}

// +genclient
Expand Down
2 changes: 1 addition & 1 deletion api/subresources/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type VirtualMachineAddVolume struct {
VolumeKind string `json:"volumeKind"`
PVCName string `json:"pvcName"`
Image string `json:"image"`
AsCdrom bool `json:"asCdrom"`
IsCdrom bool `json:"isCdrom"`
}

// +genclient
Expand Down
9 changes: 9 additions & 0 deletions api/subresources/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (r AddVolumeREST) requestFromKubevirt(opts *subresources.VirtualMachineAddV

func (r AddVolumeREST) genMutateRequestHook(opts *subresources.VirtualMachineAddVolume) (mutateRequestHook, error) {
var dd virtv1.DiskDevice
if opts.AsCdrom {
if opts.IsCdrom {
dd.CDRom = &virtv1.CDRomTarget{
Bus: virtv1.DiskBusSATA,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func (s AttachmentService) HotPlugDisk(ctx context.Context, ad *AttachmentDisk,
Name: ad.GenerateName,
Image: ad.Image,
PVCName: ad.PVCName,
IsCdrom: ad.IsCdrom,
})
}

Expand Down Expand Up @@ -275,6 +276,7 @@ type AttachmentDisk struct {
GenerateName string
PVCName string
Image string
IsCdrom bool
}

func NewAttachmentDiskFromVirtualDisk(vd *virtv2.VirtualDisk) *AttachmentDisk {
Expand All @@ -293,6 +295,7 @@ func NewAttachmentDiskFromVirtualImage(vi *virtv2.VirtualImage) *AttachmentDisk
Name: vi.GetName(),
Namespace: vi.GetNamespace(),
GenerateName: kvbuilder.GenerateVMIDiskName(vi.GetName()),
IsCdrom: vi.Status.CDROM,
}

if vi.Spec.Storage == virtv2.StorageContainerRegistry {
Expand All @@ -310,5 +313,6 @@ func NewAttachmentDiskFromClusterVirtualImage(cvi *virtv2.ClusterVirtualImage) *
Name: cvi.GetName(),
GenerateName: kvbuilder.GenerateCVMIDiskName(cvi.GetName()),
Image: cvi.Status.Target.RegistryURL,
IsCdrom: cvi.Status.CDROM,
}
}

0 comments on commit a0d0877

Please sign in to comment.