Modify properties of existing VM


#1

Can I automate the modification of RAM/CPU/Disk on the VMWare and OpenStack provider?
My goal is to provide a portal to the end user to automate the above task through self-service and avoid requests.
Thanks


#2

@gmccullough can you review this question from @gpaterno and forward to a SME if necessary.


#3

For VMware you have two possible options for exposing this:

  1. ManageIQ supports a reconfigure operation on VMware VMs that allows for modifying CPU and Memory values. We are currently working on a feature to add/remove disks there as well.

  2. From automate the VMware VM exposes methods for set_number_of_cpus, set_memory and add_disk

Those methods are defined here:
https://github.com/ManageIQ/manageiq/blob/master/lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-vmware-infra_manager-vm.rb#L3

For OpenStack it requires that you use the fog gem to interact with the provider to make these types of changes. There are some useful examples you can work from in this repo: https://github.com/ramrexx/CloudFormsPOC.
There are a lot of great examples here for both VMware, OpenStack and other providers.

For example: https://github.com/ramrexx/CloudFormsPOC/blob/master/Automate/CloudFormsPOC/Integration/RedHat/OpenStack/Nova.class/methods/resize_openstack_instance.rb#L1

I would also suggest checking out https://github.com/rhtconsulting which links to repos that contain a lot of the code you are looking for.

Mainly these two:


#4

How can I check if set_number_of_cpus() was successful? It returns true even if vCenter reports an unsuccesful reconfiguration (for example decreasing the number of CPUs). I tried with sync: true but no difference (on a 2 CPU VM):

> vm.set_number_of_cpus(1, :sync => true)
=> true

#5

I am trying to change CPU (VMware VM) when I try to change it changes CPU but not “cores per socket” count. Any suggestion/help is appreciated.


#6

I think it is not directly exposed in Automate…

ManageIQ can reconfigure the cores_per_socket-count on the UI, therefore you should be able to create a reconfiguration request in Automate and let ManageIQ execute it