<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[CloudForms Now]]></provider_name><provider_url><![CDATA[http://cloudformsblog.redhat.com]]></provider_url><author_name><![CDATA[johnhardy36]]></author_name><author_url><![CDATA[https://cloudformsblog.redhat.com/author/johnhardy36/]]></author_url><title><![CDATA[Exporting VM (VMware)]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>This is a really simple export routine for VMware using a custom button.</p>
<p>In an implementation I would maybe wrap this with</p>
<ol>
<li>A dialog to offer different export locations and naming of the export to include date/time stamp and maybe a checkbox to enable disable the overwrite of existing exports.</li>
<li>Add in the approval system, basically some workloads should require authorisation by a manager to allow the export, we could do this by tag, and capture this in the method.</li>
<li>Some error checking and folder creation stuff in the simple method.</li>
</ol>
<p><!--more--></p>
<p>Pre-req &#8211; We need OVFTOOL from VMware, we want to stay supported and this is the right route to take. You can download the ovftool from here <a href="http://www.vmware.com/support/developer/ovf/">http://www.vmware.com/support/developer/ovf/</a> Simply download, transfer, install, no reboot required.</p>
<p>So how will it look?</p>
<p><a href="http://cloudformsnow.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-30-34.png"><img data-attachment-id="145" data-permalink="https://cloudformsblog.redhat.com/copy-cloudforms-png/" data-orig-file="https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png" data-orig-size="918,250" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="copy-cloudforms.png" data-image-description="&lt;p&gt;http://cloudformsnow.files.wordpress.com/2013/05/copy-cloudforms.png&lt;/p&gt;
" data-medium-file="https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png?w=300&#038;h=82" data-large-file="https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png?w=918" class="alignnone wp-image-145 size-medium" src="https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png?w=300&#038;h=82" alt="Screen Shot 2013-05-22 at 21.30.34" width="300" height="82" srcset="https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png?w=300&amp;h=82 300w, https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png?w=600&amp;h=164 600w, https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png?w=150&amp;h=41 150w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>You will execute a custom button from the VM&#8217;s view.The button will be configured as follows;</p>
<p><a href="http://cloudformsnow.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png"><img data-attachment-id="147" data-permalink="https://cloudformsblog.redhat.com/screen-shot-2013-05-08-at-13-06-45/screen-shot-2013-05-22-at-21-37-18/" data-orig-file="https://cloudformsredhat.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png" data-orig-size="1042,550" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2013-05-22 at 21.37.18" data-image-description="" data-medium-file="https://cloudformsredhat.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png?w=300&#038;h=158" data-large-file="https://cloudformsredhat.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png?w=1024" class="alignnone wp-image-147 size-medium" src="https://cloudformsredhat.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png?w=300&#038;h=158" alt="Screen Shot 2013-05-22 at 21.37.18" width="300" height="158" srcset="https://cloudformsredhat.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png?w=300&amp;h=158 300w, https://cloudformsredhat.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png?w=600&amp;h=316 600w, https://cloudformsredhat.files.wordpress.com/2013/05/screen-shot-2013-05-22-at-21-37-18.png?w=150&amp;h=79 150w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>The method sitting behind the button will be as follows; (don&#8217;t forget to set the export_location variable, and you also need to create the location manually in this example, also create a sub folder called &#8220;VMware&#8221; as this is where the exported OVFs will be placed &#8211; Example &#8211; <strong>/vmExport/VMware/)</strong></p>
<p>Download method here <a href="https://github.com/jonnyfiveiq/CloudFORMSNOW/tree/master/Integrations/Operations/vmExport">https://github.com/jonnyfiveiq/CloudFORMSNOW/tree/master/Integrations/Operations/vmExport</a></p>
<pre class="brush: ruby; title: ; notranslate" title="">&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# EVM Automate Method&lt;br /&gt;#&lt;br /&gt;$evm.log(&quot;info&quot;, &quot;EVM Automate Method Started&quot;)&lt;br /&gt;#&lt;br /&gt;# Method Code Goes here&lt;br /&gt;#&lt;br /&gt;export_location = &quot;/vmExport/&quot;&lt;br /&gt;vm = $evm.root['vm']&lt;br /&gt;ems = vm.ext_management_system&lt;br /&gt;$evm.log(&quot;info&quot;,&quot;VM Name = #{vm.name}&quot;)&lt;br /&gt;$evm.log(&quot;info&quot;,&quot;vCenter Name = #{ems.name}&quot;)&lt;br /&gt;&lt;br /&gt;dir = export_location + vm.vendor&lt;br /&gt;ovftool = &quot;/usr/bin/ovftool &quot;&lt;br /&gt;arguments = &quot;vi://#{ems.authentication_userid}:#{ems.authentication_password}@#{ems.ipaddress}/#{vm.v_owning_datacenter}?ds=[#{vm.storage_name}]/#{vm.location} #{dir}/#{vm.name}&quot;&lt;br /&gt;command = ovftool + arguments&lt;br /&gt;$evm.log(&quot;info&quot;,&quot;Launching Command - #{command}&quot;)&lt;br /&gt;begin&lt;br /&gt;rc = system(command)&lt;br /&gt;rescue&lt;br /&gt;$evm.log(&quot;info&quot;,&quot;OVFTOOL Return - #{rc}&quot;)&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;$evm.log(&quot;info&quot;, &quot;EVM Automate Method Ended&quot;)&lt;br /&gt;exit MIQ_OK&lt;br /&gt;&lt;br /&gt;</pre>
<p>&nbsp;</p>
<p>When executed you should see in the automate log the following, the process is fire and forget as it could take some time to complete.</p>
<p>&nbsp;</p>
]]></html><thumbnail_url><![CDATA[https://cloudformsredhat.files.wordpress.com/2013/05/copy-cloudforms.png?w=300&fit=440%2C330]]></thumbnail_url><thumbnail_width><![CDATA[300]]></thumbnail_width><thumbnail_height><![CDATA[82]]></thumbnail_height></oembed>