vmware and xen apis kevin jacobson. contents overview – xen – vmware comparison apis – xen api...
TRANSCRIPT
Vmware and XenAPIs
Kevin Jacobson
Contents
• Overview– Xen– Vmware
• Comparison• APIs
– Xen API– Vmware API(s)
Xen
• Free, open source software• Hypervisor• Guests have independent “sandboxes”• Paravirtualization
– Software for hardware rather than direct access– Requires guests to be modified
http://uberhip.com/godber/plug/Xen_Primer/assets/xen_para.pngXen on Linux: A Young Hacker’s Illustrated PrimerAustin Gobder
Why Paravirtualization?
• Guests are portable• Only the Hypervisor needs to be ported• Better resource scaling • Windows licensing
VMware
• Commercial• Fully virtualized• Multiple flavors
– Server (ESX)– Workstation– Player– Fusion
…
• Solutions for servers and end-users
Full Virtualization
• Code runs directly on the CPU when possible• Host software checks for things which need
modification– Address space– Segmentation– Breakpoints– Some hardware calls
Comparison
VMware Xen
Open Source
Paravirtualization
Free
Multiple
Full Virtualization
Highly Supported by IT world
Xen API
• Python, C, Java, and Perl implementations• Abstraction above XML-RPC calls to the server
It’s So Simple!
Xen Summit 2007 Presentation by Ewan MellorPg. 6http://www.xen.org/files/xensummit_4/XenSummit_API_Slides_2007-04-18_Ewan.pdf
… it’s pretty confusing huh
• Let’s walk through an example use of the API• Power Cycling Example• Notice that classes in Xen’s API are more like
namespaces• All methods return references or metrics• Xen PyShell Example
VIX ( Deprecated Vmware API)
• VmPyware– Python Bindings for the Vix API– Much simpler than Xen API– Requires Windows Host OS
VmPyWare Examplefrom vix import Viximport time
vm = Vix()
print "Connecting"vm.Connect()
print "Opening vm"vm.Open("E:\\VMs\\Windows XP\\Windows XP Professional.vmx")
print "Powering On vm"vm.PowerOn()print "Waiting a bit..."time.sleep(10)print "Powering off vm"vm.PowerOff()
print "Reverting to snapshot 0"vm.GetRootSnapshot()vm.RevertToSnapshot()
print "Sleeping"time.sleep(10)
print "Disconnecting"vm.Disconnect()
VI (Virtual Infrastructure Management)
• Currently Supported API for VMWare• SOAP based
– WSDL– Cross-platform– Language agnostic
Basic Structure
Vmware Infrastructure SDK 2.5 Programmers Guide
Session Manager Object
• For logging into a system
Vmware Infrastructure SDK 2.5 Programmers Guide
The VM Object
…
Vmware Infrastructure SDK 2.5 Programmers Guide
Java Example
…
import java.net.URL;import com.vmware.vim25.*;import com.vmware.vim25.mo.*;import com.vmware.vim25.mo.util.*;
public class HelloVM {
public static void main(String[] args) throws Exception{
CommandLineParser clp = new CommandLineParser(new OptionSpec[]{}, args);String urlStr = clp.get_option("url");String username = clp.get_option("username");String password = clp.get_option("password");
ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true);Folder rootFolder = si.getRootFolder();ManagedEntity[] mes = new
InventoryNavigator(rootFolder).searchManagedEntities("VirtualMachine");if(mes==null || mes.length ==0){
return;}VirtualMachine vm = (VirtualMachine) mes[0]; VirtualMachineConfigInfo vminfo = vm.getConfig();VirtualMachineCapability vmc = vm.getCapability();vm.getResourcePool();System.out.println("Hello " + vm.getName());System.out.println("GuestOS: " + vminfo.getGuestFullName());System.out.println("Multiple snapshot supported: " +
vmc.isMultipleSnapshotsSupported());si.getServerConnection().logout();
}}
//Example From VMware
Conclusion
Xen• Paravirtualization• XML-RPC Based API• Open Source
Vmware• Fully Virtualized• SOAP API• Commercial
ReferencesVMWare Infrastructure Programmer’s Guidehttp://www.vmware.com/support/developer/vc-sdk/visdk25pubs/
visdk25programmingguide.pdfVMWare Infrastructure Reference Guidehttp://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/Xen API Docshttp://wiki.xensource.com/xenwiki/XenApiXen FAQhttp://wiki.xensource.com/xenwiki/XenFaq
http://grid.rit.edu 23