Skip to content

Commit

Permalink
update generated files
Browse files Browse the repository at this point in the history
Signed-off-by: Vladik Romanovsky <[email protected]>
  • Loading branch information
vladikr committed Sep 18, 2020
1 parent af06bcd commit e0a07c7
Show file tree
Hide file tree
Showing 14 changed files with 275 additions and 78 deletions.
1 change: 1 addition & 0 deletions api/api-rule-violations-known.list
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,DHCPOptions,N
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,DHCPOptions,PrivateOptions
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,DeveloperConfiguration,FeatureGates
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Disks
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Filesystems
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,GPUs
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Inputs
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Interfaces
Expand Down
1 change: 1 addition & 0 deletions api/api-rule-violations.list
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,DHCPOptions,N
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,DHCPOptions,PrivateOptions
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,DeveloperConfiguration,FeatureGates
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Disks
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Filesystems
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,GPUs
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Inputs
API rule violation: list_type_missing,kubevirt.io/client-go/api/v1,Devices,Interfaces
Expand Down
2 changes: 1 addition & 1 deletion api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11313,4 +11313,4 @@
"in": "header"
}
}
}
}
8 changes: 6 additions & 2 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ func IsGPUVMI(vmi *v1.VirtualMachineInstance) bool {

// Check if a VMI spec requests VirtIO-FS
func IsVMIVirtiofsEnabled(vmi *v1.VirtualMachineInstance) bool {
if vmi.Spec.Domain.Devices.Filesystems != nil && len(vmi.Spec.Domain.Devices.Filesystems) != 0 {
return true
if vmi.Spec.Domain.Devices.Filesystems != nil {
for _, fs := range vmi.Spec.Domain.Devices.Filesystems {
if fs.Virtiofs != nil {
return true
}
}
}
return false
}
Original file line number Diff line number Diff line change
Expand Up @@ -935,14 +935,13 @@ func ValidateVirtualMachineInstanceSpec(field *k8sfield.Path, spec *v1.VirtualMa
})
}

if spec.Domain.Devices.Filesystems != nil && !config.VirtiofsEnabled() {
causes = append(causes, metav1.StatusCause{
Type: metav1.CauseTypeFieldValueInvalid,
Message: fmt.Sprintf("virtiofs feature gate is not enabled in kubevirt-config"),
Field: field.Child("Filesystems").String(),
})
}

if spec.Domain.Devices.Filesystems != nil && !config.VirtiofsEnabled() {
causes = append(causes, metav1.StatusCause{
Type: metav1.CauseTypeFieldValueInvalid,
Message: fmt.Sprintf("virtiofs feature gate is not enabled in kubevirt-config"),
Field: field.Child("Filesystems").String(),
})
}

return causes
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1791,30 +1791,55 @@ var _ = Describe("Validating VMICreate Admitter", func() {
causes := ValidateVirtualMachineInstanceSpec(k8sfield.NewPath("fake"), &vmi.Spec, config)
Expect(len(causes)).To(Equal(1))
Expect(causes[0].Field).To(Equal("fake.GPUs"))
It("should reject virtiofs filesystems when feature gate is disabled", func() {
vmi := v1.NewMinimalVMI("testvm")
guestMemory := resource.MustParse("64Mi")

vmi.Spec.Domain.Resources.Requests = k8sv1.ResourceList{
k8sv1.ResourceMemory: resource.MustParse("64Mi"),
}
vmi.Spec.Domain.Memory = &v1.Memory{Guest: &guestMemory}
vmi.Spec.Domain.Memory = &v1.Memory{
Hugepages: &v1.Hugepages{},
Guest: &guestMemory,
}
vmi.Spec.Domain.Memory.Hugepages.PageSize = "2Mi"
vmi.Spec.Domain.Devices.Filesystems = []v1.Filesystem{
v1.Filesystem{
Name: "sharednfstest",
},
}

causes := ValidateVirtualMachineInstanceSpec(k8sfield.NewPath("fake"), &vmi.Spec, config)
Expect(len(causes)).To(Equal(1))
Expect(causes[0].Field).To(Equal("fake.Filesystems"))
})
})
})
It("should reject virtiofs filesystems when feature gate is disabled", func() {
vmi := v1.NewMinimalVMI("testvm")
guestMemory := resource.MustParse("64Mi")

vmi.Spec.Domain.Resources.Requests = k8sv1.ResourceList{
k8sv1.ResourceMemory: resource.MustParse("64Mi"),
}
vmi.Spec.Domain.Memory = &v1.Memory{Guest: &guestMemory}
vmi.Spec.Domain.Memory = &v1.Memory{
Hugepages: &v1.Hugepages{},
Guest: &guestMemory,
}
vmi.Spec.Domain.Memory.Hugepages.PageSize = "2Mi"
vmi.Spec.Domain.Devices.Filesystems = []v1.Filesystem{
v1.Filesystem{
Name: "sharednfstest",
Virtiofs: &v1.FilesystemVirtiofs{},
},
}

causes := ValidateVirtualMachineInstanceSpec(k8sfield.NewPath("fake"), &vmi.Spec, config)
Expect(len(causes)).To(Equal(1))
Expect(causes[0].Field).To(Equal("fake.Filesystems"))
})
It("should allow virtiofs filesystems when feature gate is enabled", func() {
enableFeatureGate(virtconfig.VirtIOFSGate)
vmi := v1.NewMinimalVMI("testvm")
guestMemory := resource.MustParse("64Mi")

vmi.Spec.Domain.Resources.Requests = k8sv1.ResourceList{
k8sv1.ResourceMemory: resource.MustParse("64Mi"),
}
vmi.Spec.Domain.Memory = &v1.Memory{Guest: &guestMemory}
vmi.Spec.Domain.Memory = &v1.Memory{
Hugepages: &v1.Hugepages{},
Guest: &guestMemory,
}
vmi.Spec.Domain.Memory.Hugepages.PageSize = "2Mi"
vmi.Spec.Domain.Devices.Filesystems = []v1.Filesystem{
v1.Filesystem{
Name: "sharednfstest",
Virtiofs: &v1.FilesystemVirtiofs{},
},
}

causes := ValidateVirtualMachineInstanceSpec(k8sfield.NewPath("fake"), &vmi.Spec, config)
Expect(len(causes)).To(Equal(0))
})

table.DescribeTable("Should accept valid DNSPolicy and DNSConfig",
func(dnsPolicy k8sv1.DNSPolicy, dnsConfig *k8sv1.PodDNSConfig) {
Expand Down
5 changes: 2 additions & 3 deletions pkg/virt-controller/services/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,11 +842,10 @@ func (t *templateService) RenderLaunchManifest(vmi *v1.VirtualMachineInstance) (
if _, ok := vmi.Labels[debugLogs]; ok {
compute.Env = append(compute.Env, k8sv1.EnvVar{Name: ENV_VAR_LIBVIRT_DEBUG_LOGS, Value: "1"})
}
if _, ok := vmi.Labels[virtiofsDebugLogs]; ok {
compute.Env = append(compute.Env, k8sv1.EnvVar{Name: ENV_VAR_VIRTIOFSD_DEBUG_LOGS, Value: "1"})
if _, ok := vmi.Labels[virtiofsDebugLogs]; ok {
compute.Env = append(compute.Env, k8sv1.EnvVar{Name: ENV_VAR_VIRTIOFSD_DEBUG_LOGS, Value: "1"})
}


// Make sure the compute container is always the first since the mutating webhook shipped with the sriov operator
// for adding the requested resources to the pod will add them to the first container of the list
containers := []k8sv1.Container{compute}
Expand Down
60 changes: 31 additions & 29 deletions pkg/virt-launcher/virtwrap/api/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -979,37 +979,39 @@ func Convert_v1_VirtualMachine_To_api_Domain(vmi *v1.VirtualMachineInstance, dom
}
// Handle virtioFS
for _, fs := range vmi.Spec.Domain.Devices.Filesystems {
newFS := FilesystemDevice{}

newFS.Type = "mount"
newFS.AccessMode = "passthrough"
newFS.Driver = &FilesystemDriver{
Type: "virtiofs",
Queue: "1024",
}
newFS.Binary = &FilesystemBinary{
Path: "/usr/libexec/virtiofsd",
Xattr: "on",
Cache: &FilesystemBinaryCache{
Mode: "always",
},
Lock: &FilesystemBinaryLock{
Posix: "on",
Flock: "on",
},
}
newFS.Target = &FilesystemTarget{
Dir: fs.Name,
}
if fs.Virtiofs != nil {
newFS := FilesystemDevice{}

newFS.Type = "mount"
newFS.AccessMode = "passthrough"
newFS.Driver = &FilesystemDriver{
Type: "virtiofs",
Queue: "1024",
}
newFS.Binary = &FilesystemBinary{
Path: "/usr/libexec/virtiofsd",
Xattr: "on",
Cache: &FilesystemBinaryCache{
Mode: "always",
},
Lock: &FilesystemBinaryLock{
Posix: "on",
Flock: "on",
},
}
newFS.Target = &FilesystemTarget{
Dir: fs.Name,
}

volume := volumes[fs.Name]
if volume == nil {
return fmt.Errorf("No matching volume with name %s found", fs.Name)
volume := volumes[fs.Name]
if volume == nil {
return fmt.Errorf("No matching volume with name %s found", fs.Name)
}
volDir, _ := filepath.Split(GetFilesystemVolumePath(volume.Name))
newFS.Source = &FilesystemSource{}
newFS.Source.Dir = volDir
domain.Spec.Devices.Filesystems = append(domain.Spec.Devices.Filesystems, newFS)
}
volDir, _ := filepath.Split(GetFilesystemVolumePath(volume.Name))
newFS.Source = &FilesystemSource{}
newFS.Source.Dir = volDir
domain.Spec.Devices.Filesystems = append(domain.Spec.Devices.Filesystems, newFS)
}

if vmi.Spec.Domain.Devices.Watchdog != nil {
Expand Down
11 changes: 5 additions & 6 deletions pkg/virt-launcher/virtwrap/util/libvirt_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,11 @@ func SetupLibvirt() error {
}
}
if _, ok := os.LookupEnv("VIRTIOFSD_DEBUG_LOGS"); ok {
_, err = qemuConf.WriteString("virtiofsd_debug = 1\n")
if err != nil {
return err
}
}

_, err = qemuConf.WriteString("virtiofsd_debug = 1\n")
if err != nil {
return err
}
}

return nil
}
44 changes: 44 additions & 0 deletions staging/src/kubevirt.io/client-go/api/v1/deepcopy_generated.go

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

54 changes: 53 additions & 1 deletion staging/src/kubevirt.io/client-go/api/v1/openapi_generated.go

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

Loading

0 comments on commit e0a07c7

Please sign in to comment.