Get tag info in ConfigureChildDialog


#1

Hi,

I am using the out-of-box ConfigureChildDialog. In my service dialog I have created the element with following information:

  • Label: Application Type
  • Name: tag_1_app_tier

However when I attempt to provision the vm sung service catalog, I encountered a ‘no method’ error when executing the following codes in ConfigureChildDialog:

stp_miq_request_tasks = stp_task.miq_request_tasks
stp_miq_request_tasks.each do | t |
service = t.source
service_resource = t.service_resource
service_tag_array = service.tags(:app_tier) ### where caused error!

end

May someone who tried this before give me some pointers on where I have make a mistake? Thanks.

Regards,
Casius.


#2

@gmccullough can you review this question from @casius and froward to a SME if necessary.


#3

@tinaafitz Can you please take a look at this issue? Thanks.


#4

Hi @casius,

The ConfigureChildDialog automate method is an old example of how information can be passed around and was written before we had the catalogiteminitialization and catalogbundleinitialization methods.
I don’t think the method is useful in its current state and will work on getting it updated.

The catalog* methods were designed to allow you to set values, options and tags by using a combination of naming(options and tags) and numbering(global vs item specific) to set up the dialog attributes.

I see that you have another talk topic regarding vm naming that @mkanoor was discussing with you.
I’d be happy to help you get your services working properly. Could you explain more about your service use case?

Here’s a great resource for automate information:
https://pemcg.gitbooks.io/introduction-to-cloudforms-automation/content/chapter17/working_with_services.html

Regards,
Tina


#5

Hi @tinaafitz,

I am creating a simple service dialog to provision a simple VM by specifying:

  1. VM name,
  2. type of server (e.g. application server, database server, etc.)
  3. VM size (large, medium, small)
  4. Number of disk to be added
  • disk size
  • LVM or PVM

I originally intend to wired the logic to derive VM memory size and number of cores in ChildDialog, similar to the original sample code provided. However, I am not able t extract the tag information from the dialog (say if I set vm size name as tag_1_app_tier). I understood that tags upon created will not be stored as part of miq_provision_tasks but reference to tags via ‘:vm_tags’, e.g. in tags table, the tags are stored as:
/managed/app_tier
/managed/app_tier/small

As vm is not yet created at that point, I am wondering how can I get the tag information that as selected from service dialog. Thanks.

Cheers,
Casius.


#6

Hi Casius

I’m not sure that setting a tag to specify VM size makes sense - the tag would be visible once the VM has been created, but by then it would have been sized anyway. I’d suggest that maybe text boxes as dialog elements might be better.

The best examples of achieving what you’re trying to do are in Kevin Morey’s CloudFormsPOC code collection here: https://github.com/ramrexx/CloudFormsPOC/tree/master/Automate/CloudFormsPOC/Service/Provisioning/StateMachines. Kevin has several custom service provisioning state machines that handle ‘T-shirt’ sizing of VMs. There’s an example of importing some of his code and modifying it here: https://pemcg.gitbooks.io/introduction-to-cloudforms-automation/content/chapter17/custom_state_machines.html

I notice that you want to prompt for type of server in the service dialog. How were you thinking of implementing this - using a configuration management tool such as Puppet?

pemcg


#7

Hi @pemcg,

Thanks for your response. Yes, I intend to use Puppet for middleware deployment.

Cheers,
Casius.


#8

Hi @pemcg,

I am trying to create different VM sizes (#cores and VM memory) by creating different VMware templates (though I am using PXE to provision new VMs). I am hoping that users could “order” via Services->Catalogs a VM with predefined #cores and memory to allocate to the new VM.

However, I am encountering a peculiar behaviour when I tried to provision via this route, for some reasons my VM always was just allocated with 1GB memory. Its seem to me that I have missed some important setup for service catalogue. Thanks.

Regards,
Casius.