<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic cloneVM in SDRS cluster using java api in ESXi Discussions</title>
    <link>https://communities.vmware.com/t5/ESXi-Discussions/cloneVM-in-SDRS-cluster-using-java-api/m-p/1339977#M125280</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to cloneVM in SDRS Cluster. It lists 3 recommendations. But while assigning, it throws the following error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried both of them and both throws the same error.&lt;/P&gt;&lt;P&gt;Task cloneTask = rd.applyStorageDrsRecommendation_Task(strs); &lt;BR /&gt;Task cloneTask = rd.applyStorageDrsRecommendationToPod_Task(sp, strs&lt;SPAN&gt;[0]&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;it throws "A specified parameter was not correct. Key"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output of the 3 recommendations : &lt;/P&gt;&lt;P&gt;1) &lt;BR /&gt;103852&lt;BR /&gt;1&lt;BR /&gt;storagePlacement&lt;BR /&gt;Satisfy storage initial placement requests&lt;BR /&gt;V1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) &lt;BR /&gt;103854&lt;BR /&gt;1&lt;BR /&gt;storagePlacement&lt;BR /&gt;Satisfy storage initial placement requests&lt;BR /&gt;V1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) &lt;BR /&gt;103856&lt;BR /&gt;1&lt;BR /&gt;storagePlacement&lt;BR /&gt;Satisfy storage initial placement requests&lt;BR /&gt;V1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StoragePod sp = (StoragePod) new InventoryNavigator(rootFolder).searchManagedEntity("StoragePod", ds.getDatastoreClusterName() );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ManagedObjectReference rd1 = service.getServiceContent().getStorageResourceManager();&lt;BR /&gt;StorageResourceManager rd = new StorageResourceManager(service.getServerConnection(), rd1 );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StorageDrsVmConfigInfo vmconfigInfo = new StorageDrsVmConfigInfo();&lt;BR /&gt;vmconfigInfo.setBehavior("automated");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VmPodConfigForPlacement vpcfp = new VmPodConfigForPlacement();&lt;BR /&gt;vpcfp.setStoragePod(sp.getMOR());&lt;BR /&gt;vpcfp.setVmConfig(vmconfigInfo);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StorageDrsPodSelectionSpec sdpss = new StorageDrsPodSelectionSpec();&lt;BR /&gt;sdpss.setStoragePod(sp.getMOR());&lt;BR /&gt;sdpss.setInitialVmConfig(new VmPodConfigForPlacement[]{vpcfp});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VirtualMachineCloneSpec spec = new VirtualMachineCloneSpec();&lt;BR /&gt;VirtualMachineRelocateSpec locationSpec = new VirtualMachineRelocateSpec();&lt;BR /&gt;locationSpec.setPool(pool.getMOR());&lt;BR /&gt;spec.setLocation(locationSpec);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StoragePlacementSpec sps = new StoragePlacementSpec(); &lt;BR /&gt;sps.setCloneName(siInf.getVmName());&lt;BR /&gt;sps.setType("clone");&lt;BR /&gt;sps.setPodSelectionSpec(sdpss);&lt;BR /&gt;sps.setVm(template.getMOR());&lt;BR /&gt;sps.setFolder(rootFolder.getMOR());&lt;BR /&gt;sps.setCloneSpec(spec);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ServerConnection sc = service.getServerConnection();&lt;BR /&gt;VimPortType vpt = sc.getVimService();&lt;/P&gt;&lt;P&gt;StoragePlacementResult spr = vpt.recommendDatastores(service.getServiceContent().getStorageResourceManager(), sps);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ClusterRecommendation[] crs = spr.getRecommendations();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;String[] strs = new String&lt;SPAN&gt;[1]&lt;/SPAN&gt;;&lt;BR /&gt;for (int i = 0 ; i &amp;lt; crs.length ; i++)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ClusterRecommendation cr = crs&lt;SPAN&gt;[i]&lt;/SPAN&gt;;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getKey());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getRating());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getReason());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getReasonText());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strs&lt;SPAN&gt;[0]&lt;/SPAN&gt; = cr.getKey();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P&gt;//Task cloneTask = rd.applyStorageDrsRecommendation_Task(strs);&lt;BR /&gt;Task cloneTask = rd.applyStorageDrsRecommendationToPod_Task(sp, strs&lt;SPAN&gt;[0]&lt;/SPAN&gt;);&lt;BR /&gt;String result = cloneTask.waitForTask();&lt;BR /&gt;if(result.equalsIgnoreCase("error"))&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String errorMsg = cloneTask.getTaskInfo().error.getLocalizedMessage();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Dec 2013 03:57:44 GMT</pubDate>
    <dc:creator>vmplusplus</dc:creator>
    <dc:date>2013-12-14T03:57:44Z</dc:date>
    <item>
      <title>cloneVM in SDRS cluster using java api</title>
      <link>https://communities.vmware.com/t5/ESXi-Discussions/cloneVM-in-SDRS-cluster-using-java-api/m-p/1339977#M125280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to cloneVM in SDRS Cluster. It lists 3 recommendations. But while assigning, it throws the following error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried both of them and both throws the same error.&lt;/P&gt;&lt;P&gt;Task cloneTask = rd.applyStorageDrsRecommendation_Task(strs); &lt;BR /&gt;Task cloneTask = rd.applyStorageDrsRecommendationToPod_Task(sp, strs&lt;SPAN&gt;[0]&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;it throws "A specified parameter was not correct. Key"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output of the 3 recommendations : &lt;/P&gt;&lt;P&gt;1) &lt;BR /&gt;103852&lt;BR /&gt;1&lt;BR /&gt;storagePlacement&lt;BR /&gt;Satisfy storage initial placement requests&lt;BR /&gt;V1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) &lt;BR /&gt;103854&lt;BR /&gt;1&lt;BR /&gt;storagePlacement&lt;BR /&gt;Satisfy storage initial placement requests&lt;BR /&gt;V1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) &lt;BR /&gt;103856&lt;BR /&gt;1&lt;BR /&gt;storagePlacement&lt;BR /&gt;Satisfy storage initial placement requests&lt;BR /&gt;V1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StoragePod sp = (StoragePod) new InventoryNavigator(rootFolder).searchManagedEntity("StoragePod", ds.getDatastoreClusterName() );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ManagedObjectReference rd1 = service.getServiceContent().getStorageResourceManager();&lt;BR /&gt;StorageResourceManager rd = new StorageResourceManager(service.getServerConnection(), rd1 );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StorageDrsVmConfigInfo vmconfigInfo = new StorageDrsVmConfigInfo();&lt;BR /&gt;vmconfigInfo.setBehavior("automated");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VmPodConfigForPlacement vpcfp = new VmPodConfigForPlacement();&lt;BR /&gt;vpcfp.setStoragePod(sp.getMOR());&lt;BR /&gt;vpcfp.setVmConfig(vmconfigInfo);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StorageDrsPodSelectionSpec sdpss = new StorageDrsPodSelectionSpec();&lt;BR /&gt;sdpss.setStoragePod(sp.getMOR());&lt;BR /&gt;sdpss.setInitialVmConfig(new VmPodConfigForPlacement[]{vpcfp});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VirtualMachineCloneSpec spec = new VirtualMachineCloneSpec();&lt;BR /&gt;VirtualMachineRelocateSpec locationSpec = new VirtualMachineRelocateSpec();&lt;BR /&gt;locationSpec.setPool(pool.getMOR());&lt;BR /&gt;spec.setLocation(locationSpec);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;StoragePlacementSpec sps = new StoragePlacementSpec(); &lt;BR /&gt;sps.setCloneName(siInf.getVmName());&lt;BR /&gt;sps.setType("clone");&lt;BR /&gt;sps.setPodSelectionSpec(sdpss);&lt;BR /&gt;sps.setVm(template.getMOR());&lt;BR /&gt;sps.setFolder(rootFolder.getMOR());&lt;BR /&gt;sps.setCloneSpec(spec);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ServerConnection sc = service.getServerConnection();&lt;BR /&gt;VimPortType vpt = sc.getVimService();&lt;/P&gt;&lt;P&gt;StoragePlacementResult spr = vpt.recommendDatastores(service.getServiceContent().getStorageResourceManager(), sps);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ClusterRecommendation[] crs = spr.getRecommendations();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;String[] strs = new String&lt;SPAN&gt;[1]&lt;/SPAN&gt;;&lt;BR /&gt;for (int i = 0 ; i &amp;lt; crs.length ; i++)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ClusterRecommendation cr = crs&lt;SPAN&gt;[i]&lt;/SPAN&gt;;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getKey());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getRating());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getReason());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getReasonText());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cr.getType());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strs&lt;SPAN&gt;[0]&lt;/SPAN&gt; = cr.getKey();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;}&lt;/P&gt;&lt;P&gt;//Task cloneTask = rd.applyStorageDrsRecommendation_Task(strs);&lt;BR /&gt;Task cloneTask = rd.applyStorageDrsRecommendationToPod_Task(sp, strs&lt;SPAN&gt;[0]&lt;/SPAN&gt;);&lt;BR /&gt;String result = cloneTask.waitForTask();&lt;BR /&gt;if(result.equalsIgnoreCase("error"))&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String errorMsg = cloneTask.getTaskInfo().error.getLocalizedMessage();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Dec 2013 03:57:44 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/ESXi-Discussions/cloneVM-in-SDRS-cluster-using-java-api/m-p/1339977#M125280</guid>
      <dc:creator>vmplusplus</dc:creator>
      <dc:date>2013-12-14T03:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: cloneVM in SDRS cluster using java api</title>
      <link>https://communities.vmware.com/t5/ESXi-Discussions/cloneVM-in-SDRS-cluster-using-java-api/m-p/1339978#M125281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;any clue why it is not working ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2013 17:40:23 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/ESXi-Discussions/cloneVM-in-SDRS-cluster-using-java-api/m-p/1339978#M125281</guid>
      <dc:creator>vmplusplus</dc:creator>
      <dc:date>2013-12-20T17:40:23Z</dc:date>
    </item>
  </channel>
</rss>

