func verifyVAppCdromIso(d *schema.ResourceData, device *types.VirtualCdrom, l object.VirtualDeviceList, c *govmomi.Client) (bool, error) {
	log.Printf("[DEBUG] IsVAppCdrom: Checking if CDROM is using a vApp ISO")
	// If the CDROM is using VirtualCdromIsoBackingInfo and matches the ISO
	// naming pattern, it has been used as a vApp CDROM, and we can move on to
	// checking if the parent VM supports ISO transport.
	if backing, ok := device.Backing.(*types.VirtualCdromIsoBackingInfo); ok {
		dp := &object.DatastorePath{}
		if ok := dp.FromString(backing.FileName); !ok {
			// If the ISO path can not be read, we can't tell if a vApp ISO is
			// connected.
			log.Printf("[DEBUG] IsVAppCdrom: Cannot read ISO path, cannot determine if CDROM is used for vApp")
			return false, nil
		}
		// The pattern used for vApp ISO naming is
		// "<vmname>/_ovfenv-<vmname>.iso"
		re := regexp.MustCompile(".*/_ovfenv-.*.iso")
		if !re.MatchString(dp.Path) {
			log.Printf("[DEBUG] IsVAppCdrom: ISO is name does not match vApp ISO naming pattern (<vmname>/_ovfenv-<vmname>.iso): %s", dp.Path)
			return false, nil
		}
	} else {
		// vApp CDROMs must be backed by an ISO.
		log.Printf("[DEBUG] IsVAppCdrom: CDROM is not backed by an ISO")
		return false, nil
	}
	log.Printf("[DEBUG] IsVAppCdrom: CDROM has a vApp ISO inserted")
	// Set the vApp transport methods
	tm := d.Get("vapp_transport").([]interface{})
	for _, t := range tm {
		if t.(string) == "iso" {
			log.Printf("[DEBUG] IsVAppCdrom: vApp ISO transport is supported")
			return true, nil
		}
	}
	log.Printf("[DEBUG] IsVAppCdrom: vApp ISO transport is not required")
	return false, nil
}
func verifyVAppCdromIso(d *schema.ResourceData, device *types.VirtualCdrom, l object.VirtualDeviceList, c *govmomi.Client) (bool, error) {
	log.Printf("[DEBUG] IsVAppCdrom: Checking if CDROM is using a vApp ISO")
	// If the CDROM is using VirtualCdromIsoBackingInfo and matches the ISO
	// naming pattern, it has been used as a vApp CDROM, and we can move on to
	// checking if the parent VM supports ISO transport.
	if backing, ok := device.Backing.(*types.VirtualCdromIsoBackingInfo); ok {
		dp := &object.DatastorePath{}
		if ok := dp.FromString(backing.FileName); !ok {
			// If the ISO path can not be read, we can't tell if a vApp ISO is
			// connected.
			log.Printf("[DEBUG] IsVAppCdrom: Cannot read ISO path, cannot determine if CDROM is used for vApp")
			return false, nil
		}
		// The pattern used for vApp ISO naming is
		// "<vmname>/_ovfenv-<vmname>.iso"
		re := regexp.MustCompile(".*/_ovfenv-.*.iso")
		if !re.MatchString(dp.Path) {
			log.Printf("[DEBUG] IsVAppCdrom: ISO is name does not match vApp ISO naming pattern (<vmname>/_ovfenv-<vmname>.iso): %s", dp.Path)
			return false, nil
		}
	} else {
		// vApp CDROMs must be backed by an ISO.
		log.Printf("[DEBUG] IsVAppCdrom: CDROM is not backed by an ISO")
		return false, nil
	}
	log.Printf("[DEBUG] IsVAppCdrom: CDROM has a vApp ISO inserted")
	// Set the vApp transport methods
	tm := d.Get("vapp_transport").([]interface{})
	for _, t := range tm {
		if t.(string) == "iso" {
			log.Printf("[DEBUG] IsVAppCdrom: vApp ISO transport is supported")
			return true, nil
		}
	}
	log.Printf("[DEBUG] IsVAppCdrom: vApp ISO transport is not required")
	return false, nil
}
// verifyVAppCdromIso takes VirtualCdrom and determines if it is needed for
// vApp ISO transport. It does this by first checking if it has an ISO inserted
// that matches the vApp ISO naming pattern. If it does, then the next step is
// to see if vApp ISO transport is supported on the VM. If both of those
// conditions are met, then the CDROM is considered in use for vApp transport.