VMware {code} Community
thale13
Contributor
Contributor

Help creating a VApp from perl

So I'm trying to use CreateVAPP to create a new barebones Vapp and I'm running into problems.

I have this call:  my $vapp = $rp->CreateVApp(name => "Test_for_DR_Script", configSpec => $vAppConfig, resSpec => $resConfig);

and the configSpec: my $vAppConfig = VAppConfigSpec->new(annotation => "This is a test VApp", vmFolder => $tmpFolder);

and everytime I run it, I get:

Argument vmFolder is not valid at /usr/share/perl5/VMware/VICommon.pm line 2486
    ComplexType::arg_validation('VAppConfigSpec', 'vmFolder', 'ManagedObjectReference=HASH(0x4ac8090)', 'annotation', 'This is a test VApp') called at /usr/share/perl5/VMware/VICommon.pm line 2458
    ComplexType::new('VAppConfigSpec', 'annotation', 'This is a test VApp', 'vmFolder', 'ManagedObjectReference=HASH(0x4ac8090)') called at ./getVAPPInfo.pl line 154

I have run thru practically every folder I can find from the ESXi host on up to the top of the tree and all of them give me that error.

Can anyone give me some help?  An example creating a VApp would be great, but short of that, explaining what folder I need would help.

Also, I am using the SDK for Perl v5.1 connecting to a vSphere Appliance v 5.0U2.

Tom

Reply
0 Kudos
4 Replies
thale13
Contributor
Contributor

Ok, I feel incredibly stupid.  The problem was that vmFolder isn't a property in vAppConfigSpec, it's a property in the CreateVAPP method.  Imagine this:  when you put things in the right place, they work as designed.

Tom

Reply
0 Kudos
santoshsas02
Contributor
Contributor

Hi Thale i am running with the same issue how did you  overcome could you help me on this issue Thanks in advance

Reply
0 Kudos
thale13
Contributor
Contributor

Like my original reply said, I was putting the parameter (vmFolder) on the wrong api call.  Once I put it in the right place, it worked.

Tom

Reply
0 Kudos
admin
Immortal
Immortal

Tom, Could youpaste the snippet of code that you used here..?

~dGeorgey

Reply
0 Kudos