Exemplo n.º 1
0
// getDatastore gets datastore object
func getDatastore(f *find.Finder, ds string) (*object.Datastore, error) {

	if ds != "" {
		dso, err := f.Datastore(context.TODO(), ds)
		return dso, err
	} else {
		dso, err := f.DefaultDatastore(context.TODO())
		return dso, err
	}
}
Exemplo n.º 2
0
func (d *Driver) getDatastore(f *find.Finder, ctx context.Context) (dss *object.Datastore, err error) {

	// Datastore
	if d.Datastore != "" {
		// Find specified Datastore
		dss, err = f.Datastore(ctx, d.Datastore)
		if err != nil {
			return dss, err
		}
	} else {
		// Find default Datastore
		dss, err = f.DefaultDatastore(ctx)
		if err != nil {
			return dss, err
		}
	}
	log.Debug("Datastore found: ", dss)
	return dss, err
}