Skip navigation
VMware
Up to Discussions in VMware vCloud™ API

Developer: VMware vCloud™ API

Open. Extensible. Pure Virtual.
 

This Question is Answered (go to answer)

2 "helpful" answers available (6 pts)
719 Views 5 Replies Last post: May 25, 2011 4:44 AM by sqeezer RSS
sqeezer Novice 13 posts since
May 3, 2011
Currently Being Moderated

May 25, 2011 4:44 AM

Create new VM using Java vCloud API

Hi guys,

 

I'm trying to create new VM in vApp but I stuck here. The API I'm using is vcloud-java-sdk-1.0.jar.

 

Could you please show me a code snippet how to do this?

 

For now I'm doing it like this:

 

        RecomposeVAppParamsType recomposeVAppParamsType = new RecomposeVAppParamsType();

        List<CompositionItemParamType> items =  recomposeVAppParamsType.getItem();
        ReferenceType vappTemplateVMRef = new ReferenceType();

               // ??? seems that new reference to new VM should be here. But how to create that VM
        CompositionItemParamType compositionItemParamType = new CompositionItemParamType();
        compositionItemParamType.setSource(vappTemplateVMRef);

        items.add(compositionItemParamType);
        ReferenceType vAppRef = Vdc.getVdcByReference(vcloudClient, vdcRef).getVappRefByName("vApp_Websrv");

        Vapp.getVappByReference(vcloudClient, vAppRef).recomposeVapp(recomposeVAppParamsType);

 

A day before I was playing with Web Services SDK, which is quite easier to understand. I was able to create vApp and VMs in vSphere. Is it possible to import vSphere VMs to vCloud? Which API should I use for that?

 

Thanks,

rkamal Expert 255 posts since
Jan 28, 2009
Currently Being Moderated
1. May 25, 2011 8:42 AM in response to: sqeezer
Re: Create new VM using Java vCloud API

Hi,

 

You cannot add a new empty vm into a vapp.

Instead you can add a vm from an already existing vapp, vapptemplate.

 

For importing vm from vsphere to vcloud.

    Importing vsphere vm as vApp into vcloud. VMWVimserver -> importVmAsVApp()

    Importing vsphere vm as vAppTemplate into vcloud. VMWVimserver -> importVmAsVAppTemplate()

 

Also refer to the ImportVmAsvAppTemplate.java sample which is part of the vcloudjavasdk bundle.

 

Regards,

Rajesh Kamal.

rkamal Expert 255 posts since
Jan 28, 2009
Currently Being Moderated
3. May 25, 2011 11:15 PM in response to: sqeezer
Re: Create new VM using Java vCloud API

Yes.

 

Regards,

Rajesh Kamal.

qc4vmware Enthusiast 78 posts since
Sep 14, 2005
Currently Being Moderated
4. May 25, 2011 11:20 PM in response to: sqeezer
Re: Create new VM using Java vCloud API

I am out of the office on vacation from 05-25-2011 3pm to 06-01-2011.

BartoloDiLeo Lurker 4 posts since
Aug 23, 2011
Currently Being Moderated
5. Feb 2, 2012 2:34 AM in response to: qc4vmware
Re: Create new VM using Java vCloud API

Hi,

 

can you tell me how to install the web services SDK? and where? in which directory??

Bookmarked By (0)

Communities