Creating a dynamic service dialogue to list vm' associated to particular user

Hi Team,

I am looking for used case where we will present dynamic drop down list for end user which list all the available vm’s of that particular user and once user selects the vm he should be provided with the option adding disk,cpu and memory.

Has anyone tried achieving this kind of feature if so can someone please throw some light on how can this be achieved.

Hi @Ravikanth_B
I think that you should create VM button instead of Service dialog for this task. In this way users can go to VMs presentation and click on the vm related button to do infra related tasks such as add cpu, memory, disks:

Buttons can be created from Automation -> Customization section:

And all methods that attached to this buttons receive $evm.root[‘vm’] object that can be used for management tasks.

Hi igortiunov,

Thanks a lot for the reply and apologies as i am newbie to manageIQ, have couple of questions in this regard,
The Task i am planing to achieve,
1)user logs in manageiq/self_service portal clicks on linux services catalogue and the vm’s gets provisioned.
2)Now user wants to add the cpu, memory and disk to already provisioned vm’s from self_service portal, He logs into the selfservice portal …Next what actions i should be performing which would allow the user to easily select the vm and makes necessary changes like adding cpu,memory and disk, from the self service portal only.

If i am logging into manageiq main console i am easily able to see the reconfiguration option under configuration to perform these tasks but not able to find a way to do it from self service portal

Solution may depend on your environment:

  1. What version of MIQ do you use?
  2. What provider managed by MIQ? (vsphere, rhev or any cloud?)
  1. What version of MIQ do you use?
  2. What provider managed by MIQ? (vsphere, rhev or any cloud?)

In the euwe release Self-Service UI is under development and It has many drawbacks. For this reason I do not use it as you can see from screenshots. If you correctly configure user roles you can make an acceptable interface for end users from Classic UI. I did it this way. From the user are hidden administrative elements of interface by user role checkboxes:

May be from last Fine release there is some changes but I do not test it. I’ve seen some changes in pull-requests like this:

But if you cannot migrate to Fine and prefer to use Self-Service UI you can follow these workflows:

First you can create a button for service and this button can start service dialog that can start your automation method to change the machine parameters.

More about service dialog:

More about buttons:

Second you can create generic service that does not related to any provider and us your service dialog to do customization of VMs.

Both Your service dialogs will use a method to retrieve a list of virtual machines within the service. This is a simple task and in the dialog designer you just create a dynamic drop-down list. Your automation method (ruby script) gets the identifier of the virtual machine and perform changes to CPU and memory. The new values will be parameters passed in the same dialogue.

RedHat documentation does not throw light on how things done but you can read excelent book that will answer all your questions:

Hi @Ravikanth_B

How about your task ? Did my answers help you?

Hi Igor,

Thanks a lot for the info and yes i am already going through documentation
and trying to grasp things as much as i can, I am using manageiq Euwe
version and the infrastructure provider is VMware. I have been thrown a
task of getting this done ASAP for which i am trying hard from all sources
but having some issues in stiching peices together. I have imported methods
of adding cpu,memory and disk. But when i a trying to create a general
service catalogue what should be the entry points. Here i am attaching the
screen shots. How Would i add the methods in service catalogue. If i am
adding all three entry points then my requests are in pending state. Can
you please help in pointing to the direction of setting up catalogue item
to get the task done. If possible can we have a screen sharing session i
can explain much better.

I’ll try to implement your task in a test environment and then to help you.

Thanks a lot Igor really appreciate your help in this regards.


For your “pending” error there is example of creating generic service:

As you can see you should create your own copy of statemacine “serviceprovision_template” and comment out states that used for init service_template because generic service does not have service template for any provider. The pre5 state from example can be your method that changes vm parameters.
After creating copy of statemacine you can put it as provisioning entry point for generic service.
Don’t forget to look at the log/evm.log at the moment when monitoring the execution of requests. There will be ERROR messages associated with your statemacine.

I have done exactly what it says in the doc but still my service cataloge
is in pending state only. were you able to replicate the same in your lab

Hi Igor,

Now its getting errored out which is a gud sighn and getting below error
message due to setting up of vm environment, i am passing to variables from
dialog vm and ram,

vm = $evm.root[‘dialog_vm’]
raise “Missing $evm.root[‘vm’] object” unless vm

Get amount of ram from root

ram = $evm.root[‘dialog_ram’].to_i
$evm.log(“info”, “Detected ram:<#{ram}>”)

$evm.log(“info”, “Setting amount of vRAM to #{ram} on VM:<#{}>”)
vm.set_memory(ram, :sync => true)

[----] I, [2017-06-24T14:37:24.880696 #15103:d4d140] INFO – :
Q-task_id([service_template_provision_task_87]) Invoking [inline] method
[/ACME/sntegration/VMware/vCenter/AddRAM_to_VM] with inputs [{}]

[----] I, [2017-06-24T14:37:24.881970 #15103:d4d140] INFO – :
Q-task_id([service_template_provision_task_87]) <AEMethod
[/ACME/sntegration/VMware/vCenter/AddRAM_to_VM]> Starting

[----] I, [2017-06-24T14:37:25.383813 #15103:53b3c9c] INFO – :
Detected ram:<6>

[----] E, [2017-06-24T14:37:25.384856 #15103:53b3c9c] ERROR – :
Q-task_id([service_template_provision_task_87]) The
following error occurred during method evaluation:

[----] E, [2017-06-24T14:37:25.389034 #15103:53b3c9c] ERROR – :
NoMethodError: undefined method `name’ for “Crucible_Server”:String

[----] E, [2017-06-24T14:37:25.390726 #15103:53b3c9c] ERROR – :

[----] E, [2017-06-24T14:37:25.396920 #15103:53b3c9c] ERROR – :
Q-task_id([service_template_provision_task_87]) Method STDERR: <code:
$evm.log(“info”, “Setting amount of vRAM to #{ram} on VM:<#{}>”)>:17:in
<main>': undefined methodname’ for “Crucible_Server”:String

[----] I, [2017-06-24T14:37:25.419364 #15103:d4d140] INFO – :
Q-task_id([service_template_provision_task_87]) <AEMethod
[/ACME/sntegration/VMware/vCenter/AddRAM_to_VM]> Ending

If I am able to set the vm = $evm.root[‘vm’] environment by this method
then i think my problem is resolved…

Hi Igor,

I was finally able to get that working using “vm =
$evm.vmdb(‘vm’).find_by_name(‘dialog_vm’)”. Thanks a lot for support
without which i dont think would have been able to get this going. The only
thing that is pending is to create a dynamic drop down list of vm’s
belonging to the tags of the specific user who is running the catalogue any
inputs. Again thanks for ur support.