Skip to content

Commit

Permalink
OVA test: add minor code changes
Browse files Browse the repository at this point in the history
Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy authored and ahadas committed Dec 5, 2023
1 parent 557f1e4 commit d6ffb99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 8 additions & 3 deletions tests/suit/framework/ova.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package framework

import (
"context"
"errors"
"os"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -10,7 +11,6 @@ import (

// LoadSourceDetails - Load Source VM details from ova
func (r *OvaClient) LoadSourceDetails() (vm *OvaVM, err error) {
r.storageClass = DefaultStorageClass
if sc := os.Getenv("STORAGE_CLASS"); sc != "" {
r.storageClass = sc
} else {
Expand All @@ -29,16 +29,21 @@ func (r *OvaClient) GetNfsServerForOva(k8sClient *kubernetes.Clientset) (string,
return "", err
}
var nfsShare string
var server, share string
for parm, val := range storageClass.Parameters {
if parm == "server" {
nfsShare = val
server = val
}
if parm == "share" {
nfsShare = nfsShare + ":" + val
share = val
}
}
nfsShare = server + ":" + share

if nfsShare != "" {
r.nfsPath = nfsShare
} else {
return "", errors.New("failed to fatch NFS settings")
}
return r.nfsPath, nil
}
Expand Down
7 changes: 4 additions & 3 deletions tests/suit/utils/storagemap.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ func NewStorageMap(namespace string, providerIdentifier forkliftv1.Provider, sto
},
}

if providerIdentifier.Type() != api.Ova {
pair.Source = ref.Ref{ID: sd}
} else {
switch providerIdentifier.Type() {
case api.Ova:
pair.Source = ref.Ref{Name: sd}
default:
pair.Source = ref.Ref{ID: sd}
}

sdPairs = append(sdPairs, pair)
Expand Down

0 comments on commit d6ffb99

Please sign in to comment.