Skip to content

Commit

Permalink
cleanup in kubevirt.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ahadas committed Jun 18, 2024
1 parent de3d83d commit bbcc9e1
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 @@ -920,27 +920,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 923 in pkg/controller/plan/kubevirt.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L923

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

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

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L925

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

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

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L928

Added line #L928 was not covered by tests

switch r.Source.Provider.Type() {

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

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L930

Added line #L930 was not covered by tests
case api.Ova:
firmware, erro := ovfparser.GetFirmwareFromConfig(string(vmConfigXML))
if erro != nil {
err = erro
if vm.Firmware, err = ovfparser.GetFirmwareFromConfig(vmConfigXML); err != nil {

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
err = liberr.Wrap(err)
return
}

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)

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
return
}

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

View check run for this annotation

Codecov / codecov/patch

pkg/controller/plan/kubevirt.go#L940

Added line #L940 was not covered by tests
vm.OperatingSystem = os
}

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

0 comments on commit bbcc9e1

Please sign in to comment.