Allow Automate to modify raw clone options sent to providers during provisioning


During provisioning users are prompted to make several selections about various things like environment, tagging, customization, etc. of their requested VM. Admins can limit the things that the users are allowed to select by modifying the provisioning dialogs. Admins can also use Automate to change selections made by the users or fill in empty fields. Then the provision task invokes the internal state machine to run the provision. The internal state machine translates everything from user friendly or ManageIQ values to raw values familiar to the provider and assembles a hash known as :clone_options. This :clone_options was never exposed in order to protect admins from inserting values that could cause provisioning errors and to help in converting data from ManageIQ values to raw provider values.

With more providers being added and all of them changing implementations at their own rates we began to realize that we can not keep up with all of the provisioning features that customers may need in a timely fashion.

With the request of another accessible parameter to send to the provider during a provision (Bugzilla: Adding a block device to an Openstack instance provision) and much discussion around the subject, I made a Pull Request to allow automate to modify the :clone_options hash before it is sent to the provider. Now admins can set the :clone_options in the Automate state machine. Once the provision job is handed off to the internal state machine, it will create its default :clone_options hash as it did before. The default hash will be logged, then the :clone_options from Automate will be merged on top and the result will be logged and sent to the provider.

Good… This change allows admins to use features of the provider before they have been fully modeled in the ManageIQ code base.
Limitations… The version of the provider driver (aws-sdk for Amazon, fog for Openstack, etc.) currently used by ManageIQ must support the desired parameters.
With great power comes great responsibility… This also allows the admins to modify the :clone_options hash in a way that is invalid to the provider causing provisioning failures that may be hard to diagnose.

Example: (in PreProvision automate method)

prov = $evm.root["miq_provision"]
  {:block_device_mapping => [
      :volume_id   => "d48a4292-5a90-4809-bde4-f1f7345a2919",
      :device_name => "/dev/sdb"
    }, {
      :volume_id   => "e7bc5bf5-dd1d-4060-8033-a2097c79ec12",
      :device_name => "/dev/sdc"

Using Cinder volumes for instance deployments with OpenStack Cloud Provider