<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Lightning Guides</title>
	<atom:link href="http://vspherelightningguides.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vspherelightningguides.wordpress.com</link>
	<description>Flashes of insight into the vSphere Web Services SDK</description>
	<lastBuildDate>Wed, 23 Jun 2010 00:20:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vspherelightningguides.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Lightning Guides</title>
		<link>http://vspherelightningguides.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vspherelightningguides.wordpress.com/osd.xml" title="Lightning Guides" />
	<atom:link rel='hub' href='http://vspherelightningguides.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Creating a Virtual Machine</title>
		<link>http://vspherelightningguides.wordpress.com/2010/06/15/creating-a-virtual-machine/</link>
		<comments>http://vspherelightningguides.wordpress.com/2010/06/15/creating-a-virtual-machine/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 20:08:21 +0000</pubDate>
		<dc:creator>lightningguides</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vspherelightningguides.wordpress.com/?p=12</guid>
		<description><![CDATA[A virtual machine (VM) is, simply speaking, a software computer.  Conceptually, creating a virtual machine is not difficult. It is almost identical to assembling a physical computer: you need a CPU, memory, and other devices. There are additional hoops to jump through: you&#8217;ll need to specify where the virtual machine will draw its resources, which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vspherelightningguides.wordpress.com&amp;blog=14202197&amp;post=12&amp;subd=vspherelightningguides&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.VirtualMachine.html" target="_blank">virtual machine</a> (VM) is, simply speaking, a software computer.  Conceptually, creating a virtual machine is not difficult. It is almost identical to assembling a physical computer: you need a CPU, memory, and other devices. There are additional hoops to jump through: you&#8217;ll need to specify where the virtual machine will draw its resources, which host it will run on, the datastore which will hold its files, and so on. Implementing it all in a program can be overwhelming. This <span style="color:#ff00ff;">Lightning Guide</span> will walk you through the process of creating a functional, usable VM&#8230; in a flash.</p>
<p>Three steps are required before calling CreateVM_Task():</p>
<ol>
<li>Retrieve data from the server</li>
<li>Configure basic virtual machine settings</li>
<li>Add key devices</li>
</ol>
<h2>1. Retrieve data from the server</h2>
<p>The following is a list of server-side objects and properties required to create a virtual machine:</p>
<ul>
<li><a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vmodl.ManagedObjectReference.html" target="_blank">Managed Object Reference </a>(MOR) to a <a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.Folder.html" target="_blank">Folder</a> to hold the VM. Argument for CreateVM_Task(). Property to retrieve:
<ul>
<li><em>childType</em> to find a folder that can hold virtual machines.</li>
</ul>
</li>
<li>MOR to a<a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.ComputeResource.html" target="_blank"> ComputeResource</a>. Properties to retrieve:
<ul>
<li><em>resourcePool</em> to obtain MOR to a<a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.ResourcePool.html"> ResourcePool</a> the VM will belong to. Argument for CreateVM_Task()</li>
<li><em>host</em> to obtain MOR to a <a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.HostSystem.html" target="_blank">HostSystem </a>on which the VM will run.  Argument for CreateVM_Task()</li>
<li><em>environmentBrowser</em> to obtain MOR to an <a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.EnvironmentBrowser.html" target="_blank">EnvironmentBrowser</a>.</li>
</ul>
</li>
<li>MOR to a <a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.Datastore.html" target="_blank">Datastore</a>. Used to store VM&#8217;s files and back the virtual hard disk. Properties to retrieve:
<ul>
<li><em>host</em> to ensure that the VM&#8217;s host can access the datastore</li>
<li><em>name</em> to specify file paths for VM&#8217;s files.</li>
</ul>
</li>
</ul>
<p>Use the <a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vmodl.query.PropertyCollector.html#retrieveContents" target="_blank">RetrievePropertiesEx()</a> method of the property collector to retrieve the array of <a href="http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vmodl.query.PropertyCollector.ObjectContent.html" target="_self">ObjectContent</a> data objects. Use loops to extract the data into appropriate variables.</p>
<ul>
<li>Folder.childType is an array of strings specifying the types of managed objects the folder can hold. Make sure &#8220;VirtualMachine&#8221; is one of these.</li>
<li>Datastore.host is an array of hosts that can access the datastore. Make sure the target host is included in the array.</li>
</ul>
<p>Use the QueryConfigOption() method of the environment browser to obtain a VirtualMachineConfigOption data object for the target host.</p>
<ul>
<li>The <em>defaultDevices</em> property contains an array of VirtualDevice data objects. Cycle through the array and find a VirtualIDEController and a VirtualPCIController. Store their keys into variables.</li>
</ul>
<p>Use the QueryConfigTarget() method of the environment browser to obtain a ConfigTarget data object for the target host.</p>
<ul>
<li>The <em>cdRom</em> property contains an array of VirtualMachineCdromInfo data objects. Select one, and store its <em>name</em> property in a variable.</li>
<li>The <em>network </em>property contains an array of VirtualMachineNetworkInfo data objects. Select one, and store its <em>name</em> property in a variable.</li>
</ul>
<p>You will use the keys and names during device addition.</p>
<p>CHECK OUT THE CODE!</p>
<h2>2. Configure basic virtual machine settings</h2>
<p>Create a VirtualMachineConfigSpec data object. Set: (required are underlined)</p>
<ul>
<li>The <em>name </em>property to your name of choice.</li>
<li>The <em>memoryMB</em> property to the desired memory size. Keep in mind that different operating systems have different minimum requirements! Default is 32 MB.</li>
<li>The <em>guestId</em> property to the desired operating system identifier (Here&#8217;s a list).</li>
<li>The <em>cpuAllocation</em> and <em>memoryAllocation</em> properties to separate ResourceAllocationInfo data objects specifying reservations and limits on memory/CPU use.</li>
<li>The <em>fileInfo</em> property to a VirtualMachineFileInfo data object.  Setting the VirtualMachineFileInfo.vmPathName property to &#8220;[&lt;datastoreName&gt;]&#8221;  will create a folder on the specified datastore with the same name as <em>name</em> and store all virtual machine files in said folder.</li>
</ul>
<p>CHECK OUT THE CODE!</p>
<h2>3. Add Key Devices</h2>
<p>There are <strong>three (3) </strong> key virtual devices a virtual machine should have:</p>
<ul>
<li><strong>Hard Disk</strong> for data storage</li>
<li><strong>CDRom</strong> for operating system installation</li>
<li><strong>Ethernet</strong> card to connect to network</li>
</ul>
<p>In addition, a <strong>SCSI Controller</strong> is required to connect the Hard Disk to the virtual machine.</p>
<p>You add devices using the <em>VirtualMachineConfigSpec.deviceChange</em> property. There are <strong>three (3) </strong>general steps to adding a device:</p>
<ol>
<li>Specify the physical backing for the device using the appropriate Backing data object.</li>
<li>Create the VirtualDevice data object for your particular device. Set the <em>key</em> property to a unique integer. No two devices on a virtual machine should have the same key.</li>
<li>Create a VirtualDeviceConfigSpec data object for you device. Specify that the device is to be added using the <em>operation</em> property and, if applicable, specify that files associated with the device are to be created using the <em>fileOperation</em> property.</li>
</ol>
<p><strong>SCSI Controller</strong></p>
<p><strong>&lt;CODE?&gt;</strong></p>
<ol>
<li>No backing is required for controllers.</li>
<li>Create a VirtualBusLogicController data object.
<ol>
<li>Set the <em>sharedBus</em> property to VirtualSCSISharing.noSharing</li>
<li>Set the <em>busNumber</em> property to a number of your choice. Bus numbers should be unique among controllers.</li>
<li>Set the <em>key</em> property to a number of your choice. You will need the key to connect devices to the controller</li>
</ol>
</li>
<li>No files associated with the device.</li>
</ol>
<p><strong>Hard Disk</strong></p>
<p><strong>&lt;CODE?&gt;</strong></p>
<ol>
<li>Create a VirtualDiskFlatVer2BackingInfo data object to back the device using a file on the datastore
<ol>
<li>Set the <em>diskMode</em> property to the desired disk persistence mode.</li>
<li>Set the <em>fileName</em> property to the target location for the file using the &#8220;[&lt;datastoreName&gt;]&lt;folderName&gt;/&lt;folderName2&gt;/&#8221; format. A potential location is the location of the other virtual machine files (Step 2).</li>
<li>Set the <em>datastore</em> property to the datastore reference acquired in Step 1.</li>
</ol>
</li>
<li>Create a VirtualDisk data object
<ol>
<li>Set the <em>backing</em> property to the backing object</li>
<li>Set the <em>capacityInKB</em> property</li>
<li>Set the</li>
</ol>
</li>
</ol>
<p><strong>Ethernet Card</strong></p>
<p><strong>&lt;CODE?&gt;</strong></p>
<p><strong>CDRom</strong></p>
<p><strong>&lt;CODE?&gt;</strong></p>
<p>Finally, store all the VirtualDeviceConfigSpec objects into an array, and set the VirtualMachineConfigSpec.deviceChange property to the array.</p>
<p>You now have everything you need to create a virtual machine. To complete this Herculean task, call the CreateVM_Task() method.</p>
<p>&lt;Code?&gt;</p>
<p>Congratulations! A virtual machine is on its way to your server.</p>
<p>NEXT STEPS:</p>
<ul>
<li>Installing Guest OS</li>
<li>Monitoring progress of operations (such as CreateVM!)</li>
</ul>
<p>RELATED TOPICS:</p>
<ul>
<li>Using the Property Collector</li>
<li>Managing a Virtual Machine</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vspherelightningguides.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vspherelightningguides.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vspherelightningguides.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vspherelightningguides.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vspherelightningguides.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vspherelightningguides.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vspherelightningguides.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vspherelightningguides.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vspherelightningguides.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vspherelightningguides.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vspherelightningguides.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vspherelightningguides.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vspherelightningguides.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vspherelightningguides.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vspherelightningguides.wordpress.com&amp;blog=14202197&amp;post=12&amp;subd=vspherelightningguides&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vspherelightningguides.wordpress.com/2010/06/15/creating-a-virtual-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/95903738a42fc743a3d2bc17763e41d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lightningguides</media:title>
		</media:content>
	</item>
	</channel>
</rss>
