VMware

This Question is Answered

1 2 Previous Next 20 Replies Last post: Jul 28, 2009 6:52 AM by RobMokkink  

Deploy VM from template using CloneVM_Task posted: Jul 2, 2009 11:05 AM

Click to view AticusDoc's profile Novice 6 posts since
Jul 1, 2009

I am trying to create a script that will deploy a VM from a template using the CloneVM_Task customization. Eventually I want to be able to deploy dozens of VMs from one template very quickly but first I am trying this out on one VM. I just can't seem to get it working. I used a script from http://communities.vmware.com/message/1064716#1064716 and http://communities.vmware.com/message/1000953#1000953

After I run the script in PowerCLI I view the progress in vSphere Client. The VM is created and the Clone Virtual Machine task gets to 93% at which time the task viewer says it is "Customizing the new Virtual Machine." That's about when the vCenter server crashes and when it comes back up again I can see in the task viewer that the Clone Virtual Machine task failed with an "Error."

I attached the script I am using below, any ideas?

Attachments:

Re: Deploy VM from template using CloneVM_Task

1. Jul 2, 2009 11:41 AM in response to: AticusDoc
Click to view DougBaer's profile Expert 602 posts since
Oct 20, 2004
When I see an error like this, it is generally related to the OS Customization spec, or not having the appropriate sysprep tools installed on the vCenter server.

As a test, can you deploy VMs via your script without customizing the OS? That will at least narrow the problem. I like to use New-VM with the Template option...

new-vm -template `
(get-template "My-Template") `
-name "Name-of-new-VM" `
-host (get-vmhost name-of-target-host) `
-location (get-folder –name "My Folder") `
-pool (get-resourcepool "My Resource Pool") `
-Datastore (get-datastore "My-Datastore-1")

Re: Deploy VM from template using CloneVM_Task

3. Jul 2, 2009 12:45 PM in response to: AticusDoc
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
Do you have the sysprep binaries copied to your Virtual Center server ?
And are they the correct version ?
See Appendix B in vSphere Basic System Administration for further info.

Re: Deploy VM from template using CloneVM_Task

4. Jul 2, 2009 1:04 PM in response to: AticusDoc
Click to view DougBaer's profile Expert 602 posts since
Oct 20, 2004
That's a helpful error message :>

So, your vCenter server actually goes down??

I'm with Luc... check your sysprep utilities. Can you deploy and customize the same VM template using similar custom spec settings via the GUI w/o VC going down?

Re: Deploy VM from template using CloneVM_Task

6. Jul 3, 2009 1:18 AM in response to: AticusDoc
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
Checked the script you are using and there is one error in there around line 38.
This
...
#setup resource pool
$pool = get-resourcepool -id $vmpool
...

should be
...
#setup resource pool
$pool = get-resourcepool $vmpool
...
.
I'm not sure why you get no error message on this.
From where are you running the script ?
Could it be that you have ErrorAction set to silentlycontinue ?

In any case, when I corrected that line the script ran without a problem (and the template was cloned).

Re: Deploy VM from template using CloneVM_Task

9. Jul 9, 2009 1:03 PM in response to: AticusDoc
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
I think you better open a call with VMware for this problem.
It's way beyond what I have ever seen.

Re: Deploy VM from template using CloneVM_Task

10. Jul 27, 2009 12:18 PM in response to: AticusDoc
Click to view RS_1's profile Enthusiast 58 posts since
Nov 3, 2006

Hi, i got exactly the same issue since i updated the vcenter server from 2.5 U4 to 4.0

Since the update, i was using the RobMokkin's script almost every day !

The vcenter service crash during the customization guest too :

2009-07-27 19:38:34.467 03748 info 'App' VpxLRO -- FINISH task-internal-64967 -- host-1006 -- VpxdInvtHostSyncHostLRO.Synchronize --
2009-07-27 19:38:34.513 05180 info 'App' hostVersion = 3.5.0, tools version = 7302
2009-07-27 19:38:34.513 05180 info 'App' hostVersion = 3.5.0, tools version = 7302
2009-07-27 19:38:34.513 05180 info 'App' Sysprep options: -quiet -mini -reseal -reboot
2009-07-27 19:38:34.513 05180 info 'App' Successfully created file C:\WINDOWS\TEMP\imcEB.tmp
2009-07-27 19:38:34.513 05180 info 'App' Successfully created directory C:\WINDOWS\TEMP\imc-2
2009-07-27 19:38:34.545 05180 error 'App' Win32 invalid_parameter: expression=(null), function=(null), file=(null), line=0
2009-07-27 19:38:34.576 05180 error 'App'

Panic: Win32 invalid_parameter error
Backtrace:
backtrace00 eip 0x019e88f0 ?AbortProcess@System@Vmacore@@YAXXZ
backtrace01 eip 0x019e9077 ?CreateBacktrace@SystemFactoryImpl@System@Vmacore@@UAEXAAV?$Ref@VBacktrace@System@Vmacore@@@3@@Z
backtrace02 eip 0x0192b863 ?PanicExit@Vmacore@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
backtrace03 eip 0x019f8a70 ?GetThisThread@System@Vmacore@@YAPAVThread@12@XZ
backtrace04 eip 0x78138aa0 _invalid_parameter_noinfo
backtrace05 eip 0x10019faf ?NonLonghornFlush@SysprepConfigGenerator@GuestCust@@AAEXABV?$basic_path@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@7@1@Z
backtrace06 eip 0x1001ac23 ?Flush@SysprepConfigGenerator@GuestCust@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N0AAV?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@1@Z
backtrace07 eip 0x005eac40 (no symbol)
backtrace08 eip 0x005ef182 (no symbol)
backtrace09 eip 0x00b69e9c (no symbol)
backtrace10 eip 0x00b6baac (no symbol)
backtrace11 eip 0x00b6bd40 (no symbol)
backtrace12 eip 0x00b16be5 (no symbol)
backtrace13 eip 0x00b18220 (no symbol)
backtrace14 eip 0x0076678f (no symbol)
backtrace15 eip 0x01d93e53 ??4ScheduledTaskManager@Scheduler@Vim@@QAEAAV012@ABV012@@Z
backtrace16 eip 0x01b937ab ?AddFat@Activation@Vmomi@@QAEXPAVObject@Vmacore@@@Z
backtrace17 eip 0x01b93782 ?AddFat@Activation@Vmomi@@QAEXPAVObject@Vmacore@@@Z
backtrace18 eip 0x0082b583 (no symbol)
backtrace19 eip 0x0080bbd9 (no symbol)
backtrace20 eip 0x00814777 (no symbol)
backtrace21 eip 0x00821c31 (no symbol)
backtrace22 eip 0x00d1f758 (no symbol)
backtrace23 eip 0x7c826063 GetModuleFileNameA

2009-07-27 19:38:34.607 05180 info 'App' CoreDump: Writing minidump

LucD, you're our only hope -in the galaxy ;)

Re: Deploy VM from template using CloneVM_Task

11. Jul 27, 2009 12:32 PM in response to: AticusDoc
Click to view RS_1's profile Enthusiast 58 posts since
Nov 3, 2006

I just see a difference betwen the vcenter 2.5 and 4.0 customSpec export :

<_type>vim.vm.customization.Specification</_type>
<encryptionKey>

But, according to this doc, this parameter is not mandatory.

http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.Specification.html


Re: Deploy VM from template using CloneVM_Task

12. Jul 27, 2009 4:44 PM in response to: RS_1
Click to view RS_1's profile Enthusiast 58 posts since
Nov 3, 2006

Here is what apears in vpxd.log when everything's good :

2009-07-28 01:33:04.975 03404 info 'App' Successfully created directory C:\WINDOWS\TEMP\imc-7
2009-07-28 01:33:05.475 03404 info 'App' Create sysprep file package. Params:
2009-07-28 01:33:05.475 03404 info 'App' file = C:\WINDOWS\TEMP\imc18.tmp
2009-07-28 01:33:05.475 03404 info 'App' binary dir = C:\Program Files\VMware\Infrastructure\VirtualCenter Server\
2009-07-28 01:33:05.475 03404 info 'App' options = -quiet -mini -reseal -reboot
2009-07-28 01:33:05.475 03404 info 'App' config = C:\WINDOWS\TEMP\imc-7
2009-07-28 01:33:05.475 03404 info 'App' sysprep = C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\sysprep\svr2003
2009-07-28 01:33:05.475 03404 info 'App' tools =
2009-07-28 01:33:05.475 03404 info 'App' native =
2009-07-28 01:33:05.475 03404 info 'App' nativeArgs =
2009-07-28 01:33:05.475 03404 info 'App' Successfully created file C:\WINDOWS\TEMP\imc19.tmp
2009-07-28 01:33:05.475 03404 info 'App' Creating cab file imc19.tmp
2009-07-28 01:33:05.475 03404 info 'App' Adding C:\Program Files\VMware\Infrastructure\VirtualCenter Server\guestcustutil.exe as guestcustutil.exe
2009-07-28 01:33:05.663 03404 info 'App' Adding C:\Program Files\VMware\Infrastructure\VirtualCenter Server\imgcust-reboot.exe as imgcust-reboot.exe
2009-07-28 01:33:05.709 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\bootrun.exe as sysprep\i386\$OEM$\bootrun.exe
2009-07-28 01:33:05.788 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\bootrunMsg.dll as sysprep\i386\$OEM$\bootrunMsg.dll
2009-07-28 01:33:05.788 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\cmdlines.txt as sysprep\i386\$OEM$\cmdlines.txt
2009-07-28 01:33:05.788 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\finalizationsetup.bat as sysprep\i386\$OEM$\finalizationsetup.bat
2009-07-28 01:33:05.803 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\finalize.bat as sysprep\i386\$OEM$\finalize.bat
2009-07-28 01:33:05.803 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\guestcustutil.exe as sysprep\i386\$OEM$\guestcustutil.exe
2009-07-28 01:33:05.944 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\imgcust-reboot.exe as sysprep\i386\$OEM$\imgcust-reboot.exe
2009-07-28 01:33:06.006 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\imgres\de\loginblockerRes.dll as sysprep\i386\$OEM$\imgres\de\loginblockerRes.dll
2009-07-28 01:33:06.006 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\imgres\ja\loginblockerRes.dll as sysprep\i386\$OEM$\imgres\ja\loginblockerRes.dll
2009-07-28 01:33:06.006 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\imgres\zh-CN\loginblockerRes.dll as sysprep\i386\$OEM$\imgres\zh-CN\loginblockerRes.dll
2009-07-28 01:33:06.022 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\i386\$OEM$\loginblocker.exe as sysprep\i386\$OEM$\loginblocker.exe
2009-07-28 01:33:06.069 03404 info 'App' Adding C:\WINDOWS\TEMP\imc-7\sysprep.inf as sysprep\sysprep.inf
2009-07-28 01:33:06.069 03404 info 'App' Adding C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\sysprep\svr2003\setupcl.exe as deploy\setupcl.exe
2009-07-28 01:33:06.084 03404 info 'App' Adding C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\sysprep\svr2003\sysprep.exe as deploy\sysprep.exe
2009-07-28 01:33:06.131 03404 info 'App' Adding C:\Program Files\VMware\Infrastructure\VirtualCenter Server
sysprepDecrypter.exe as sysprepDecrypter.exe
2009-07-28 01:33:06.163 03404 info 'App' Flushing...
2009-07-28 01:33:06.163 03404 info 'App' Added file guestcustutil.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file imgcust-reboot.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\bootrun.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\bootrunMsg.dll
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\cmdlines.txt
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\finalizationsetup.bat
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\finalize.bat
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\guestcustutil.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\imgcust-reboot.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\imgres\de\loginblockerRes.dll
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\imgres\ja\loginblockerRes.dll
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\imgres\zh-CN\loginblockerRes.dll
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\i386\$OEM$\loginblocker.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprep\sysprep.inf
2009-07-28 01:33:06.163 03404 info 'App' Added file deploy\setupcl.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file deploy\sysprep.exe
2009-07-28 01:33:06.163 03404 info 'App' Added file sysprepDecrypter.exe
2009-07-28 01:33:06.256 03404 info 'App' Successfully deleted file/directory C:\WINDOWS\TEMP\imc19.tmp
2009-07-28 01:33:06.288 03404 info 'App' Successfully deleted file/directory C:\WINDOWS\TEMP\imc-7

Can anyone post the same thing with vcenter 2.5 to compare ? Thx ;)

Re: Deploy VM from template using CloneVM_Task

13. Jul 27, 2009 10:53 PM in response to: RS_1
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
Like I said before, I'm afraid this is beyond me.
I think you better open a call for this.

The only difference I can see is that in the vSphere API 4.0 the VirtualMachineCloneSpec object has a new property, called snapshot, which wasn't there in the VI API 2.5 VirtualMachineCloneSpec object.

Re: Deploy VM from template using CloneVM_Task

14. Jul 27, 2009 11:18 PM in response to: LucD
Click to view RobMokkink's profile Expert 679 posts since
Jun 7, 2005
My P.I. is already testing the script. Since i don't have my vSphere lab up and running at work ;-)

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities