VMware {code} Community
heyitspablo
VMware Employee
VMware Employee

Welcome VMware vCenter Converter SDK Developers !

Folks,

We are excited about adding the VMware vCenter Converter SDK to our Developer Community. We look forward to getting your feedback and helping us grow our Community.

Keep up with latest info on vSphere PowerCLI http://blogs.vmware.com/vipowershell - Follow me on Twitter @heyitspablo
Reply
0 Kudos
21 Replies
radiumsql
Contributor
Contributor

where can i find some help, i got a big problem in converter one esxi to another esxi. can you give me a example?

Reply
0 Kudos
peevs
VMware Employee
VMware Employee

Hello,

You can use the SDK example as baseline, you will need just to change the source (for destination you will have to change credentils from the VC's to ESX's ones).

Here it is example method to build "ConverterComputerSpec" which describes the managed VM. The result from this method have to be used (see sdk example java) in buildConversionJobSpec().... jobSpec.setSource(..... );

Here it the method:

private ConverterComputerSpec buildManagedVmSourceSpec() throws Exception {

ConverterComputerSpec computerSpec = new ConverterComputerSpec();

ConverterComputerSpecManagedVmLocation managedVmSourceSpec = new ConverterComputerSpecManagedVmLocation();

computerSpec.setLocation(managedVmSourceSpec);

ConverterVimConnectionSpec vimConnectionSpec = new ConverterVimConnectionSpec();

managedVmSourceSpec.setVimConnect(vimConnectionSpec);

ConverterVimConnectionSpecLoginVimCredentials vimCredentials = new ConverterVimConnectionSpecLoginVimCredentials();

vimConnectionSpec.setCredentials(vimCredentials);

vimCredentials.setPassword("----");

vimCredentials.setUsername("Administrator");

vimConnectionSpec.setHostname("----


");

vimConnectionSpec.setVerifyPeer(false);

ManagedObjectReference vmMor = new ManagedObjectReference();

vmMor.setType("VirtualMachine");

vmMor.set_value("vm-31"); //you can get this via VC / ESX API

managedVmSourceSpec.setVm(vmMor);

return computerSpec;

}

Reply
0 Kudos
KathyLee
Contributor
Contributor

Hi

I got a problem for running the sdk sample. The disk size of destionation server is smaller than soure machine. The source machine has two volume id (c: and d:). So I only want to convert the c drive of source machine. I have checked the api reference, but I still don't konw how to set the source volume for converter job. Please kindly help me and give me some sample code for this issue.

Thank you very much.

Kathy

Reply
0 Kudos
radiumsql
Contributor
Contributor

Thanks very much, now i got it.

Reply
0 Kudos
radiumsql
Contributor
Contributor

Ok, first you should get the clone mode to "volumeBasedCloning", then get the source machine info by ConverterQuery method. at last you select what you need copy.

sample code like follows:

private ConverterStorageParamsTargetDiskParams[] DiskCloneParam()

{

ConverterComputerInfo _converterSrcInfo = converterServer.GetVmHardwareInfo(converterEsxisrc); //in here, you get the source vm info

if (_converterSrcInfo == null)

{

return null;

}

else

{

ConverterStorageParamsTargetDiskParams[] targetDisksList = new ConverterStorageParamsTargetDiskParams[http://_converterSrcInfo.hardwareInfo.storage.disk.Length|http://_converterSrcInfo.hardwareInfo.storage.disk.Length];

//in here you can select what volume you need to clone.

for (int i = 0; i < targetDisksList.Length; ++i)

{

targetDisksList[i] = new ConverterStorageParamsTargetDiskParams();

if (_changeType == MoveVMTypes.E2E || _changeType == MoveVMTypes.W2E)

targetDisksList[i].diskType = "vmfsMonolithicFlatThinProvisioned";

else if(_changeType == MoveVMTypes.E2W)

targetDisksList[i].diskType = "monolithicSparse";

targetDisksList[i].sourceDiskId = _converterSrcInfo.hardwareInfo.storage.disk[i].diskId;

targetDisksList[i].volumesToClone = VolumnCloneParam(_converterSrcInfo.hardwareInfo.storage.volume[i]);

}

return targetDisksList;

}

}

Reply
0 Kudos
KathyLee
Contributor
Contributor

HI radiumsql

Thanks for your help. I will try it.

Kathy

Reply
0 Kudos
GuildWorks
Contributor
Contributor

Is it supposed to be possible to run a "Build Solution" and "Start Debugging" with the SDK C# sample (ConverterSamples) using Visual Studio 2010?

I get this result  "Error     1     The type or namespace name 'ConverterApi' could not be found (are you missing a using directive or an assembly reference?)     C:\temp\VMware-converter-sdk-4.3.0-294139\sdk\samples\DotNet\cs\SubmitWinP2VJob\Common.cs     4     7     SubmitWinP2VJob"

I did run Build2005 from the Visual Studio tool command prompt, and it responded with this:

Visual Studio 2005 is installed
Setting Path
The system cannot find the batch label specified - err_no_VSTOOLS
Building Samples in Debug mode
Done Building optimized Stubs and all Samples

Reply
0 Kudos
iangelov
VMware Employee
VMware Employee

SDK C# sample is tested with VS 2005 only. In order to use VS 2010 you probably need to create valid solution from scratch (converting the existing one did not worked for me).

Reply
0 Kudos
GuildWorks
Contributor
Contributor

iangelov, thank you for the "heads-up".

So, now I have tried to re-create the project from scratch.  But I notice that the original project file refers to "ConverterSDKStub.dll" and "ConverterSDKStub.dll" -- but neither of these files exist on my development system.  On my now-stripped-down development system, I now simply have Windowx XP SP3, VS2008, vCenter Converter Standalone 4.3, and these converter sample files.  Do I need some other version of the Converter for this to work?

Reply
0 Kudos
iangelov
VMware Employee
VMware Employee

Don't need other version, just build ConverterSDKStub.dll and reference it (don't forget ConverterSDKStub.XmlSerializers) in VS project.

See <your-sdk-home>\doc\readme_dotnet.htm for build step-by-step instructions.

Reply
0 Kudos
GuildWorks
Contributor
Contributor

iangelov, thank you again!

I have now been able to compile the sample, but when I begin debugging, I encounter this "converter server".  What is that?  Is it a third server separate from the source and destination computers?  Is it necessary to setup a webservice in order to get the Converter to process its tasks?  Below are several references to it:

_converterServer =

new ConverterConnection();

if (!_converterServer.Connect("https://" + _converterServerName + "/converter/sdk", _converterServerUsername, _converterServerPassword))

In file submitwinp2vjob.properties, there are the following:

vcserver.address=10.0.0.2
vcserver.username=domain\administrator
vcserver.password=**********

Reply
0 Kudos
iangelov
VMware Employee
VMware Employee

> Is it a third server separate from the source and destination computers?

Yes, converter server is the machine, where Converter Standalone is installed (as sever) and running.

> Is it necessary to setup a webservice in order to get the Converter to process its tasks?

No, installing Converter Standalone as server is enough.

> In file submitwinp2vjob.properties, there are the following:

> vcserver.address=10.0.0.2
> vcserver.username=domain\administrator
> vcserver.password=**********

No, vcserver stands for VCenter Server, converter server credentials are:

converterserver.address
converterserver.username
converterserver.password

Reply
0 Kudos
KathyLee
Contributor
Contributor

Hi all,

    I got a problem for setting volume to clone. Please help me. I add a parameter "converterStorageParams.setTargetDiskParams(DiskCloneParam()); " in the buildCloningParams() function which is in the sample code.  The DiskcloneParam function is in the below.

  private ConverterStorageParamsTargetDiskParams[] DiskCloneParam()
     {

         ConverterComputerInfo _converterSrcInfo =  _converterServer.GetConverterQuery(buildLiveSourceSpec());

         if (_converterSrcInfo == null)
         {
           return null;
         }
         else
         {

           ConverterStorageParamsTargetDiskParams[] targetDisksList = new ConverterStorageParamsTargetDiskParams[1]; //one disk

           //sourceDiskId volumesToClone  diskType
           if (targetDisksList == null)
           {
              return null;
           }
           targetDisksList[0] = new ConverterStorageParamsTargetDiskParams();
        
          
          ConverterStorageInfoVolumeInfo VolumeInfo[] = _converterSrcInfo.getHardwareInfo().getStorage().getVolume();

          ConverterStorageParamsVolumeCloningParams VolumeCloneParams[] = new ConverterStorageParamsVolumeCloningParams[1]; //converter drive c:
    
          if (VolumeCloneParams[0]==null)
             VolumeCloneParams[0] = new ConverterStorageParamsVolumeCloningParams();
               
          VolumeCloneParams[0].setSourceVolumeId(VolumeInfo[0].getVolumeId());
       
          targetDisksList[0].setVolumesToClone(VolumeCloneParams);
      
          return targetDisksList;       
        }
       
     }

    And then, I can create job successfully. After finishing converter job, I can't open the guest VM. The error message is "Operating System not found". Does any one know what the root cause is?

Thanks~~~~

Reply
0 Kudos
tos2k
Expert
Expert

Can you please check that VMware answers the questions in the Converter API forum?!

WTH!?

The Converter SDK forum is full of open questions - can VMware please answer on those?!!!

Tos2k

Reply
0 Kudos
iangelov
VMware Employee
VMware Employee

Hi KathyLee, you can try to set reconfig flag, code like:

     jobSpec.getConversionParams().setDoReconfig(true);

Reconfiguration is important to get target bootable (except some cases of disk based cloning).

Reply
0 Kudos
tos2k
Expert
Expert

Can you explain/show some code using the other three cloning modes besides volumebasedcloning?

http://www.vmware.com/support/developer/converter-sdk/conv43_apireference/converter.params.StoragePa...

Btw. I cant find those enums (as

Enum - ConverterStorageParamsCloningMode

) in the ConverterApi package!?

Tos2k

Reply
0 Kudos
iangelov
VMware Employee
VMware Employee

com.vmware.converter.ConverterStorageParamsCloningMode located in <sdk-home>\samples\Axis\converter.jar

Reply
0 Kudos
tos2k
Expert
Expert

Hm, running on .NET and can not find it in the ConverterApi namespace here...

Tos2k

Reply
0 Kudos
iangelov
VMware Employee
VMware Employee

You are right, no enum in .NET - strings used instead.

There are many other differences too, as most important I'll mention that

there are additional flags for every optional property, like

  <optional-property-name>Specified

The point is, that when this flag is false, property value will be ignored

and default value (if any) will be used.

As far as I know, there is no .NET API reference documntation.

Reply
0 Kudos