-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
@stoyanr PR is still in progress casue I didn't test that yet, tomorrow during the sync meeting we have to discuss |
402158a
to
f47eba4
Compare
f47eba4
to
6ded4c1
Compare
6ded4c1
to
787e2b2
Compare
787e2b2
to
3a2cc7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good, I only have a few naming suggestions and a few more regarding wording of comments.
pkg/kubevirt/apis/provider_spec.go
Outdated
@@ -64,6 +69,8 @@ type KubeVirtProviderSpec struct { | |||
// AdditionalVolumeSpec represents an additional volume attached to a VM. | |||
// Only one of its members may be specified. | |||
type AdditionalVolumeSpec struct { | |||
// Name of the volume |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Name of the volume | |
// Name is the additional volume name |
pkg/kubevirt/apis/provider_spec.go
Outdated
@@ -89,6 +96,22 @@ type VolumeSource struct { | |||
Secret *kubevirtv1.SecretVolumeSource `json:"secret,omitempty"` | |||
} | |||
|
|||
// Devices allows to fine-tune devices attached to KubeVirt VM | |||
type Devices struct { | |||
// Disks allows to customize disks attached to KubeVirt VM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Disks allows to customize disks attached to KubeVirt VM | |
// Disks allows customizing the disks attached to the VM. |
pkg/kubevirt/apis/provider_spec.go
Outdated
// Disks allows to customize disks attached to KubeVirt VM | ||
// +optional | ||
Disks []kubevirtv1.Disk `json:"disks,omitempty"` | ||
// Whether to have random number generator from host |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Whether to have random number generator from host | |
// Rng specifies whether to have a random number generator from host. |
pkg/kubevirt/apis/provider_spec.go
Outdated
// Whether to have random number generator from host | ||
// +optional | ||
Rng *kubevirtv1.Rng `json:"rng,omitempty"` | ||
// Whether or not to enable virtio multi-queue for block devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Whether or not to enable virtio multi-queue for block devices | |
// BlockMultiQueue specifies whether to enable virtio multi-queue for block devices. |
pkg/kubevirt/apis/provider_spec.go
Outdated
// Whether or not to enable virtio multi-queue for block devices | ||
// +optional | ||
BlockMultiQueue bool `json:"blockMultiQueue,omitempty"` | ||
// If specified, virtual network interfaces configured with a virtio bus will also enable the vhost multiqueue feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If specified, virtual network interfaces configured with a virtio bus will also enable the vhost multiqueue feature | |
// NetworkInterfaceMultiQueue specifies whether virtual network interfaces configured with a virtio bus will also enable the vhost multi-queue feature. |
pkg/kubevirt/core/util.go
Outdated
@@ -163,26 +163,47 @@ ethernets: | |||
return interfaces, networks, networkData | |||
} | |||
|
|||
func findDiskByVolumeName(name string, disks []kubevirtv1.Disk) *kubevirtv1.Disk { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function finds a disk in a slice by its name, no "volume" here.
func findDiskByVolumeName(name string, disks []kubevirtv1.Disk) *kubevirtv1.Disk { | |
func findDiskByName(name string, disks []kubevirtv1.Disk) *kubevirtv1.Disk { |
pkg/kubevirt/core/util.go
Outdated
return nil | ||
} | ||
|
||
func generateDefaultDisk(name string) kubevirtv1.Disk { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use build
rather than generate
for consistency with the rest of the code.
func generateDefaultDisk(name string) kubevirtv1.Disk { | |
func buildDefaultDisk(name string) kubevirtv1.Disk { |
pkg/kubevirt/core/util.go
Outdated
func buildVolumes( | ||
machineName, namespace, userDataSecretName, networkData string, | ||
rootVolume cdicorev1alpha1.DataVolumeSpec, | ||
additionalVolumes []api.AdditionalVolumeSpec, | ||
providedDisks []kubevirtv1.Disk, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use configuredDisks
as it's a bit more concrete.
providedDisks []kubevirtv1.Disk, | |
configuredDisks []kubevirtv1.Disk, |
return errs | ||
} | ||
|
||
func hasDiskVolumeMatch(diskName string, volumes []api.AdditionalVolumeSpec) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function checks whether the given slice has a volume with the given name.
func hasDiskVolumeMatch(diskName string, volumes []api.AdditionalVolumeSpec) bool { | |
func hasVolumeWithName(diskName string, volumes []api.AdditionalVolumeSpec) bool { |
pkg/kubevirt/core/util.go
Outdated
@@ -163,26 +163,47 @@ ethernets: | |||
return interfaces, networks, networkData | |||
} | |||
|
|||
func findDiskByVolumeName(name string, disks []kubevirtv1.Disk) *kubevirtv1.Disk { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move the 2 helper functions findDiskByName
and buildDefaultDisk
below buildVolumes
for consistency with the rest of the code?
Signed-off-by: Marcin Franczyk <[email protected]>
3a2cc7d
to
b34ccb3
Compare
@stoyanr I addressed all your comments. |
Signed-off-by: Marcin Franczyk [email protected]
What this PR does / why we need it:
It allows to pass devices options and matches disks settings with volumes
Which issue(s) this PR fixes:
Fixes gardener-attic/gardener-extension-provider-kubevirt#36
Special notes for your reviewer:
Release note: