Using Virtualization to Improve Development and Testing Anil Desai Austin .NET User’s Group January 9 th , 2006
Outline <ul><li>Virtualization Benefits and Scenarios </li></ul><ul><li>Virtual Server Architecture </li></ul><ul><li>Auto...
Presentation Overview <ul><li>Each section will cover: </li></ul><ul><ul><li>Technical Overview </li></ul></ul><ul><ul><li...
Virtualization Benefits and Scenarios How you can use virtualization to improve software development and testing
Introduction <ul><li>The question: “Is hardware getting faster faster than software is getting slower?” </li></ul><ul><li>...
Virtualization Features <ul><li>Benefits </li></ul><ul><ul><li>Simplified administration </li></ul></ul><ul><ul><li>Hardwa...
Development/Testing-Related Scenarios <ul><li>Setting up a complex test lab </li></ul><ul><ul><li>Testing multi-tier appli...
Virtualization Candidates <ul><li>Getting Started </li></ul><ul><ul><li>Migrate existing apps / physical machines </li></u...
Estimating VM Resource Requirements <ul><li>Number of VMs </li></ul><ul><li>Estimated memory per VM </li></ul><ul><li>Esti...
Virtual Server Architecture An Overview of Virtual Server 2005
Virtual Server Overview
Virtual Server Components <ul><li>Virtual Server Components </li></ul><ul><ul><li>Virtual Server Service (vssrvc.exe) </li...
Virtual Server Licensing <ul><li>General: </li></ul><ul><ul><li>OS license for the Host OS </li></ul></ul><ul><ul><li>OS l...
Virtual Server vs. Virtual PC <ul><li>Virtual Server Features: </li></ul><ul><ul><li>Improved performance (multi-threaded)...
VM Compatibility  (VPC vs. Virtual Server) <ul><li>Compatible: </li></ul><ul><ul><li>Virtual machine hardware platform </l...
Installing Virtual Server <ul><li>Pre-Installation: </li></ul><ul><ul><li>Admin Web Site Requires IIS (Application Server ...
Emulated Hardware Platform Up to four Intel 21140 10/100Mb network interface cards Network Interfaces Up to four Adaptec 2...
Creating a New VM <ul><li>VM Hardware Configuration (demo) </li></ul><ul><li>OS Installation Options: </li></ul><ul><ul><l...
Virtual Server Files By default, these files will be stored in the same location as the .vmc file. .vud Undo disk files .v...
Automating Virtual Server Accessing the Virtual Server COM API
Introduction to the Object Model <ul><li>Setup installs the “Virtual Server 2005 Type Library” </li></ul><ul><ul><li>Can b...
Setup: Visual Studio .NET <ul><li>Add the COM reference for “Virtual Server 2005 R2 Type Library” </li></ul><ul><ul><li>Ad...
Virtual Machines: Overview <ul><li>A virtual machine consists of: </li></ul><ul><ul><li>VM Configuration file (.vmc) </li>...
VM Power States <ul><li>Virtual Machine power operations: </li></ul><ul><ul><li>Turn On / Turn Off </li></ul></ul><ul><ul>...
Virtual Server Scripting Events <ul><li>Server-Level Scripts: </li></ul><ul><ul><li>Virtual Server starts </li></ul></ul><...
Virtual Machines: Tips <ul><li>Whenever possible, store files for each VM in a single folder </li></ul><ul><li>Moving/Copy...
Managing Media: Overview <ul><li>Changing media: </li></ul><ul><ul><li>Media can be mounted/changed while the VM is runnin...
Managing Media: Scripts <ul><li>Adding/Removing DVD ROM drives: </li></ul><ul><ul><li>objVirtualMachine.DVDROMDrives: Coll...
Disk Architecture: Technical Overview
Base Virtual Hard Disk Types <ul><li>Base Disk Types: </li></ul><ul><ul><li>Fixed-Size VHDs </li></ul></ul><ul><ul><ul><li...
State-Related Disks <ul><li>Undo Disks (.vud) </li></ul><ul><ul><li>Applies to an entire virtual machine </li></ul></ul><u...
Undo Disks: Example
Differencing Disks: Example
Merging Differencing Disks
Managing Virtual Hard Disks <ul><li>Converting VHDs </li></ul><ul><ul><li>Fixed-Size    Dynamically-Expanding </li></ul>...
Disk Management: Scripting <ul><li>Enumerating virtual hard disk files </li></ul><ul><ul><li>objVirtualMachine.HardDiskCon...
Disk Management Tips: <ul><li>Monitor Disk Space </li></ul><ul><ul><li>PerfMon: Logical Disk    % Free Space </li></ul></...
Network Architecture: Overview
Network Architecture: Details <ul><li>Virtual network options: </li></ul><ul><ul><li>Guest-only </li></ul></ul><ul><ul><li...
Networking: Scripting <ul><li>Managing Virtual Networks: </li></ul><ul><ul><li>objVirtualServer.VirtualNetworks </li></ul>...
Network-Based Storage <ul><li>Improving Performance: </li></ul><ul><ul><li>Use NIC Teaming </li></ul></ul><ul><ul><ul><li>...
Networking: ICF and ICW
Networking: Firewalls This is only necessary if NetBIOS is being used for file transfers across the firewall. NetBIOS over...
CPU Management <ul><li>CPU Resource Allocation </li></ul><ul><ul><li>Weight-Based Resource Allocation </li></ul></ul><ul><...
CPU Management: Example
CPU Management: Scripting <ul><li>CPU Performance History </li></ul><ul><ul><li>objVirtualMachine.Account.CPUUtilization <...
Managing Memory <ul><li>Memory Architecture </li></ul><ul><ul><li>Virtual Server can use all of the memory avaialble to th...
VMRC: Overview <ul><li>Configuring the VMRC Server </li></ul><ul><ul><li>VMRC Server is disabled by </li></ul></ul><ul><ul...
Virtualization Best Practices Tips and techniques for making the most of virtualization
Managing Performance <ul><li>Profile your applications </li></ul><ul><ul><li>Windows System Monitor </li></ul></ul><ul><ul...
VM Maintenance <ul><li>Establish a base library of images </li></ul><ul><ul><li>Ensures consistency </li></ul></ul><ul><ul...
VM Backup and Recovery <ul><li>Backup and Recovery </li></ul><ul><ul><li>Option 1: </li></ul></ul><ul><ul><ul><li>Shut dow...
More Best Practices <ul><li>“ Virtualization on a stick!” </li></ul><ul><ul><li>Use removable media for creating portable ...
The Future of Virtualization <ul><li>Other Virtualization Platforms: </li></ul><ul><ul><li>VMWare: </li></ul></ul><ul><ul>...
References <ul><li>Microsoft Resources </li></ul><ul><ul><li>Microsoft Virtual Server Web Site </li></ul></ul><ul><ul><ul>...
For More Information <ul><li>Realizing the Power of Virtualization </li></ul><ul><ul><li>Microsoft TechNet Magazine (Febru...
Upcoming SlideShare
Loading in …5
×

Using Virtualization To Improve Development And Testing

1,152 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,152
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
67
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Using Virtualization To Improve Development And Testing

  1. 1. Using Virtualization to Improve Development and Testing Anil Desai Austin .NET User’s Group January 9 th , 2006
  2. 2. Outline <ul><li>Virtualization Benefits and Scenarios </li></ul><ul><li>Virtual Server Architecture </li></ul><ul><li>Automating Virtual Server </li></ul><ul><ul><ul><ul><li>Virtual Machines </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Virtual Hard Disks </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Removable Media </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Virtual Networks </li></ul></ul></ul></ul><ul><ul><ul><ul><li>CPU / Memory </li></ul></ul></ul></ul><ul><li>Virtualization Best Practices </li></ul>
  3. 3. Presentation Overview <ul><li>Each section will cover: </li></ul><ul><ul><li>Technical Overview </li></ul></ul><ul><ul><li>Virtual Server Walkthrough </li></ul></ul><ul><ul><li>Scripting Overview </li></ul></ul><ul><ul><li>Script Example </li></ul></ul><ul><ul><li>Optimization Tips </li></ul></ul><ul><li>Sections: </li></ul><ul><ul><li>Managing Virtual Machines </li></ul></ul><ul><ul><li>Managing Virtual Hard Disks </li></ul></ul><ul><ul><li>Working with media </li></ul></ul><ul><ul><li>CPU and Memory Settings </li></ul></ul><ul><ul><li>Virtual Networks </li></ul></ul><ul><ul><li>VMRC Automation </li></ul></ul>
  4. 4. Virtualization Benefits and Scenarios How you can use virtualization to improve software development and testing
  5. 5. Introduction <ul><li>The question: “Is hardware getting faster faster than software is getting slower?” </li></ul><ul><li>The Answer: </li></ul><ul><ul><li>The Old Days: Software would see linear speed increases. </li></ul></ul><ul><ul><li>Today: Hardware is often left underutilized </li></ul></ul><ul><li>Business Case </li></ul><ul><ul><li>The modern IT environment: </li></ul></ul><ul><ul><ul><li>Capital costs for hardware are significant, but reasonable </li></ul></ul></ul><ul><ul><li>The real challenges today: </li></ul></ul><ul><ul><ul><li>Administration costs </li></ul></ul></ul><ul><ul><ul><li>Server management </li></ul></ul></ul><ul><ul><ul><li>Datacenter costs </li></ul></ul></ul>
  6. 6. Virtualization Features <ul><li>Benefits </li></ul><ul><ul><li>Simplified administration </li></ul></ul><ul><ul><li>Hardware independence/portability </li></ul></ul><ul><ul><li>Increased hardware utilization </li></ul></ul><ul><ul><li>Server consolidation </li></ul></ul><ul><ul><li>Decreased provisioning times </li></ul></ul><ul><ul><li>Improved security </li></ul></ul><ul><li>Scenarios </li></ul><ul><ul><li>Software Development </li></ul></ul><ul><ul><li>Testing / Quality Assurance </li></ul></ul><ul><ul><li>Product evaluations / demonstrations </li></ul></ul><ul><ul><li>Training </li></ul></ul><ul><ul><li>Disaster Recovery </li></ul></ul>
  7. 7. Development/Testing-Related Scenarios <ul><li>Setting up a complex test lab </li></ul><ul><ul><li>Testing multi-tier applications </li></ul></ul><ul><ul><li>Isolated networks </li></ul></ul><ul><ul><li>Simulating multiple clients </li></ul></ul><ul><li>Rapid setup and tear-down of test environments </li></ul><ul><ul><li>Consistent configurations </li></ul></ul><ul><ul><li>Ability to easily roll-back changes </li></ul></ul><ul><ul><li>Automation of VM setup and software installation </li></ul></ul><ul><li>Other Benefits </li></ul><ul><ul><li>Portability of VMs </li></ul></ul><ul><ul><li>Duplication of errors </li></ul></ul><ul><ul><li>Simplified administration </li></ul></ul>
  8. 8. Virtualization Candidates <ul><li>Getting Started </li></ul><ul><ul><li>Migrate existing apps / physical machines </li></ul></ul><ul><ul><li>Create new virtual machines from scratch </li></ul></ul><ul><li>Virtualization may not work well for: </li></ul><ul><ul><li>Resource-intensive applications </li></ul></ul><ul><ul><ul><li>Virtual Machines are limited to 1 CPU and 3.6GB RAM </li></ul></ul></ul><ul><ul><li>Performance testing </li></ul></ul><ul><ul><li>Hardware compatibility testing </li></ul></ul><ul><ul><li>Specific hardware requirements </li></ul></ul><ul><ul><ul><li>USB </li></ul></ul></ul><ul><ul><ul><li>Custom hardware devices </li></ul></ul></ul>
  9. 9. Estimating VM Resource Requirements <ul><li>Number of VMs </li></ul><ul><li>Estimated memory per VM </li></ul><ul><li>Estimated disk space per VM </li></ul><ul><li>Resource usage estimates </li></ul>High High Medium Low FileServer01 Low Medium Low Low WinXPTest Low Low High Low WebApp02 High Medium Low Low WebApp01 Network Disk Memory CPU VM Name
  10. 10. Virtual Server Architecture An Overview of Virtual Server 2005
  11. 11. Virtual Server Overview
  12. 12. Virtual Server Components <ul><li>Virtual Server Components </li></ul><ul><ul><li>Virtual Server Service (vssrvc.exe) </li></ul></ul><ul><ul><li>Virtual Machine Helper (vmh.exe) </li></ul></ul><ul><ul><li>Virtual Server Administration Web Site </li></ul></ul><ul><ul><li>Virtual Machine Remote Console (VMRC) </li></ul></ul><ul><li>New Features in Virtual Server 2005 R2 </li></ul><ul><ul><li>64-bit Host OS Support </li></ul></ul><ul><ul><li>Improved Guest OS Support </li></ul></ul><ul><ul><ul><li>Updated Virtual Machine Additions </li></ul></ul></ul><ul><ul><ul><li>Improved performance </li></ul></ul></ul><ul><ul><li>Other Features: </li></ul></ul><ul><ul><ul><li>Virtual SCSI Driver </li></ul></ul></ul><ul><ul><ul><li>Virtual Disk Precompactor </li></ul></ul></ul><ul><ul><ul><li>Support for PXE booting </li></ul></ul></ul>
  13. 13. Virtual Server Licensing <ul><li>General: </li></ul><ul><ul><li>OS license for the Host OS </li></ul></ul><ul><ul><li>OS license for each Guest OS </li></ul></ul><ul><ul><li>Virtual Server license </li></ul></ul><ul><ul><li>All applicable client licenses </li></ul></ul><ul><li>Details </li></ul><ul><ul><li>Up to four free guest OS’s on Win2003 R2 Enterprise Ed. </li></ul></ul><ul><ul><li>Only running VMs require licenses </li></ul></ul><ul><ul><li>For more info, see the MS Virtual Server Licensing Page </li></ul></ul><ul><li>Virtual Server Editions </li></ul><ul><ul><li>Standard Ed. = Up to 4 CPUs </li></ul></ul><ul><ul><li>Enterprise Ed. = Up to OS limit </li></ul></ul><ul><ul><li>Standard Ed. is included with an MSDN Subscription </li></ul></ul><ul><ul><li>180-day Trial version is also available </li></ul></ul>
  14. 14. Virtual Server vs. Virtual PC <ul><li>Virtual Server Features: </li></ul><ul><ul><li>Improved performance (multi-threaded) </li></ul></ul><ul><ul><li>Web-Based Administration </li></ul></ul><ul><ul><li>Scripting and automation support (COM API) </li></ul></ul><ul><ul><li>Improved security </li></ul></ul><ul><ul><li>Advanced networking </li></ul></ul><ul><ul><li>Manageability </li></ul></ul><ul><ul><li>SCSI Device Support </li></ul></ul><ul><ul><li>Reliability/availability features (clustering) </li></ul></ul><ul><li>Virtual PC Features: </li></ul><ul><ul><li>Optimized for one or a few concurrent VMs (single-threaded) </li></ul></ul><ul><ul><li>Simplified administration </li></ul></ul><ul><ul><li>Sound card emulation </li></ul></ul><ul><ul><li>Easier file sharing </li></ul></ul><ul><ul><li>Automatic client desktop resizing </li></ul></ul>
  15. 15. VM Compatibility (VPC vs. Virtual Server) <ul><li>Compatible: </li></ul><ul><ul><li>Virtual machine hardware platform </li></ul></ul><ul><ul><li>VM configuration files (.vmc) </li></ul></ul><ul><ul><li>Virtual hard disk files (.vhd) </li></ul></ul><ul><ul><li>Differencing disks </li></ul></ul><ul><ul><li>Undo disks (.vud) </li></ul></ul><ul><li>Incompatible: </li></ul><ul><ul><li>Saved-state files (.vsv) </li></ul></ul><ul><ul><li>SCSI-mounted virtual hard disks </li></ul></ul><ul><ul><li>CD/DVD-ROM devices (VirtualPC = 1; Virtual Server = 4) </li></ul></ul><ul><ul><li>Sound card support (not available in VirtualPC) </li></ul></ul><ul><ul><li>Network files </li></ul></ul>
  16. 16. Installing Virtual Server <ul><li>Pre-Installation: </li></ul><ul><ul><li>Admin Web Site Requires IIS (Application Server Role) </li></ul></ul><ul><ul><ul><li>On Windows XP, new Virtual Directory will be created </li></ul></ul></ul><ul><ul><ul><li>On Windows Server, new web site will be created (port 1024) </li></ul></ul></ul><ul><ul><li>Warning: Network connections will be temporarily dropped during installation </li></ul></ul><ul><li>Administration Web Site: </li></ul><ul><ul><li>Default URL: http:// ServerName :1024/VirtualServer/VSWebApp.exe </li></ul></ul><ul><li>Basic Virtual Server Settings </li></ul><ul><ul><li>Search Paths </li></ul></ul><ul><ul><li>Enabling the VMRC Server </li></ul></ul><ul><ul><li>Viewing the Event Log </li></ul></ul>
  17. 17. Emulated Hardware Platform Up to four Intel 21140 10/100Mb network interface cards Network Interfaces Up to four Adaptec 2940 SCSI Controllers (each supports up to 7 devices; 28 devices total) SCSI Controllers Two channels, each of which supports up to two devices each (up to four IDE total devices) IDE Controllers 2 Serial Port 1 Parallel Port Communications Ports Up to two 1.44MB 3.5” floppy drives Floppy Drives PS/2 Mouse and Keyboard Input Devices Up to 3.6GB Memory S3 Trio 32/64 with 4MB of video memory Video AMI BIOS BIOS Based on the host CPU (single CPU only) CPU Intel 440BX Chipset Specifications Component
  18. 18. Creating a New VM <ul><li>VM Hardware Configuration (demo) </li></ul><ul><li>OS Installation Options: </li></ul><ul><ul><li>1) Physical Media </li></ul></ul><ul><ul><li>2) ISO Files </li></ul></ul><ul><ul><li>3) Network-Based Installations </li></ul></ul><ul><ul><li>4) Automated deployment </li></ul></ul><ul><li>Installing the Virtual Machine Additions </li></ul><ul><ul><li>Improved general performance </li></ul></ul><ul><ul><li>Improved mouse and keyboard support </li></ul></ul><ul><ul><li>Time synchronization with the host </li></ul></ul><ul><ul><li>VM “heartbeats” </li></ul></ul><ul><li>Enabling Remote Management in the Guest </li></ul>
  19. 19. Virtual Server Files By default, these files will be stored in the same location as the .vmc file. .vud Undo disk files .vnc Virtual network configuration Stores information about the configuration of Virtual Server, including search paths, VMRC settings, and other options. Options.xml Virtual Server configuration file (options.xml) Stores the contents of memory for a virtual machine that has been placed in the “Saved” state By default, these files will be stored in the same location as the .vmc file. .vsv Saved State File This includes fixed-size hard disks, dynamically expanding hard disks and differencing disks. .vhd Virtual Hard Disk File An XML-based file that specifies disk, memory, and other settings for the virtual machine. .vmc Virtual Machine Configuration File Description Filename / Extension File Type
  20. 20. Automating Virtual Server Accessing the Virtual Server COM API
  21. 21. Introduction to the Object Model <ul><li>Setup installs the “Virtual Server 2005 Type Library” </li></ul><ul><ul><li>Can be accessed directly using VBScript </li></ul></ul><ul><ul><li>Can be added as a COM reference in Visual Studio 6.0 / Visual Studio .NET </li></ul></ul><ul><li>VirtualServer object </li></ul><ul><ul><li>Connect to a local or remote instance of Virtual Server </li></ul></ul><ul><ul><li>Add/Remove virtual machines </li></ul></ul><ul><ul><li>.VirtualMachines collection provides list of defined VMs </li></ul></ul><ul><ul><li>.FindVirtualMachine method used for getting a VM object by name </li></ul></ul><ul><ul><li>Create “global” objects: virtual networks, virtual hard disks, etc. </li></ul></ul><ul><li>VirtualMachine object </li></ul><ul><ul><li>Represents an existing virtual machine </li></ul></ul><ul><ul><li>Control VM power states (turn on, turn off, etc.) </li></ul></ul><ul><ul><li>Contains properties and collections for the virtual hardware configuration </li></ul></ul><ul><ul><li>.Accountant can be used to get performance statistics </li></ul></ul>
  22. 22. Setup: Visual Studio .NET <ul><li>Add the COM reference for “Virtual Server 2005 R2 Type Library” </li></ul><ul><ul><li>Add the namespace of Microsoft.VirtualServer.Interop </li></ul></ul><ul><ul><li>Should use the multi-threaded apartment (MTA) model (STA may cause performance problems) </li></ul></ul><ul><li>COM Security: </li></ul><ul><ul><li>Virtual Server requires “Impersonation” (or higher) level </li></ul></ul><ul><ul><li>“ Identification” is the default, therefore must call CoIntializeEx(), then CoInitializeSecurity() before accessing the Virtual Server Interfaces </li></ul></ul><ul><ul><li>Alternatively, use DComCnfg.exe and modify the Default Properties to set the Default Impersonation Level to “Impersonate” </li></ul></ul><ul><li>Visual Studio 2005: </li></ul><ul><ul><li>Disable debugging under the Visual Studio host process to prevent COM security errors </li></ul></ul><ul><ul><li>In Visual Studio, click on the Properties of a project, then uncheck “Enable the Visual Studio hosting process.” </li></ul></ul><ul><li>More information: </li></ul><ul><ul><li>Virtual Server Programmer’s Guide (full sample code for C#) </li></ul></ul><ul><ul><li>Blog: “ Programming Virtual Server from a managed application ” (Ben Armstrong) </li></ul></ul>
  23. 23. Virtual Machines: Overview <ul><li>A virtual machine consists of: </li></ul><ul><ul><li>VM Configuration file (.vmc) </li></ul></ul><ul><ul><li>Associated VHD files (.vhd) </li></ul></ul><ul><ul><li>Virtual network file (.vnc) </li></ul></ul><ul><ul><li>Other hardware options </li></ul></ul><ul><li>Demonstration </li></ul><ul><ul><li>Enumerating VMs </li></ul></ul><ul><ul><li>Creating a New VM </li></ul></ul><ul><ul><li>Adding a VM </li></ul></ul><ul><ul><li>Changing VM Properties </li></ul></ul>
  24. 24. VM Power States <ul><li>Virtual Machine power operations: </li></ul><ul><ul><li>Turn On / Turn Off </li></ul></ul><ul><ul><li>Reset </li></ul></ul><ul><ul><li>Shut Down Guest OS </li></ul></ul><ul><ul><li>Save State </li></ul></ul><ul><ul><li>Pause </li></ul></ul><ul><li>Guest OS Power Management </li></ul><ul><ul><li>Standby </li></ul></ul><ul><ul><li>Suspend </li></ul></ul><ul><ul><li>Hibernate </li></ul></ul><ul><li>By default, VMs are placed in Saved State when the Virtual Server service is stopped </li></ul><ul><ul><li>VMs are not automatically started, by default </li></ul></ul>
  25. 25. Virtual Server Scripting Events <ul><li>Server-Level Scripts: </li></ul><ul><ul><li>Virtual Server starts </li></ul></ul><ul><ul><li>Virtual Server stops </li></ul></ul><ul><ul><li>Any Virtual Machine is turned on </li></ul></ul><ul><ul><li>Any virtual machine is restored </li></ul></ul><ul><ul><li>Any virtual machine is turned off (saved) </li></ul></ul><ul><ul><li>Any virtual machine is turned off (not saved) </li></ul></ul><ul><ul><li>Any virtual machine is turned off within the guest environment </li></ul></ul><ul><ul><li>Any virtual machine is reset </li></ul></ul><ul><ul><li>No heartbeat is detected for any virtual machine: If the Guest operating system stops responding for three minutes, this event is raised. </li></ul></ul><ul><ul><li>Any virtual machine experiences a guest processor error </li></ul></ul><ul><ul><li>Any virtual machine receives a warning due to low disk space on the physical computer: The warning is generated when physical disk space on the host is under 100MB. </li></ul></ul><ul><ul><li>Any virtual machine receives an error due to low disk space on the physical computer </li></ul></ul><ul><li>Virtual Machine Scripts: </li></ul><ul><ul><li>This virtual machine is turned on </li></ul></ul><ul><ul><li>This virtual machine is restored </li></ul></ul><ul><ul><li>This virtual machine is saved and turned off </li></ul></ul><ul><ul><li>This virtual machine is turned off (and not saved) </li></ul></ul><ul><ul><li>This virtual machine is turned off within the guest environment </li></ul></ul><ul><ul><li>This virtual machine is reset </li></ul></ul><ul><ul><li>No heartbeat is detected for this virtual machine </li></ul></ul><ul><ul><li>This virtual machine experiences a guest processor error </li></ul></ul><ul><ul><li>This virtual machine receives a warning due to low disk space on the physical computer </li></ul></ul><ul><ul><li>This virtual machine receives an error to do low disk space on the physical computer </li></ul></ul>
  26. 26. Virtual Machines: Tips <ul><li>Whenever possible, store files for each VM in a single folder </li></ul><ul><li>Moving/Copying VMs: </li></ul><ul><ul><li>Shut down (or save state of) the virtual machine. </li></ul></ul><ul><ul><li>Move or copy all required files to the destination server. </li></ul></ul><ul><ul><li>Add the virtual machine on the destination server (using the Virtual Server Administration web site) </li></ul></ul><ul><ul><li>If the path to any physical VHD file has changed, edit the configuration of the virtual machine to point to the new physical location </li></ul></ul><ul><ul><li>(Optional) Remove the VM from the source server (to prevent conflicts) </li></ul></ul>
  27. 27. Managing Media: Overview <ul><li>Changing media: </li></ul><ul><ul><li>Media can be mounted/changed while the VM is running </li></ul></ul><ul><ul><li>Media devices can only be added or removed when the VM is not running </li></ul></ul><ul><li>Hardware: </li></ul><ul><ul><li>Can have up to four virtual CD/DVD devices and one floppy device </li></ul></ul><ul><ul><li>Can capture a physical device on the host or capture image files </li></ul></ul><ul><li>Image File Types: </li></ul><ul><ul><li>ISO Images: </li></ul></ul><ul><ul><ul><li>Can represent CD or DVD media </li></ul></ul></ul><ul><ul><ul><li>Read-only </li></ul></ul></ul><ul><ul><li>Floppy Disk Images </li></ul></ul><ul><ul><ul><li>Can be created within Virtual Server </li></ul></ul></ul><ul><ul><ul><li>Read/Write </li></ul></ul></ul>
  28. 28. Managing Media: Scripts <ul><li>Adding/Removing DVD ROM drives: </li></ul><ul><ul><li>objVirtualMachine.DVDROMDrives: Collection of VMDVDDrive objects </li></ul></ul><ul><ul><li>objVirtualMachine.AddDVDROMDrive( BusType, BusNumber, DeviceNumber ) </li></ul></ul><ul><ul><li>objVirtualMachine.RemoveDVDROMDrive( VMDVDDrive object ) </li></ul></ul><ul><li>Capturing Media: </li></ul><ul><ul><li>objDVDRomDrive.AttachHostDrive(string HostDriveLetter ) </li></ul></ul><ul><ul><li>objDVDRomDrive.AttachImage(string path ) </li></ul></ul><ul><ul><li>objDVDRomDrive.ReleaseImage(string path ) </li></ul></ul><ul><li>Tips: </li></ul><ul><ul><li>Mounting media files is useful for software deployment/updates </li></ul></ul><ul><ul><li>Use startup Registry keys to automatically install software </li></ul></ul>
  29. 29. Disk Architecture: Technical Overview
  30. 30. Base Virtual Hard Disk Types <ul><li>Base Disk Types: </li></ul><ul><ul><li>Fixed-Size VHDs </li></ul></ul><ul><ul><ul><li>Best performance, lowest space utilization </li></ul></ul></ul><ul><ul><li>Dynamically-Expanding VHDs </li></ul></ul><ul><ul><ul><li>Overhead due to expansion and fragmentation </li></ul></ul></ul><ul><ul><ul><li>Can be compacted to reclaim space </li></ul></ul></ul><ul><ul><li>Linked Disks </li></ul></ul><ul><ul><ul><li>Links to an entire physical disk (not just a volume) </li></ul></ul></ul><ul><ul><ul><li>Used primarily for physical-to-virtual (P2V) conversions </li></ul></ul></ul><ul><li>Virtual Attachment Options: </li></ul><ul><ul><li>IDE </li></ul></ul><ul><ul><ul><li>2 channels * 2 devices each </li></ul></ul></ul><ul><ul><ul><li>Up to 127GB disk size </li></ul></ul></ul><ul><ul><li>SCSI </li></ul></ul><ul><ul><ul><li>Up to 4 controllers * 7 devices each </li></ul></ul></ul><ul><ul><ul><li>Up to 2.0TB disk size </li></ul></ul></ul>
  31. 31. State-Related Disks <ul><li>Undo Disks (.vud) </li></ul><ul><ul><li>Applies to an entire virtual machine </li></ul></ul><ul><ul><li>Options: </li></ul></ul><ul><ul><ul><li>Keep </li></ul></ul></ul><ul><ul><ul><li>Commit </li></ul></ul></ul><ul><ul><ul><li>Discard </li></ul></ul></ul><ul><li>Differencing Disks (.vhd) </li></ul><ul><ul><li>Can be based on fixed-size, dynamically-expanding, or linked hard disks </li></ul></ul><ul><ul><li>Allows the creation of a disk hierarchy </li></ul></ul><ul><ul><li>Parent disks must be read-only </li></ul></ul><ul><li>Saved-state files (.vsv) </li></ul><ul><ul><li>Contains contents of memory </li></ul></ul><ul><ul><li>Virtual Server automatically reserves disk space based on memory allocation </li></ul></ul>
  32. 32. Undo Disks: Example
  33. 33. Differencing Disks: Example
  34. 34. Merging Differencing Disks
  35. 35. Managing Virtual Hard Disks <ul><li>Converting VHDs </li></ul><ul><ul><li>Fixed-Size  Dynamically-Expanding </li></ul></ul><ul><ul><li>Linked disk to Fixed-size or dynamically-expanding </li></ul></ul><ul><li>Compacting VHDs </li></ul><ul><ul><li>Disk space requirements </li></ul></ul><ul><ul><li>Use the Virtual Disk Precompactor </li></ul></ul><ul><ul><li>Can be very resource intensive </li></ul></ul><ul><li>Disk Defragmentation </li></ul><ul><ul><li>Host: Optimizes VHD file placement </li></ul></ul><ul><ul><li>Guest: Reduces IO within the VM </li></ul></ul>
  36. 36. Disk Management: Scripting <ul><li>Enumerating virtual hard disk files </li></ul><ul><ul><li>objVirtualMachine.HardDiskConnections </li></ul></ul><ul><ul><ul><li>Collection of Hard Disk Connection objects </li></ul></ul></ul><ul><ul><li>objHDConnection.HardDisk.File </li></ul></ul><ul><ul><ul><li>Phyiscal filename/path of the VHD file </li></ul></ul></ul><ul><li>Creating virtual hard disks </li></ul><ul><ul><li>objVirtualMachine.CreateDynamicVirtualHardDisk( path, size ) </li></ul></ul><ul><ul><li>objVirtualMachine.CreateFixedVirtualHardDisk( path, size ) </li></ul></ul><ul><ul><li>objVirtualServer. CreateDifferencingVirtualHardDisk ( path, ParentPath ) </li></ul></ul><ul><li>Adding a virtual hard disk: </li></ul><ul><ul><li>objVirtualMachine.AddHardDiskConnection ( path, BusType, BusNumber, DeviceNumber ) </li></ul></ul>
  37. 37. Disk Management Tips: <ul><li>Monitor Disk Space </li></ul><ul><ul><li>PerfMon: Logical Disk  % Free Space </li></ul></ul><ul><ul><li>Use Virtual Server / Virtual Machine events to send alerts </li></ul></ul><ul><li>Host Interface Types: </li></ul><ul><ul><ul><li>IDE </li></ul></ul></ul><ul><ul><ul><li>Serial ATA (SATA) </li></ul></ul></ul><ul><ul><ul><li>SCSI </li></ul></ul></ul><ul><ul><ul><li>RAID Controllers </li></ul></ul></ul><ul><li>Performance Tips </li></ul><ul><ul><li>Separate files across multiple spindles </li></ul></ul><ul><ul><li>Use SCSI disks within the virtual machine </li></ul></ul><ul><ul><li>Monitor disk resource usage to better distribute virtual machines </li></ul></ul>
  38. 38. Network Architecture: Overview
  39. 39. Network Architecture: Details <ul><li>Virtual network options: </li></ul><ul><ul><li>Guest-only </li></ul></ul><ul><ul><li>Host Network </li></ul></ul><ul><ul><li>Guest-to-host only (through Microsoft Loopback Adapter) </li></ul></ul><ul><li>Network Adapters </li></ul><ul><ul><li>All Ethernet NIC types are supported </li></ul></ul><ul><ul><li>The Virtual Machine Networking Service must be enabled for Virtual Server to use the adapter </li></ul></ul><ul><ul><li>Each VM can have up to four virtual NICs </li></ul></ul><ul><ul><li>A dedicated NIC can be used for Virtual Server </li></ul></ul><ul><ul><ul><li>Only the Virtual Machine Networking Service must be bound </li></ul></ul></ul><ul><li>More Features </li></ul><ul><ul><li>Virtual DHCP Server for each virtual network </li></ul></ul><ul><ul><li>Integration with Internet Connection Firewall (ICF) and Internet Connection Sharing (ICS) </li></ul></ul>
  40. 40. Networking: Scripting <ul><li>Managing Virtual Networks: </li></ul><ul><ul><li>objVirtualServer.VirtualNetworks </li></ul></ul><ul><ul><ul><li>Collection of virtual networks </li></ul></ul></ul><ul><ul><li>objVirtualServer.CreateVirtualNetwork ( name, path ) </li></ul></ul><ul><ul><li>objVirtualServer.RegisterVirtualNetwork ( name, path ) </li></ul></ul><ul><li>Managing Virtual Network Adapters </li></ul><ul><ul><li>objVirtualMachine.NetworkAdapters </li></ul></ul><ul><ul><ul><li>Collection of network adapter objects </li></ul></ul></ul><ul><ul><li>objNetworkAdapter.AttachToVirtualNetwork() </li></ul></ul><ul><ul><li>objNetworkAdapter.AttachToVirtualNetwork( NetworkName ) </li></ul></ul><ul><ul><li>objNetworkAdapter.DetachFromVirtualNetwork() </li></ul></ul>
  41. 41. Network-Based Storage <ul><li>Improving Performance: </li></ul><ul><ul><li>Use NIC Teaming </li></ul></ul><ul><ul><ul><li>Fail-over </li></ul></ul></ul><ul><ul><ul><li>Load-balancing </li></ul></ul></ul><ul><ul><li>Use Jumbo Frames </li></ul></ul><ul><li>Remote Storage </li></ul><ul><ul><li>CIFS / SMB (UNC Shares) </li></ul></ul><ul><ul><li>Multiple VMs can access the same files </li></ul></ul><ul><li>Network-Attached Storage (NAS) </li></ul><ul><ul><li>Dedicated “appliances” that provide file-level I/O </li></ul></ul><ul><li>Storage Area Networks (SANs) </li></ul><ul><ul><li>Fibre Channel-based, block-level I/O </li></ul></ul><ul><ul><li>High performance, but highest cost </li></ul></ul><ul><li>iSCSI </li></ul><ul><ul><li>Block-level I/O over Ethernet </li></ul></ul><ul><ul><li>Performance benefits of SANs with much lower costs (uses copper) </li></ul></ul><ul><ul><li>Supported on the Host OS as well as from within Guest OS’s </li></ul></ul>
  42. 42. Networking: ICF and ICW
  43. 43. Networking: Firewalls This is only necessary if NetBIOS is being used for file transfers across the firewall. NetBIOS over TCP/IP 137 – 139 These ports are used only when Kerberos is being used (for example, when Active Directory-based users are attempting to authenticate to the VMRC server). VMRC Kerberos Authentication 88, 137, 138 By default, the VMRC server is disabled. The port number can be modified using the Virtual Server Administration Web Site (see Chapter #9). VMRC Server 5900 The port can be changed during the installation of Virtual Server, or afterwards (see Chapter #9 for details). Administrators can also enable SSL within IIS. Virtual Server Administration Web Site. 1024 Notes Purpose TCP Port Number
  44. 44. CPU Management <ul><li>CPU Resource Allocation </li></ul><ul><ul><li>Weight-Based Resource Allocation </li></ul></ul><ul><ul><ul><li>Simpler method (single number to adjust) </li></ul></ul></ul><ul><ul><ul><li>Ensures full resource usage </li></ul></ul></ul><ul><ul><li>Constraint-Based Resource Allocation </li></ul></ul><ul><ul><ul><li>Reserved capacity </li></ul></ul></ul><ul><ul><ul><li>Maximum capacity </li></ul></ul></ul><ul><ul><ul><li>More complicated, but finer-grained control </li></ul></ul></ul><ul><li>Host CPU Options: </li></ul><ul><ul><li>Hyper-Threading </li></ul></ul><ul><ul><li>Dual-Core / Multi-Core </li></ul></ul><ul><ul><li>64-Bit (Large Memory Support) </li></ul></ul><ul><ul><li>Virtualization Support </li></ul></ul><ul><ul><ul><li>AMD’s “Pacifica” </li></ul></ul></ul><ul><ul><ul><li>Intel’s VT </li></ul></ul></ul><ul><li>Heat-Related Issues </li></ul><ul><ul><li>CPUs will automatically step-down when heat thresholds are exceeded </li></ul></ul>
  45. 45. CPU Management: Example
  46. 46. CPU Management: Scripting <ul><li>CPU Performance History </li></ul><ul><ul><li>objVirtualMachine.Account.CPUUtilization </li></ul></ul><ul><ul><ul><li>Last CPU utilization statistic </li></ul></ul></ul><ul><ul><li>objVirtualMachine.Account.CPUUtilizationHistory </li></ul></ul><ul><ul><ul><li>Array of CPU util. stats </li></ul></ul></ul><ul><li>Modifying CPU Settings </li></ul><ul><ul><li>objVirtualMachine.Accountant. </li></ul></ul><ul><ul><ul><li>.relativeWeight </li></ul></ul></ul><ul><ul><ul><li>.reservedSystemCapacity </li></ul></ul></ul><ul><ul><ul><li>.allowableMaximumSystemCapacity </li></ul></ul></ul><ul><ul><ul><li>.allowableReservedSystemCapacity </li></ul></ul></ul><ul><li>.NET Apps can also easily use system performance counters </li></ul>
  47. 47. Managing Memory <ul><li>Memory Architecture </li></ul><ul><ul><li>Virtual Server can use all of the memory avaialble to the host OS </li></ul></ul><ul><ul><ul><li>For 32-bit, large memory support, enable PAE </li></ul></ul></ul><ul><ul><ul><li>For large installations, 64-bit is better </li></ul></ul></ul><ul><ul><li>Up to 3.6GB of physical memory per VM </li></ul></ul><ul><ul><li>Memory settings can be changed only when VM is turned off </li></ul></ul><ul><ul><li>Be sure to leave physical memory for the host OS </li></ul></ul><ul><ul><li>Allow an additional ~32MB for each virtual machine (virtualization overhead) </li></ul></ul><ul><ul><li>Physical memory cannot be over-committed </li></ul></ul><ul><li>Scripting Memory Settings </li></ul><ul><ul><li>objVirtualMachine.Memory property </li></ul></ul><ul><ul><ul><li>Amount of Memory (in bytes) (read-write property) </li></ul></ul></ul>
  48. 48. VMRC: Overview <ul><li>Configuring the VMRC Server </li></ul><ul><ul><li>VMRC Server is disabled by </li></ul></ul><ul><ul><ul><li>Enabled in Server Properties (VS Admin Web Site) </li></ul></ul></ul><ul><ul><li>Potential security issues with default configuration: </li></ul></ul><ul><ul><ul><li>Unencrypted communications </li></ul></ul></ul><ul><ul><ul><li>NTLM security </li></ul></ul></ul><ul><ul><li>Can customize TCP address and ports </li></ul></ul><ul><ul><li>Can enable SSL/TLS security </li></ul></ul><ul><ul><ul><li>Encryption </li></ul></ul></ul><ul><ul><ul><li>Certificates </li></ul></ul></ul><ul><li>VMRC Client </li></ul><ul><ul><li>ActiveX control that can be hosted in IE or within a client app </li></ul></ul><ul><ul><li>COM Reference: </li></ul></ul><ul><ul><ul><li>Virtual Machine Remote Control (VMRC) ActiveX client type library </li></ul></ul></ul><ul><ul><ul><li>Added to .NET namespace VMRCClientControl.Interop </li></ul></ul></ul><ul><ul><ul><li>In Visual Studio, add the ActiveX control using Tools  Choose Toolbox Items. Under “COM Components”, enable “Microsoft Virtual Server VMRC Control” </li></ul></ul></ul>
  49. 49. Virtualization Best Practices Tips and techniques for making the most of virtualization
  50. 50. Managing Performance <ul><li>Profile your applications </li></ul><ul><ul><li>Windows System Monitor </li></ul></ul><ul><ul><ul><li>Counter Logs </li></ul></ul></ul><ul><ul><li>Event Viewer </li></ul></ul><ul><ul><li>Task Manager </li></ul></ul><ul><ul><li>Windows Management Instrumentation (WMI) </li></ul></ul><ul><ul><li>Microsoft Operations Manager (MOM) </li></ul></ul><ul><ul><li>Systems Management Server (SMS) </li></ul></ul><ul><li>Monitoring Approach: </li></ul><ul><ul><li>Host Server: Aggregate performance data </li></ul></ul><ul><ul><li>Guest OS: Detailed resource usage </li></ul></ul>
  51. 51. VM Maintenance <ul><li>Establish a base library of images </li></ul><ul><ul><li>Ensures consistency </li></ul></ul><ul><ul><li>Helps in troubleshooting </li></ul></ul><ul><ul><li>Prepare VMs for duplication (SysPrep) </li></ul></ul><ul><li>Create a Library of ISO files </li></ul><ul><li>Manage virtual machines as if they were physical machines </li></ul><ul><ul><li>Security updates </li></ul></ul><ul><ul><ul><li>Automatic Updates (if supported in Guest OS) </li></ul></ul></ul><ul><ul><ul><li>Microsoft Baseline Security Analyzer (MBSA) </li></ul></ul></ul><ul><ul><ul><li>Windows Server Update Services (SUS) </li></ul></ul></ul><ul><ul><li>Patches </li></ul></ul><ul><ul><li>Corporate security standards </li></ul></ul><ul><li>Configure anti-spyware / anti-malware exceptions </li></ul><ul><ul><li>*.vhd, *.vud, *.vsv, *.iso </li></ul></ul><ul><li>Automate common tasks </li></ul>
  52. 52. VM Backup and Recovery <ul><li>Backup and Recovery </li></ul><ul><ul><li>Option 1: </li></ul></ul><ul><ul><ul><li>Shut down/save state of the VM </li></ul></ul></ul><ul><ul><ul><li>Copy all required files. </li></ul></ul></ul><ul><ul><ul><li>Resume the VM </li></ul></ul></ul><ul><ul><li>Option 2: </li></ul></ul><ul><ul><ul><li>Use Backup Agents within the Guest OS. </li></ul></ul></ul><ul><li>Automating backups: </li></ul><ul><ul><li>Build scripts/applications to automate virtual machine backup and recovery: </li></ul></ul><ul><ul><ul><li>1) Save state of the virtual machine </li></ul></ul></ul><ul><ul><ul><li>2) Copy all related files </li></ul></ul></ul><ul><ul><ul><li>3) Resume the virtual machine </li></ul></ul></ul>
  53. 53. More Best Practices <ul><li>“ Virtualization on a stick!” </li></ul><ul><ul><li>Use removable media for creating portable VMs </li></ul></ul><ul><li>Treat virtual machines like physical ones </li></ul><ul><ul><li>Standard security and maintenance practices </li></ul></ul><ul><li>Consider performing Physical to Virtual (p2v) migrations </li></ul><ul><ul><li>Virtual Server Migration Toolkit (VSMT) </li></ul></ul><ul><ul><li>Third-party utilities </li></ul></ul>
  54. 54. The Future of Virtualization <ul><li>Other Virtualization Platforms: </li></ul><ul><ul><li>VMWare: </li></ul></ul><ul><ul><ul><li>Workstation </li></ul></ul></ul><ul><ul><ul><li>GSX Server </li></ul></ul></ul><ul><ul><ul><li>ESX Server </li></ul></ul></ul><ul><ul><li>XEN Open Source Virtualization Platform </li></ul></ul><ul><ul><li>CPUs: </li></ul></ul><ul><ul><ul><li>Intel </li></ul></ul></ul><ul><ul><ul><li>AMD </li></ul></ul></ul><ul><ul><ul><li>Sun </li></ul></ul></ul><ul><ul><li>Third-Party Vendors </li></ul></ul><ul><li>Windows Vista / Longhorn Server </li></ul><ul><ul><li>Virtualization will use a “hypervisor” approach and will be included in the platform </li></ul></ul>
  55. 55. References <ul><li>Microsoft Resources </li></ul><ul><ul><li>Microsoft Virtual Server Web Site </li></ul></ul><ul><ul><ul><li>Downloadable White Papers and updates </li></ul></ul></ul><ul><ul><ul><li>Pricing and licensing information </li></ul></ul></ul><ul><ul><li>Microsoft Virtual Server Script Repository </li></ul></ul><ul><ul><ul><li>Hundreds of sample scripts (VBScript format) </li></ul></ul></ul><ul><ul><li>“ Program Customized Testing Environments Without Trashing Your Machine ” (Ben Waldron, MSDN Magazine) </li></ul></ul><ul><li>Community Resources </li></ul><ul><ul><li>http:// AnilDesai.net (content planned for 01/2006) </li></ul></ul><ul><ul><li>Virtualization.info (blog) </li></ul></ul><ul><ul><li>Virtual PC Guy’s WebLog (Ben Armstrong) </li></ul></ul>
  56. 56. For More Information <ul><li>Realizing the Power of Virtualization </li></ul><ul><ul><li>Microsoft TechNet Magazine (February, 2006) </li></ul></ul><ul><li>The Rational Guide to Managing Microsoft Virtual Server 2005 </li></ul><ul><ul><li>Q1, 2006 (Anil Desai) </li></ul></ul><ul><li>The Rational Guide to Scripting Virtual Server 2005 </li></ul><ul><ul><li>Q2, 2006 (Anil Desai) </li></ul></ul><ul><li>Contact Anil Desai </li></ul><ul><ul><li>E-Mail: [email_address] </li></ul></ul><ul><ul><li>Web Site: http://AnilDesai.net </li></ul></ul><ul><ul><ul><li>Copies of the slides and source code </li></ul></ul></ul>

×