@@ -38,6 +38,8 @@ import (
3838 "github.com/cobaltcore-dev/kvm-node-agent/internal/libvirt/dominfo"
3939)
4040
41+ const supportedYes = "yes"
42+
4143type LibVirt struct {
4244 virt * libvirt.Libvirt
4345 client client.Client
@@ -372,7 +374,7 @@ func (l *LibVirt) addDomainCapabilities(old v1.Hypervisor) (v1.Hypervisor, error
372374 // - <mode name="example3" supported="yes"></mode> becomes "mode/example3"
373375 newHv .Status .DomainCapabilities .SupportedCpuModes = []string {}
374376 for _ , cpuMode := range domCapabilities .CPU .Modes {
375- if cpuMode .Supported != "yes" {
377+ if cpuMode .Supported != supportedYes {
376378 continue
377379 }
378380 newHv .Status .DomainCapabilities .SupportedCpuModes = append (
@@ -396,7 +398,7 @@ func (l *LibVirt) addDomainCapabilities(old v1.Hypervisor) (v1.Hypervisor, error
396398 // - <video supported="yes"></video> becomes "video".
397399 newHv .Status .DomainCapabilities .SupportedDevices = []string {}
398400 for _ , device := range domCapabilities .Devices .Devices {
399- if device .Supported != "yes" {
401+ if device .Supported != supportedYes {
400402 continue
401403 }
402404 newHv .Status .DomainCapabilities .SupportedDevices = append (
@@ -416,7 +418,7 @@ func (l *LibVirt) addDomainCapabilities(old v1.Hypervisor) (v1.Hypervisor, error
416418 // Convert the supported features into a flat list.
417419 newHv .Status .DomainCapabilities .SupportedFeatures = []string {}
418420 for _ , feature := range domCapabilities .Features .Features {
419- if feature .Supported == "yes" {
421+ if feature .Supported == supportedYes {
420422 newHv .Status .DomainCapabilities .SupportedFeatures = append (
421423 newHv .Status .DomainCapabilities .SupportedFeatures ,
422424 feature .XMLName .Local ,
0 commit comments