func (p *nasDatastoreMountProcessor) processMountOperations() (*object.Datastore, error) {
	hosts := p.diffNewOld()
	if len(hosts) < 1 {
		// Nothing to do
		return p.ds, nil
	}
	// Validate we are vCenter if we are working with multiple hosts
	if len(hosts) > 1 {
		if err := viapi.ValidateVirtualCenter(p.client); err != nil {
			return p.ds, fmt.Errorf("cannot mount on multiple hosts: %s", err)
		}
	}
	for _, hsID := range hosts {
		dss, err := hostDatastoreSystemFromHostSystemID(p.client, hsID)
		if err != nil {
			return p.ds, fmt.Errorf("host %q: %s", hostsystem.NameOrID(p.client, hsID), err)
		}
		ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
		defer cancel()
		ds, err := dss.CreateNasDatastore(ctx, *p.volSpec)
		if err != nil {
			return p.ds, fmt.Errorf("host %q: %s", hostsystem.NameOrID(p.client, hsID), err)
		}
		if err := p.validateDatastore(ds); err != nil {
			return p.ds, fmt.Errorf("datastore validation error on host %q: %s", hostsystem.NameOrID(p.client, hsID), err)
		}
	}
	return p.ds, nil
}
func (p *nasDatastoreMountProcessor) processMountOperations() (*object.Datastore, error) {
	hosts := p.diffNewOld()
	if len(hosts) < 1 {
		
		return p.ds, nil
	}
	
	if len(hosts) > 1 {
		if err := viapi.ValidateVirtualCenter(p.client); err != nil {
			return p.ds, fmt.Errorf("cannot mount on multiple hosts: %s", err)
		}
	}
	for _, hsID := range hosts {
		dss, err := hostDatastoreSystemFromHostSystemID(p.client, hsID)
		if err != nil {
			return p.ds, fmt.Errorf("host %q: %s", hostsystem.NameOrID(p.client, hsID), err)
		}
		ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
		defer cancel()
		ds, err := dss.CreateNasDatastore(ctx, *p.volSpec)
		if err != nil {
			return p.ds, fmt.Errorf("host %q: %s", hostsystem.NameOrID(p.client, hsID), err)
		}
		if err := p.validateDatastore(ds); err != nil {
			return p.ds, fmt.Errorf("datastore validation error on host %q: %s", hostsystem.NameOrID(p.client, hsID), err)
		}
	}
	return p.ds, nil
}
func ( p * nasDatastoreMountProcessor ) processMountOperations ( ) ( * object . Datastore , error ) { hosts := p . diffNewOld ( ) if len ( hosts ) < 1 { // Nothing to do return p . ds , nil } // Validate we are vCenter if we are working with multiple hosts if len ( hosts ) > 1 { if err := viapi . ValidateVirtualCenter ( p . client ) ; err != nil { return p . ds , fmt . Errorf ( " " , err ) } } for _ , hsID := range hosts { dss , err := hostDatastoreSystemFromHostSystemID ( p . client , hsID ) if err != nil { return p . ds , fmt . Errorf ( " " , hostsystem . NameOrID ( p . client , hsID ) , err ) } ctx , cancel := context . WithTimeout ( context . Background ( ) , defaultAPITimeout ) defer cancel ( ) ds , err := dss . CreateNasDatastore ( ctx , * p . volSpec ) if err != nil { return p . ds , fmt . Errorf ( " " , hostsystem . NameOrID ( p . client , hsID ) , err ) } if err := p . validateDatastore ( ds ) ; err != nil { return p . ds , fmt . Errorf ( " " , hostsystem . NameOrID ( p . client , hsID ) , err ) } } return p . ds , nil }
// processMountOperations processes all pending mount operations by diffing old
// and new and adding any hosts that were not found in old. The datastore is
// returned, along with any error.
processMountOperations processes all pending mount operations by diffing old and new and adding any hosts that were not found in old . The datastore is returned along with any error .