Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: Bella Khizgiyaev <bkhizgiy@redhat.com>
bkhizgiy committed Mar 12, 2024
1 parent 7fda24d commit e10d287
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 3 additions & 1 deletion pkg/controller/plan/adapter/ova/kubevirtvmparser.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ova

import (
liberr "github.com/konveyor/forklift-controller/pkg/lib/error"
"gopkg.in/yaml.v2"
)

@@ -38,7 +39,7 @@ type EFI struct {
SecureBoot bool `yaml:"secureBoot"`
}

func ReadConfFromYaml(yamlData []byte) (firmware string, err error) {
func GetFirmwareFromYaml(yamlData []byte) (firmware string, err error) {
var vmi VirtualMachineInstance
if err = yaml.Unmarshal(yamlData, &vmi); err != nil {
return
@@ -52,5 +53,6 @@ func ReadConfFromYaml(yamlData []byte) (firmware string, err error) {
firmware = "efi"
return
}
err = liberr.New("Firmware type was not detected")
return
}
6 changes: 2 additions & 4 deletions pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
@@ -882,14 +882,12 @@ func (r *KubeVirt) UpdateVmByConvertedConfig(vm *plan.VMStatus, pod *core.Pod, s
return
}

vm.Firmware, err = yamlparser.ReadConfFromYaml(vmConf)
vm.Firmware, err = yamlparser.GetFirmwareFromYaml(vmConf)
if err != nil {
r.Log.Error(err, "failed to get firmware configuration")
}

r.Log.Info("Setting the vm firmware",
"vm",
vm.String())
r.Log.Info("Setting the vm firmware ", vm.Firmware, "vmId", vm.ID)

shutdownURL := fmt.Sprintf("http://%s:8080/shutdown", pod.Status.PodIP)
resp, err = http.Post(shutdownURL, "application/json", nil)
4 changes: 2 additions & 2 deletions virt-v2v/cold/entrypoint.go
Original file line number Diff line number Diff line change
@@ -264,8 +264,8 @@ func vmHandler(w http.ResponseWriter, r *http.Request) {

err := addFirmwareToYaml(yamlFilePath)
if err != nil {
fmt.Printf("Error setting yaml file: %v\n", err)
http.Error(w, "Error setting yaml file", http.StatusInternalServerError)
fmt.Printf("Error modifying vm configuration: %v\n", err)
http.Error(w, "Error modifying vm configuration:", http.StatusInternalServerError)
}

yamlData, err := os.ReadFile(yamlFilePath)

0 comments on commit e10d287

Please sign in to comment.