VMware {code} Community
jdudmesh2
Contributor
Contributor

Strange Problem Cloning Windows 2008 Server

I've got a Windows 2008 Server 32bit/Web template which I can successfully clone from VC (I set the guest OS to Vista as discussed elsewhere). I can also successfully clone the VM from a PowerShell script.

My problem is that when I try and clone through the SDK (C#/VS2008/vi-sdk-2.5.0-64154) I get the following error:

Customization of the guest operating system 'winLonghornGuest' is not supported in this configuration. Microsoft Vista (TM) and Linux guests with Logical Volume Manager are supported only for recent ESX host and VMware Tools versions. Please refer to Virtual Center documentation for supported configurations.

This message also appears in Virtual Center.

It's odd that the clone works directly from VC and also from the PowerShell new-vm command but not from the SDK code. I also notice that although the template appears as "Microsoft Windows Vista (32 bit)" in VC, the GuestInfo and VirtualMachineConfigInfo show the guest as Lonhorn in the MOB.

I've tried setting the guestId property in the VirtualMachineConfigSpec which gets passed into the VirtualMachineCloneSpec but this seems to be ignored. Clearly it is possible to do the clone because both VC and PowerShell use the same API.

I'm clearly missing something but I can't see what. Does anybody have any ideas?

thanks!

0 Kudos
5 Replies
jdudmesh2
Contributor
Contributor

I wondered if the difference was because I was using a stored CustomizationSpec with VC and PowerShell but constructing a new spec programatically in my code. I changed my code to use a spec stored on VC but that made no difference at all. Same error.

:0(

0 Kudos
Steve_Jin
Expert
Expert

What error/exception do you get in your code?

Steve JIN, VMware Engineering

Creator of VMware Infrastructure Java API: http://vijava.sf.net

VI Java API 2.0 --- 15 times faster than AXIS in loading, 4+ faster in deserialization; only 1/4 of the size required by AXIS. More importantly freedom to redistribute your applications.

Download, Samples, DocWiki, RSS Feed

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
0 Kudos
jdudmesh2
Contributor
Contributor

I don't get a runtime error. The CloneVM_Task function returns successfully with a task MOR. I get the error above while checking the task status - it's returned in the UpdateSet for the task when I call WaitForUpdates.

0 Kudos
Steve_Jin
Expert
Expert

Do you want to share your code to create the CustomizationSpec object for the clone method? Have you tried your code on other vm cloning that does not require any tweak?

VI Powershell uses the same VI SDK Web services API, so you should be able to do it if VI Powershell can.

Steve JIN, VMware Engineering

Creator of VMware Infrastructure Java API:

VI Java API 2.0 --- 15 times faster than AXIS in loading, 4+ faster in deserialization; only 1/4 of the size required by AXIS. More importantly freedom to redistribute your applications.

Download, Samples, DocWiki, RSS Feed

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
0 Kudos
jdudmesh2
Contributor
Contributor

I've successfully cloned Unix machines with this code and have successfully cloned Windows 2003 Server in the past. I can successfully clone from this template using the customization spec I load below from PowerShell so I'm a bit stumped as to why this doesn't work. I can browse the customization spec after I've loaded it so I knowI've got it.

...

using VMWare.API25;

...

public ManagedObjectReference Run(TechManagementLib.Objects.Server arg)

{

string vmname = string.Format("{0}[#]", arg.FQDN, arg.Id);

VirtualMachineCloneSpec spec = GetCloneSpec(arg);

ManagedObjectReference template = _connection.GetManagedObjectReference(arg.ServerProvisionSpec.SourceTemplate);

ManagedObjectReference folder = _connection.GetManagedObjectReference(arg.ServerProvisionSpec.Folder);

ManagedObjectReference morefTask = connection.Service.CloneVMTask(template, folder, vmname, spec);

return morefTask;

}

VirtualMachineCloneSpec GetCloneSpec(TechManagementLib.Objects.Server s)

{

CustomizationSpecItem custSpec = connection.Service.GetCustomizationSpec(connection.Content.customizationSpecManager, "w2k8-web-32-beta1");

VirtualMachineCloneSpec cspec = new VirtualMachineCloneSpec();

cspec.config = GetConfigSpec(s);

cspec.customization = custSpec.spec;

cspec.location = new VirtualMachineRelocateSpec();

cspec.location.datastore = _connection.GetManagedObjectReference(s.ServerProvisionSpec.DataStore);

cspec.location.pool = _connection.GetManagedObjectReference(s.ServerProvisionSpec.ResourcePool);

cspec.powerOn = false;

cspec.template = false;

return cspec;

}

VirtualMachineConfigSpec GetConfigSpec(TechManagementLib.Objects.Server s)

{

VirtualMachineConfigSpec config = new VirtualMachineConfigSpec();

config.name = s.FQDN;

config.annotation = "Auto-provisioned";

config.guestId = "winVistaGuest";

List<VirtualDeviceConfigSpec> configSpecs = new List<VirtualDeviceConfigSpec>();

config.deviceChange = new VirtualDeviceConfigSpec[] { };

return config;

}

0 Kudos