diff --git a/pkg/controller/provider/web/ovirt/base.go b/pkg/controller/provider/web/ovirt/base.go index bb19d95bb..81e42dead 100644 --- a/pkg/controller/provider/web/ovirt/base.go +++ b/pkg/controller/provider/web/ovirt/base.go @@ -65,26 +65,26 @@ func (r *PathBuilder) Path(m model.Model) (path string) { if r.cache == nil { r.cache = map[string]string{} } - switch m.(type) { + switch obj := m.(type) { case *model.DataCenter: - path = m.(*model.DataCenter).Name + path = obj.Name case *model.Cluster: - object := m.(*model.Cluster) + object := obj path, err = r.forDataCenter(object.DataCenter, object.Name) case *model.ServerCpu: - object := m.(*model.ServerCpu) + object := obj path, err = r.forDataCenter(object.DataCenter, object.Name) case *model.Network: - object := m.(*model.Network) + object := obj path, err = r.forDataCenter(object.DataCenter, object.Name) case *model.StorageDomain: - object := m.(*model.StorageDomain) + object := obj path, err = r.forDataCenter(object.DataCenter, object.Name) case *model.Host: - object := m.(*model.Host) + object := obj path, err = r.forCluster(object.Cluster, object.Name) case *model.VM: - object := m.(*model.VM) + object := obj path, err = r.forCluster(object.Cluster, object.Name) } diff --git a/pkg/controller/provider/web/ovirt/client.go b/pkg/controller/provider/web/ovirt/client.go index f36f2acee..f3e0ce0e3 100644 --- a/pkg/controller/provider/web/ovirt/client.go +++ b/pkg/controller/provider/web/ovirt/client.go @@ -98,7 +98,7 @@ func (r *Finder) With(client base.Client) base.Finder { // NotFoundErr // RefNotUniqueErr func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { - switch resource.(type) { + switch res := resource.(type) { case *Network: id := ref.ID if id != "" { @@ -129,7 +129,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { err = liberr.Wrap(RefNotUniqueError{Ref: ref}) break } - *resource.(*Network) = list[0] + *res = list[0] } case *StorageDomain: id := ref.ID @@ -161,7 +161,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { err = liberr.Wrap(RefNotUniqueError{Ref: ref}) break } - *resource.(*StorageDomain) = list[0] + *res = list[0] } case *Host: id := ref.ID @@ -193,7 +193,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { err = liberr.Wrap(RefNotUniqueError{Ref: ref}) break } - *resource.(*Host) = list[0] + *res = list[0] } case *VM: id := ref.ID @@ -225,7 +225,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { err = liberr.Wrap(RefNotUniqueError{Ref: ref}) break } - *resource.(*VM) = list[0] + *res = list[0] } case *Cluster: id := ref.ID @@ -257,7 +257,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { err = liberr.Wrap(RefNotUniqueError{Ref: ref}) break } - *resource.(*Cluster) = list[0] + *res = list[0] } case *ServerCpu: id := ref.ID @@ -289,7 +289,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { err = liberr.Wrap(RefNotUniqueError{Ref: ref}) break } - *resource.(*ServerCpu) = list[0] + *res = list[0] } case *Workload: id := ref.ID @@ -321,7 +321,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) { err = liberr.Wrap(RefNotUniqueError{Ref: ref}) break } - *resource.(*Workload) = list[0] + *res = list[0] } default: err = liberr.Wrap(