Skip to content

Commit

Permalink
cleanup in kubevirt.go
Browse files Browse the repository at this point in the history
Signed-off-by: Arik Hadas <[email protected]>
  • Loading branch information
ahadas committed Jun 18, 2024
1 parent 90f1232 commit d01d831
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,27 +924,24 @@ func (r *KubeVirt) UpdateVmByConvertedConfig(vm *plan.VMStatus, pod *core.Pod, s
}
defer resp.Body.Close()

vmConfigXML, err := io.ReadAll(resp.Body)
vmConfigBytes, err := io.ReadAll(resp.Body)

Check warning on line 927 in pkg/controller/plan/kubevirt.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L927

Added line #L927 was not covered by tests
if err != nil {
err = liberr.Wrap(err)

Check warning on line 929 in pkg/controller/plan/kubevirt.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L929

Added line #L929 was not covered by tests
return
}
vmConfigXML := string(vmConfigBytes)

Check warning on line 932 in pkg/controller/plan/kubevirt.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L932

Added line #L932 was not covered by tests

switch r.Source.Provider.Type() {
case api.Ova:
firmware, erro := ovfparser.GetFirmwareFromConfig(string(vmConfigXML))
if erro != nil {
err = erro
if vm.Firmware, err = ovfparser.GetFirmwareFromConfig(vmConfigXML); err != nil {
err = liberr.Wrap(err)
return

Check warning on line 938 in pkg/controller/plan/kubevirt.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L934-L938

Added lines #L934 - L938 were not covered by tests
}

vm.Firmware = firmware
case api.VSphere:
os, erro := ovfparser.GetOperationSystemFromConfig(string(vmConfigXML))
if erro != nil {
err = erro
if vm.OperatingSystem, err = ovfparser.GetOperationSystemFromConfig(vmConfigXML); err != nil {
err = liberr.Wrap(err)
return

Check warning on line 943 in pkg/controller/plan/kubevirt.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L940-L943

Added lines #L940 - L943 were not covered by tests
}
vm.OperatingSystem = os
}

shutdownURL := fmt.Sprintf("http://%s:8080/shutdown", pod.Status.PodIP)
Expand Down

0 comments on commit d01d831

Please sign in to comment.