<?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 Re: PowerCLI vs Perl SDK in vSphere SDK for Perl Discussions</title>
    <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274614#M2362</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Upon further testing it appears the error I am receiving is with the 2nd suggested command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1444852764609243" jivemacro_uid="_1444852764609243"&gt;
&lt;P&gt;my $vm_name = "test_vm_template"&lt;/P&gt;
&lt;P&gt;my $vm = Vim::find_entity_view(view_type =&amp;gt; 'VirtualMachine', filter =&amp;gt; {'name' =&amp;gt; $vm_name});&lt;/P&gt;
&lt;P&gt;print "vm name = " . $vm-&amp;gt;name . "\n";&lt;/P&gt;
&lt;P&gt;$pool_moref = $vm-&amp;gt;{'resourcePool'};&lt;/P&gt;
&lt;P&gt;$pool = Vim::get_view(mo_ref =&amp;gt; $pool_moref);&lt;/P&gt;
&lt;P&gt;print "resource name = " . $pool-&amp;gt;name . "\n";&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is happening on line #5. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Oct 2015 20:01:04 GMT</pubDate>
    <dc:creator>marck004</dc:creator>
    <dc:date>2015-10-14T20:01:04Z</dc:date>
    <item>
      <title>PowerCLI vs Perl SDK</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274611#M2359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On the PowerCLI side, I can execute:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set-template -template &amp;lt;name&amp;gt; -tovm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...which will convert a template to a VM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the Perl SDK side, I found the MarkAsVirtualMachine call which appears to do something similar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, on the Perl SDK side the above call requires a ResourcePool be passed whereas the PowerCLI command does not require a ResourcePool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In our environment we are not using defined ResourcePools - we do have ClusterComputeResources, but that does not help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone offer any suggestions to getting something on the Perl SDK side that performs similarly to the set-template on the PowerCLI side?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 18:25:30 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274611#M2359</guid>
      <dc:creator>marck004</dc:creator>
      <dc:date>2015-10-14T18:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: PowerCLI vs Perl SDK</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274612#M2360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So even without any ResourcePools in our vSphere Client UI, there are some default resource pool entities.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get it from your virtual machine object with the property 'resourcePool'.&amp;nbsp; That's most likely what the PowerCLI cmdlet is doing, just using the same resource pool the template is current in (template and virtual machines are the same object, it's just a boolean flag).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, from Perl, assuming you got the resourcePool property from your get_view or find_entity_view calls:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;$pool_moref = $vm-&amp;gt;{'resourcePool'};&lt;/P&gt;
&lt;P&gt;$pool = Vim::get_view(mo_ref =&amp;gt; $pool_moref);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# ...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 18:30:52 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274612#M2360</guid>
      <dc:creator>stumpr</dc:creator>
      <dc:date>2015-10-14T18:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: PowerCLI vs Perl SDK</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274613#M2361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, Stumpr.&amp;nbsp; This makes sense; however, I am still needing some assistance with the proof of concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my $vm_name = "test_vm_template"&lt;/P&gt;&lt;P&gt;my $vm = Vim::find_entity_view(view_type =&amp;gt; 'VirtualMachine', filter =&amp;gt; {'name' =&amp;gt; $vm_name});&lt;/P&gt;&lt;P&gt;print "vm name = " . $vm-&amp;gt;name . "\n";&lt;/P&gt;&lt;P&gt;$pool_moref = $vm-&amp;gt;{'resourcePool'};&lt;/P&gt;&lt;P&gt;$pool = Vim::get_view(mo_ref =&amp;gt; $pool_moref);&lt;/P&gt;&lt;P&gt;print "resource name = " . $pool-&amp;gt;name . "\n";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 1st print statement is showing me the vm name but the 2nd is returning an error of (can't call method "type" on an undefined value).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears I am attempting to access the resource pool incorrectly.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 19:09:58 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274613#M2361</guid>
      <dc:creator>marck004</dc:creator>
      <dc:date>2015-10-14T19:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: PowerCLI vs Perl SDK</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274614#M2362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Upon further testing it appears the error I am receiving is with the 2nd suggested command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1444852764609243" jivemacro_uid="_1444852764609243"&gt;
&lt;P&gt;my $vm_name = "test_vm_template"&lt;/P&gt;
&lt;P&gt;my $vm = Vim::find_entity_view(view_type =&amp;gt; 'VirtualMachine', filter =&amp;gt; {'name' =&amp;gt; $vm_name});&lt;/P&gt;
&lt;P&gt;print "vm name = " . $vm-&amp;gt;name . "\n";&lt;/P&gt;
&lt;P&gt;$pool_moref = $vm-&amp;gt;{'resourcePool'};&lt;/P&gt;
&lt;P&gt;$pool = Vim::get_view(mo_ref =&amp;gt; $pool_moref);&lt;/P&gt;
&lt;P&gt;print "resource name = " . $pool-&amp;gt;name . "\n";&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is happening on line #5. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 20:01:04 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274614#M2362</guid>
      <dc:creator>marck004</dc:creator>
      <dc:date>2015-10-14T20:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: PowerCLI vs Perl SDK</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274615#M2363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, probably have to hop through the host.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14448634854372099" jivemacro_uid="_14448634854372099" modifiedtitle="true"&gt;
&lt;P&gt;my $vm_name = "test_vm_template";&lt;/P&gt;
&lt;P&gt;my $vm = Vim::find_entity_view(view_type =&amp;gt; 'VirtualMachine', filter =&amp;gt; { 'name' =&amp;gt; $vm_name });&lt;/P&gt;
&lt;P&gt;my $host_ref = $vm-&amp;gt;{'runtime'}{'host'};&lt;/P&gt;
&lt;P&gt;my $host = Vim::get_view(mo_ref =&amp;gt; $host_ref, properties =&amp;gt; ['name', 'parent']);&lt;/P&gt;
&lt;P&gt;my $compute = Vim::get_view(mo_ref =&amp;gt; $host-&amp;gt;{'parent'}, properties =&amp;gt; ['name', 'resourcePool']);&lt;/P&gt;
&lt;P&gt;my $pool = Vim::get_view(mo_ref =&amp;gt; $compute-&amp;gt;{'resourcePool'}, properties =&amp;gt; ['name']);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Now use $pool as parameter to MarkAsVirtualMachine&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing this completely from the SDK doc, so I'm sure there are typos.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 23:11:53 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/PowerCLI-vs-Perl-SDK/m-p/2274615#M2363</guid>
      <dc:creator>stumpr</dc:creator>
      <dc:date>2015-10-14T23:11:53Z</dc:date>
    </item>
  </channel>
</rss>

