github.com/openshift/installer@v1.4.17/pkg/asset/installconfig/ovirt/datacenter.go (about) 1 package ovirt 2 3 import ( 4 ovirtsdk4 "github.com/ovirt/go-ovirt" 5 "github.com/pkg/errors" 6 "github.com/sirupsen/logrus" 7 ) 8 9 // datacentersAvailable looks for all datacenters available in the system based on searchFilter. 10 // If search filter not provided, the default filter will be "status=up" 11 // Returns type: *ovirtsdk.DataCentersServiceListResponse 12 func datacentersAvailable(conn *ovirtsdk4.Connection, searchFilter string) (*ovirtsdk4.DataCentersServiceListResponse, error) { 13 if searchFilter == "" { 14 searchFilter = "status=up" 15 } 16 dcService := conn.SystemService().DataCentersService() 17 18 logrus.Debugf("searching for DataCenters with search filter: %s", searchFilter) 19 dcResp, err := dcService.List().Search(searchFilter).Send() 20 if err != nil { 21 return nil, errors.Wrapf(err, "failed to search available DataCenters") 22 } 23 24 return dcResp, nil 25 }