Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 180259

Trouble Cloning VM

$
0
0

Background:

I work at a university. For each computer class, we want to create a new vDC and within that, create a single new vApp (from a Template). Then for each each student in the class, we want to create (clone) an existing VM (it existed in the Templare and now also exists in the vApp).

 

I looked at the Recompose sample and that deals with copying a VM from one vApp to another.

 

From looking on the forums, I was able to create this code. It runs but doesn't create the new VM.

So any help would be greatly appreciated.

RecomposeVAppParamsType recomposeVappParams = newRecomposeVAppParamsType();

recomposeVappParams.name = vapp.Reference.name;

recomposeVappParams.powerOn = false;

recomposeVappParams.powerOnSpecified =true;

 

List<SourcedCompositionItemParamType> studentVMs = newList<SourcedCompositionItemParamType>();

 

ReferenceType studentVmRef = newReferenceType();

studentVmRef.name = newVMName;

studentVmRef.href = sourceVM.Reference.href;

 

SourcedCompositionItemParamType webServerVmItem = newSourcedCompositionItemParamType();

webServerVmItem.Source = studentVmRef;

studentVMs.Add(webServerVmItem);

 

vapp.RecomposeVapp(recomposeVappParams).WaitForTask(0);

 

 

 

 

 

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 180259

Trending Articles