Select sync method by provider

Is any reliable method available for including a conditional in a Vagrantfile to select method of folder syncing based on provider?

Presently, I have included the following line:

config.vm.synced_folder "proj", "/srv", type: "9p", accessmode: "mapped"

However, the following represent a few possible improvements:

  1. Use type “9p” only if the provider is libvirt, otherwise use some other, particular method.
  2. As above, but use whatever method is default for the provider, if the provider is not libvirt.
  3. As above, but test not whether the provider is libvirt, but simply whether support is available for the type “9p”.
  4. Select a method globally, rather than as the type parameter, for all separate invocations of synced_folder.
  5. Apply also conditionally the value for accessmode, based on one of the tests given above.

I am interested in recipes for making the Vagrantfile more robust and portable, through any of the above suggestions that may be feasible, given the capabilities of the tools. Of course, it is no small obstacle that I have no experience in Ruby.