code: func (t *RackKVMsTable) computeChanges(c context.Context, datacenters []*config.Datacenter) error {
  	cfgs := make(map[string]*RackKVM, len(datacenters))
  	for _, dc := range datacenters {
  		for _, cfg := range dc.Rack {
  			cfgs[cfg.Name] = &RackKVM{
  				Rack: config.Rack{
  					Name: cfg.Name,
  				},
  			}
  			if cfg.Kvm != "" {
  				id, ok := t.kvms[cfg.Kvm]
  				if !ok {
  					return errors.Reason("failed to determine KVM ID for rack %q: KVM %q does not exist", cfg.Name, cfg.Kvm).Err()
  				}
  				cfgs[cfg.Name].KVMId.Int64 = id
  				cfgs[cfg.Name].KVMId.Valid = true
  			}
  		}
  	}
  
  	for _, rack := range t.current {
  		if cfg, ok := cfgs[rack.Name]; ok {
  			// Rack found in the config.
  			if t.needsUpdate(rack, cfg) {
  				// Rack doesn't match the config.
  				cfg.Id = rack.Id
  				t.updates = append(t.updates, cfg)
  			}
  			// Record that the rack config has been seen.
  			delete(cfgs, cfg.Name)
  		}
  	}
  	return nil
  }
docs: // computeChanges computes the changes that need to be made to the rack kvm_ids in the database.