code: func (m *ManagerImpl) Register(ctx context.Context, r *pluginapi.RegisterRequest) (*pluginapi.Empty, error) {
  	klog.Infof("Got registration request from device plugin with resource name %q", r.ResourceName)
  	metrics.DevicePluginRegistrationCount.WithLabelValues(r.ResourceName).Inc()
  	metrics.DeprecatedDevicePluginRegistrationCount.WithLabelValues(r.ResourceName).Inc()
  	var versionCompatible bool
  	for _, v := range pluginapi.SupportedVersions {
  		if r.Version == v {
  			versionCompatible = true
  			break
  		}
  	}
  	if !versionCompatible {
  		errorString := fmt.Sprintf(errUnsupportedVersion, r.Version, pluginapi.SupportedVersions)
  		klog.Infof("Bad registration request from device plugin with resource name %q: %s", r.ResourceName, errorString)
  		return &pluginapi.Empty{}, fmt.Errorf(errorString)
  	}
  
  	if !v1helper.IsExtendedResourceName(v1.ResourceName(r.ResourceName)) {
  		errorString := fmt.Sprintf(errInvalidResourceName, r.ResourceName)
  		klog.Infof("Bad registration request from device plugin: %s", errorString)
  		return &pluginapi.Empty{}, fmt.Errorf(errorString)
  	}
  
  	// TODO: for now, always accepts newest device plugin. Later may consider to
  	// add some policies here, e.g., verify whether an old device plugin with the
  	// same resource name is still alive to determine whether we want to accept
  	// the new registration.
  	go m.addEndpoint(r)
  
  	return &pluginapi.Empty{}, nil
  }
docs: // Register registers a device plugin.