VMware Cloud Community
DLally
Enthusiast
Enthusiast
Jump to solution

How to update vCAC VM name from BuildingMachine workflow

I have a custom workflow to name my VM and I can pull everything correctly and get the VM name to generate all through the BuildingMachine stub workflow, but my issue at this point is updating the vCAC VM to the new name.  Can anybody point me in the right direction on this? 

1 Solution

Accepted Solutions
stvkpln
Virtuoso
Virtuoso
Jump to solution

I'll make this easier.. just cobbled together a quick workflow... I didn't get a chance to Q/A whether it actually works properly, but I'm 99% sure it should work as advertised.

-Steve

View solution in original post

0 Kudos
12 Replies
stvkpln
Virtuoso
Virtuoso
Jump to solution

Take a look at my response in this thread (assuming you already have the correct name to update the vCAC entity with): Help with vCAC extensibility and vCO

-Steve
0 Kudos
DLally
Enthusiast
Enthusiast
Jump to solution

Ok I think i've seen that before.   Seems cumbersome to do :smileysilly:   The custom property hostname is required to do this?    Do you have a sample scipt I could possibly look at?  It's always easier to see for me.

0 Kudos
zebduin
Enthusiast
Enthusiast
Jump to solution

Have you looked at the Custom Hostname extension workflow that Tom Bonanno posted at:

http://dailyhypervisor.com/vcloud-automation-center-vcac-5-2-custom-hostnaming-extension/

I have deployed this at a customer site when the machine prefix and hostname custom property didn't satisfy the use case.  It sets the vc and vcac virtual machine names correctly and most of the name was autogenerated based on custom properties that served as part of the overall name through custom properties associated with compute resources (for location character(s)) and blueprint  (for OS name or version characters).

0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

It's really not that bad... one scriptable task (or an action, if you don't want people mucking in the code once it's stable) and a workflow element with two input values. I integrated the bit into my production environment in about 2 minutes once I had necessary steps in place.

Unfortunately, I'd have to write a separate workflow to handle this, as it's actually integrated into a different workflow that has some institutional things in there that I can't export. If I get some time, I'll whip something together, but as long as you have the entity and the name you want, this shouldn't take more than a minute or two to bake in!

-Steve
DLally
Enthusiast
Enthusiast
Jump to solution

Ok just so I understand this correctly.  Sorry I'm taking this all in as I go, so I'm still learning. 

1.  Create a custom property named hostname on a blueprint, with no value

2.  Then update the hostname property in my case with the value of the new name using the addUpdatePropertyFromVirtualMachineEntity action.

Inputs look like this. The property name is hostname and the value will pull from resultVMName in my script.

naming1.JPG

3.  Create a scriptable task that takes the input of the hostname, which in turn should have the value of my resultVMName

The scriptable task would read:

newName = { "VirtualMachineName":hostname  }

4.  embed the Update a vCAC model entity workflow and bring in vCAC Entity and the property(hostname right?)

I can link the entity, but i'm not sure about the property part?

naming2.JPG

Thanks for all the suggestions and help so far. 

0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

If you aren't requiring the user to specify at request time, you don't need to create the hostname value... running the addUpdatePropertyFromVirtualMachineEntity action will automatically create the value if it doesn't exist on the entity (read: you can skip that in the prereq). I require a name on the request as part of how we validate, so I already have a pre-existing value by the time BuildingMachine starts. At step 3, the value of newName needs to be an attribute of the workflow that's a type of properties. Then, you bring in both the vCAC Entity and the Properties attribute. It looks like this:


pastedImage_4.png

What you set in the scriptable task must include the attribute value of type Properties.

-Steve
0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

I'll make this easier.. just cobbled together a quick workflow... I didn't get a chance to Q/A whether it actually works properly, but I'm 99% sure it should work as advertised.

-Steve
0 Kudos
DLally
Enthusiast
Enthusiast
Jump to solution

Thank you so much, that helps me out seeing it.  I was getting a bit confused trying to understand it.  I took your example and already made it work in my workflow.   Thank you so much!

0 Kudos
DLally
Enthusiast
Enthusiast
Jump to solution

On a side note, is there some sort of documentation that you read to get the info you needed to do this type of change?  I haven't seen anything like this, so if so I'd love to read it Smiley Happy

One thing I'd like to do similar to this would be to update the VirtualMachine.Network0.Name value as well during building, I saw you used "PropHostNamename" as the property name, how does that correlate back to vCAC?  What would I call the network name?

0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

This specific one? I had some help from oKushmaro (via twitter, naturally) to get something else working.. which led me to think about how to deal with another problem I had (ensuring server name case is always lower case for objects). Once I realized it was just a property update, and I understand what the mechanism to update that property was (thanks, Omer!), it was just a matter of integrating into the workflow where I wanted it to happen. Nothing complicated.

On a larger scale, it's just a matter of working with vCO and learning how the values are getting brought back from wherever they are... the vSphere API is kind of... strange.. so, between that, and having to learn what the best way to do things were in JavaScript, it's been a lot of experimenting. The workflows and scripting logic I'm using now is light years ahead of where it was 6 months ago when I was still getting my footing.

-Steve
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

I wrote a blog just Yesterday on how to do the custom naming. You would do the exact same thing for the network name you are referring to. I actually reference that at the very end.

https://ouchris.wordpress.com/2014/08/15/vcac-6-0-x-and-vco-to-rename-a-virtual-machine/

DLally
Enthusiast
Enthusiast
Jump to solution

Although I got it working, your blog looks very helpful for my exact situation.  Like you stated, it was hard to find something that didn't use powershell or vCO and not designer.  Your blog post looks very helpful!

0 Kudos