VMware {code} Community
bblblp
Contributor
Contributor
Jump to solution

Set VM OS Type Using SDK Perl v5?

I am trying to set the operating system type of a virtual machine shell using the Perl version 5 SDK and am receiving an error.

Snippet of code:

     $guestid = "sles11_64Guest"

     my $guestid = VirtualMachineConfigInfo->new(guestId => $guestid);

     my $spec = VirtualMachineConfigSpec->new(guestId => $guestid);

     my $task = $vm_view->ReconfigVM_Task(spec => $spec);

The error that is returned is as follows:

          String: An error occurred during host configuration.

     Detail: PlatformConfigFault

Any assistance that can be provided would be greatly appreciated.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Hi,

You had it right at $spec, if you take a look at the vSphere API Ref - http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fvim.vm.ConfigS...

ReconfigVM_Task() takes in spec property which is a VirtualMachineConfigSpec and that has a property called guestId which is just a string.

So you should have the following:

     $guestid = "sles11_64Guest"

     my $spec = VirtualMachineConfigSpec->new(guestId => $guestid);

     my $task = $vm_view->ReconfigVM_Task(spec => $spec);

View solution in original post

0 Kudos
2 Replies
lamw
Community Manager
Community Manager
Jump to solution

Hi,

You had it right at $spec, if you take a look at the vSphere API Ref - http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fvim.vm.ConfigS...

ReconfigVM_Task() takes in spec property which is a VirtualMachineConfigSpec and that has a property called guestId which is just a string.

So you should have the following:

     $guestid = "sles11_64Guest"

     my $spec = VirtualMachineConfigSpec->new(guestId => $guestid);

     my $task = $vm_view->ReconfigVM_Task(spec => $spec);

0 Kudos
bblblp
Contributor
Contributor
Jump to solution

That did the trick.  Thanks! Smiley Happy

0 Kudos