VMware Cloud Community
sanshis
Enthusiast
Enthusiast

Set Custom Annotations while deploying VM

Hi All

I am using powercli cloneVM_Task for deploying vms and i have all my nut-bolts ready. I had seen many things around but couldn't find any thing to update custom annotation.
i know we can set Notes via "VirtualMachineConfigSpec" -> "annotation"..
but my goal is to set custom attributes  which are created globally for each object in vCenter
.


it is slow if i use "setCustomValue" after VM creation; even if i use "get-view with filter or -Id" instead of 'get-vm'..

I want to club this up in single task.

-----
i want to ask one more thing, why VM Cloning slows down when number of VMs in vCenter grows more thn 1000.
i deployed a new vCnter to compare these result - when i cloned a vm in new vCenter. it was taking 7sec to 13 sec to complete the cloning but in our old vcenter the task is completed in minutes while a vCenter with around 4500 VMs its taking ages to finish. The hardware (server, storage and network)  we are using is same everywhere.

--

Regards

Sanshis

0 Kudos
8 Replies
LucD
Leadership
Leadership

Have a look at the Set-Annotation cmdlet, it has a CustomAttribute parameter.

For your question on the cloning speed, there can be many reasons.

You could perhaps start by monitoring the components involved; the vCenter server, the vCenter database ....

Are any of these stressed for resources ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sanshis
Enthusiast
Enthusiast

Thanks luc for quick response;

set-annotation cmd-let is slower thn setCustomValue() method. And i want it to merge this in clonevm_task.
if i use set-Annotation it will set those up after creation of VM. (correct me if i am wrong)
As cloneVM_task method is capable of customizing VMs so just want to finish this thing at that task only.

we have lot of resources in terms of Cpu RAM and bandwidth; storage can handle IPOS but yes database may be a concern where we have to look at.

0 Kudos
LucD
Leadership
Leadership

That is correct, but so will setCustomValue().

And you will have the call that method also after the clone job has finished.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sanshis
Enthusiast
Enthusiast

Thats True!! Thanks Luc. It seems there is no other way :smileycry:

Hope we will have "Tags" with clonevm_task in upcoming releases.
actually i was finding out the fastest way to clone a VM from a single template with all the requirements we need like CPU;Memory, network portgroup changes based on the input csv we provide. In this one of my milestone was to add custom attributes where i am stuck at.

Question is still open if any one can help..

0 Kudos
LucD
Leadership
Leadership

But you should still be able to do that.

I assume you have an outer loop based on the content of the CSV file.

In the code block of that loop you call the cloneVM() method.

Just add a 2nd line that sets the custom attributes.

I don't think there is a faster way.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sanshis
Enthusiast
Enthusiast

That process will further slow down the script progress if i say this is bulk deployment script. (sry i didn't mentioned that earlier)
i don't know whether custom attributes can be set parallel while cloning; (i have to test that); otherwise i have to wait for finish the task and than add attributes. this will beat the purpose of parallel cloning.

if i do cloning first and use hash table for tracking the progress thn also i have to get the VM object, that's true this will be in same loop but actual time taking thing is getting the VM object.

0 Kudos
LucD
Leadership
Leadership

You could create/clone the new VM without powering it on, then set the custom attributes and then power the VM on (which will complete the sysprep process).


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

sanshis
Enthusiast
Enthusiast

Thanks that's helpful;
today I was thinking of multi-threading using get-job. just want to ask you before  i start..

that thing will help or not as cloning operation will take time and clonevm_task will anyways invoke its task.

but yes if i had to set custom attributes after clone job thn this will surely help.

0 Kudos