VMware Cloud Community
lokeshwari10
Contributor
Contributor

VM creation using content library failing

Hello Everyone,

I am trying to create a VM using templates stored in content library. We have automated to create 3 vm's in parallel referring to 3 different templates using powercli (command is noted below)

Get-ContentLibraryItem –Name ${args.templateName} | New-VM –Name ${args.vmName} –VMHost ${args.esxiHost} -DiskStorageFormat Thin -Confirm:\$False -ErrorAction Stop

The VM creation fails randomly with the below error and VMWare log console.

Reply
0 Kudos
14 Replies
LucD
Leadership
Leadership

WHich PowerCLI version, and which vSphere version?


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

Reply
0 Kudos
lokeshwari10
Contributor
Contributor

@LucD we are using powercli - 11.5.0 and VSphere - 6.7.0.40000

Tags (1)
Reply
0 Kudos
LucD
Leadership
Leadership

I would suggest first upgrading your PowerCLI version, there have been Content Library related changes in the recent updates.


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

Reply
0 Kudos
lokeshwari10
Contributor
Contributor

@LucD I upgarded powercli to 12.5.0 (build 19093566) and tried to create VM's  but still facing the same issue 

Reply
0 Kudos
LucD
Leadership
Leadership

Does the creation of the VM work when you do it from the Web Client?

It seems you are doing this from within Jenkins, did you also try outside of Jenkins?
Just a New-VM from a PS prompt?


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

Reply
0 Kudos
lokeshwari10
Contributor
Contributor

@LucD Same issue and error when I create VM's from web client. But when I created with PS prompt the machine creation executed one after the other and the VM's were created fine.

Reply
0 Kudos
LucD
Leadership
Leadership

Those VMs were all created from Templates stored in a Content Library?

Strange that the one from the PS prompt worked, but not the ones from the Web Client.
You are sure that your Jenkins setup uses the same PowerCLI version?


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

Reply
0 Kudos
lokeshwari10
Contributor
Contributor

@LucD Yes, Jenkins setup uses the same PowerCLI Version. I have notices below pattern.

By using web client , I tried to create 3 VM's in parallel. 2 succeeded and one failed. 

When created using PS Prompt I used below commands which executed one after the other and all 3 machines were created successfully.

Connect-VIServer -Server ****** -Protocol https -User ****** -Password ******

Get-ContentLibraryItem –Name ****** | New-VM –Name test –VMHost ****** -DiskStorageFormat Thin
Get-ContentLibraryItem –Name ****** | New-VM –Name test1 –VMHost ****** -DiskStorageFormat Thin
Get-ContentLibraryItem –Name ****** | New-VM –Name test2 –VMHost ****** -DiskStorageFormat Thin



 

Reply
0 Kudos
LucD
Leadership
Leadership

When you add the RunAsync switch to the New-VM cmdlet, they will also run in parallel in the background.
Do they all succeed in that case?

Also, when they all succeed from the PS prompt in sequence, and 2 out of 3, when done from the Web Client, I don't see how this could be a PowerCLI issue.


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

Reply
0 Kudos
lokeshwari10
Contributor
Contributor

@LucD I agree that it might not be PowerCLI issue. IS it something where PowerCLI accessing content library api issue ? or May be conetent library issue ? Do we have a separate discussion thread for it ? 

 

Reply
0 Kudos
LucD
Leadership
Leadership

Did you try with the RunAsync switch on the New-VM cmdlet, from the PS prompt?

The Web Client is using the same API and the same Content Library as the PowerCLI cmdlet.
I suspect it might be a content library issue or the connection to that library.


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

Reply
0 Kudos
lokeshwari10
Contributor
Contributor

@LucD I tried using RunAsync and all the instances were created fine.

And yes, looks like its content library connection issue. May I know how to verify or fix this ?
 

Reply
0 Kudos
LucD
Leadership
Leadership

To be honest no clue.
I would suggest opening an SR.


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

Reply
0 Kudos
lokeshwari10
Contributor
Contributor

@LucD Thank you for the assistance, we will try opening SR

Reply
0 Kudos