code: func registerPod(root string, uuid *types.UUID, apps schema.AppList) (token string, rerr error) {
  	u := uuid.String()
  
  	var err error
  	token, err = generateMDSToken()
  	if err != nil {
  		rerr = errwrap.Wrap(errors.New("failed to generate MDS token"), err)
  		return
  	}
  
  	pmfPath := common.PodManifestPath(root)
  	pmf, err := os.Open(pmfPath)
  	if err != nil {
  		rerr = errwrap.Wrap(fmt.Errorf("failed to open runtime manifest (%v)", pmfPath), err)
  		return
  	}
  
  	pth := fmt.Sprintf("/pods/%v?token=%v", u, token)
  	err = httpRequest("PUT", pth, pmf)
  	pmf.Close()
  	if err != nil {
  		rerr = errwrap.Wrap(errors.New("failed to register pod with metadata svc"), err)
  		return
  	}
  
  	defer func() {
  		if rerr != nil {
  			unregisterPod(root, uuid)
  		}
  	}()
  
  	rf, err := os.Create(filepath.Join(root, mdsRegisteredFile))
  	if err != nil {
  		rerr = errwrap.Wrap(errors.New("failed to create mds-register file"), err)
  		return
  	}
  	rf.Close()
  
  	for _, app := range apps {
  		ampath := common.ImageManifestPath(root, app.Name)
  		amf, err := os.Open(ampath)
  		if err != nil {
  			rerr = errwrap.Wrap(fmt.Errorf("failed reading app manifest %q", ampath), err)
  			return
  		}
  
  		err = registerApp(u, app.Name.String(), amf)
  		amf.Close()
  		if err != nil {
  			rerr = errwrap.Wrap(errors.New("failed to register app with metadata svc"), err)
  			return
  		}
  	}
  
  	return
  }
docs: // registerPod registers pod with metadata service.
  // Returns authentication token to be passed in the URL