Skip to content

Commit

Permalink
Address more review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Pramodh Pallapothu <pramodh@zededa.com>
  • Loading branch information
Pramodh Pallapothu committed Apr 25, 2024
1 parent cfa1c47 commit ad40404
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/pillar/hypervisor/hypervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestGetHypervisor(t *testing.T) {

func TestGetAvailableHypervisors(t *testing.T) {
all, enabled := GetAvailableHypervisors()
expected := []string{"xen", "kvm", "acrn", "containerd", "null"}
expected := []string{"xen", "kvm", "kubevirt", "acrn", "containerd", "null"}

if !reflect.DeepEqual(all, expected) {
t.Errorf("wrong list of available hypervisors: %+q vs. %+q", all, expected)
Expand Down
16 changes: 6 additions & 10 deletions pkg/pillar/hypervisor/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ func (ctx kubevirtContext) Setup(status types.DomainStatus, config types.DomainC
}
}

os.MkdirAll(kubevirtStateDir+domainName, 0777)
return nil
return os.MkdirAll(kubevirtStateDir+domainName, 0644)

}

// Kubevirt VMI config spec is updated with the domain config/status of the app.
Expand Down Expand Up @@ -509,18 +509,14 @@ func (ctx kubevirtContext) Stop(domainName string, force bool) error {
// Stop the VM
err = virtClient.VirtualMachineInstance(kubeapi.EVEKubeNameSpace).Delete(context.Background(), vmis.name, &metav1.DeleteOptions{})
if err != nil {
fmt.Printf("Stop error %v\n", err)
logrus.Errorf("Stop error %v\n", err)
return err
}
}

if _, ok := ctx.vmiList[domainName]; ok {
delete(ctx.vmiList, domainName)
}
delete(ctx.vmiList, domainName)

if _, ok := ctx.prevDomainMetric[domainName]; ok {
delete(ctx.prevDomainMetric, domainName)
}
delete(ctx.prevDomainMetric, domainName)

return nil
}
Expand Down Expand Up @@ -668,7 +664,7 @@ func getVMIStatus(vmiName string) (string, error) {

// Inspired from kvm.go
func waitForVMI(vmiName string, available bool) error {
maxDelay := time.Second * 300 // 5mins ?? lets keep it for now
maxDelay := time.Minute * 5 // 5mins ?? lets keep it for now
delay := time.Second
var waited time.Duration

Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/kubeapi/nitoapiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func CreateOrUpdateNAD(log *base.LogObject, nadName, jsonSpec string) error {
return err
}

// CheckEtherPassThroughNAD checks if network passthrough NAD is present
// CheckEtherPassThroughNAD checks if network passthrough NetworkAttachmentDefinition is present
func CheckEtherPassThroughNAD(nadName string) error {
netClientset, err := GetNetClientSet()
if err != nil {
Expand Down

0 comments on commit ad40404

Please sign in to comment.