Post describes a way to attach additional disk to RHV VM using button.
Just to get my hands dirty on ManageIQ’s Automate model, I started working on a way to attach additional disk to VM running on Red Hat Virtualization. Although it can be easily done by “Reconfigure this VM”, I wanted a way to do this via Automate. I did found two ways to do this, one described in Mastering Automation in CloudForms & ManageIQ and other here. Both uses ReST APIs to achieve the task but then I came across this Pull Request which made the job quite easy.
I have created a domain – AutomateMIQ which has a custom method
add_disk. It is called by instance
has everything you need to attach new disk to VM including
notifications and email.
Now datastores can be managed by git as seen below. Enter git repository URL with valid credentials and click submit button.
One also needs to create a service dialog which prompts for disk
size and disk provisioning type. These fields are then
add_disk. The disk is then attached based on user
defined parameters. I have imported Add disk service dialog in
form of yaml for reference.
Finally we need a button to call instance
hot_add_disk. A button
request type “AddDisk” from
/System/Process/ as seen
below. Please find button in form of yaml here.
A button will be visible under ’Actions’ dropdown on VM’s summary page as below.
Once the disk is attached, user will be notified.
Finally, an additional disk will be attached to VM.
Note that the feature work on euwe release of ManageIQ. If not already done, please upgrade ManageIQ version following below steps.
1: ssh root@<ManageIQ Appliance> 2: vmdb 3: git fetch --all 4: git checkout euwe-2 5: git checkout -b euwe-2 6: bundle install # or bin/install 7: bundle exec rake evm:compile_assets 8: bundle exec rake evm:restart