|By Rob Hirschfeld, Richard Cardona||
|December 7, 2004 12:00 AM EST||
Microsoft Virtual Server 2005 (VS2005), a new addition to the Microsoft Server family, emulates physical hardware to create multiple independently operating environments or virtual machines (VMs).
This article reviews portions of a C# application leveraging the VS2005 API. We will get you started with VS2005 here. The complete application code demonstrates one of the more interesting aspects of VMs: differencing hard drives. These drive disks allow you to toggle a VM from one configuration to a different configuration and back. This capability is especially useful for software testing and verification, where hardware resources are limited.
VS2005 is amazingly powerful but also adds a new level of complexity to server management. The VS2005 background and code provided in this article are just the tip of the iceberg to get you started. Take some time to work with virtualization. You'll quickly see how easily virtualization can benefit your organization.
Virtual Server Background
A full introduction to VS2005 could fill a book. The objective of this article is not to overwhelm you with details, but to show you how to write a simple interface program to VS2005 that does useful work. Before diving into code, some brief background on virtualization is necessary.
Virtualization enables a single physical server, or host, to be partitioned into many independently operating virtual servers. As depicted in Figure 1, the VS2005 software emulates the disk, network, keyboard/video/ mouse, processor, and memory needed to create a server. Each server is totally isolated from the others with no visibility into other VMs running on the same host. The virtualization software governs resource usage to ensure that one VM does not consume all of the host's CPU capacity.
It is important to distinguish between hosts and VMs for VS2005 compatibility. The host that runs the virtualization software must be running Windows Server 2003 (Windows XP works but is not "supported"). The VMs run a broad range of operating systems, including most flavors of Linux, DOS, Novell, Windows NT, and recent Windows releases but Microsoft will only support Windows. Microsoft, in fact, intends for VMs to become the primary supported platform for Windows NT.
What Makes Virtualization Compelling?
Virtualization is compelling because of the increased efficiency and control it brings to the physical server data center. Our company, Surgient, Inc., is an on-demand enterprise software company whose applications automate software sales, marketing, training, and testing processes. Surgient has been using virtualization platforms since 2001 as early beta testers of first-generation virtual server products. During that time, we have deployed over a thousand hosts and uncountable VMs. If you've experienced the Microsoft Visual Studio.NET hands-on trial, then you've used the Surgient demo management product and you've also used a VM! The VMs powering that site have served over 100,000 demos of VS.NET.
From the beginning, we recognized that VMs were fundamentally different and much more flexible than physical servers. The host's APIs enable programmatic control to manage the virtual servers. The price of this flexibility is additional planning and management of data center operations.
On a virtualization host, servers compete for limited amounts of memory (RAM), processor (CPU), and storage (disk). VS2005 VMs, like physical servers, need sufficient RAM to operate. They block out their full memory footprint on the host. You can, however, release a VM's memory by turning off the VM, which enables you to maintain more VM configurations than you can concurrently run.
These idle virtual images voraciously consume large amounts of disk. This means that a typical host may not have enough space to store many idle 4-10 GB virtual image files. VS2005 partially solves this problem by allowing VMs to chain image files into differencing layers that share a common base image.
The VS2005 differencing layer technology is called differencing disks (undo drives are a variant of differencing disks). This technology enables you to create a base image of the operating system and then install applications into a difference disk layer. A single base image can then be used by several VMs that each have a unique differencing disk.
Our sample scenario is a code development and testing environment for a three-tier application. The host server is a dual-processor server with 2GB of RAM and 120GB of RAID 5 disk. The proposed demo application must support both SQL Server and Oracle, each of which requires at least 1GB of RAM for testing. How can we use VS2005 to test the application in all its permutations using only the host server?
Memory is the obvious contention point. Of the available 2GB on the host, one quarter is reserved as overhead for the host operating system and VS2005, leaving just 1.5GB for the three application tiers. Since the databases each require 1GB, the entire application will just barely run on the host. To test both database platforms, we will have to keep one turned off while we are testing the other. Toggling the servers will keep our RAM use within the limits of the host.
Storage is a less obvious but equally serious challenge. Assuming 100GB available of the 120GB total should give ample room to store VM disk files. If we assume 10GB per VM, then we could store 10 VMs. Ten quickly drops to five if we plan to keep one archive copy of each VM.
Differencing disks provide the solution to both these issues. Our database server requires a 4GB Windows 2003 base image and two distinct differencing disks (SQL at 4GB and Oracle at 6GB). Without differencing, the two servers would consume 18GB of disk. Sharing the base image uses just 14, saving 4GB of disk. It is not necessary to archive the shared base because it does not change. We do, however, want to archive each differencing disk. The total storage is 24 GB, down from 36 GB without the use of differencing disks (see Figure 2).
Toggling the VM power states and working with shared base images addresses the resource limitations of the host.
Programming Virtualization Control
To use our testing environment, we must create a small .NET application that toggles between server configurations by changing both the VM's power state and its differencing disk configuration.
The C# sample application will provide the following features:
- Create a VM with appropriate components, including differencing and undo drives
- Manage the VM's power (Start and Stop)
- Change the disk configuration of an existing machine
- Simple user interface
Before the program can run, it needs a reference for the VS2005 API. VS2005 provides a COM interface and requires a .NET Interop to use it. Visual Studio creates the Interop automatically when we add Microsoft Virtual Server from the COM Components tab from the Tools...Add/Remove Toolbox Items menu. This process will add the using Microsoft.VirtualServer.Interop reference to the code.
In addition to referencing the COM Interop, VS2005 requires COM security to enforce access control. Our sample application includes a dedicated class, COMServices, to provide this critical initialization. Your VS2005 application must include this or similar code. A call to COMServices. Initialize() is all that is needed before we can start using the VS2005 API.
The VS2005 API has two primary categories of functions. The first category controls the virtualization platform on the host, while the second controls states and attributes of individual VMs. The interface to the host is created by instantiating a new VMVirtualServerClass object. Once this object exists, it is possible to create VMVirtualMachine objects by either creating new VMs using CreateVirtualMachineVM or getting a reference to an existing VM using FindVirtualMachine.
The example application calls the host object "vs" for Virtual Server. Here is the code to attach to the host API:
VMVirtualServerClass vs = new VMVirtualServerClass();
Creating a Virtual Machine
The first step in creating a VM is deciding where to store the multigigabyte virtual disk files that store the data of the VM's hard drives. The VS2005 default is to bury the files deep in the Documents and Settings directory tree, which can cause serious issues on systems with multiple partitions as the largest files default to the operating system's partition. Change the default path for VMs from the VS2005 Web interface in the Virtual Server...Server Properties section. The VMs are stored in directories under the default virtual machine configuration folder. In this example, the host will store VMs on the second partition (d:) in the "vms" subdirectory.
Creating a VM is a multistep process. The basic CreateVirtualMachine method only creates a VM stub. The VM's RAM, disk, and network must be configured before it is usable. However, you cannot just attach disk and network to a VM; you must "install" virtual devices before you can attach media to them. Specifically, you must add a network adapter to your VM before you can attach it to the network and you must specify which IDE or SCSI ports you are using when you attach drives.
The first step is to create the VM stub. The application calls the VM object vm. Here is the code requesting the host object to create a VM:
VMVirtualMachine vm = vs.CreateVirtualMachine("vm01","d:\vms\vm01");
With the VM stub, it is possible to configure the VM's properties. Memory is the easiest to configure:
vm.Memory = 256;
Attaching a hard drive requires an existing virtual hard disk (VHD) file. You can use an existing one or create one dynamically. VHD files are configured to a maximum possible size and expand dynamically as data is added. The maximum size is specified in megabytes, so the code sample uses a 1K multiplication to improve readability. Here is how the host object is told to create a VHD file:
vs.CreateDynamicVirtualHardDisk("d:\vms\vm01.vhd", 16 * 1024)
Instead of creating a new disk (shown above), you can add a differencing disk to an existing hard disk. A differencing disk inherits the maximum size from its parent and also stores the parent's location in its header. You must supply both a unique disk name and the parent disk when you create a difference disk:
Once the disk file exists, it can be attached to the VM by selecting a bus (IDE or SCSI) and the bus address. If the disk is a differencing disk, only the difference disk file is provided for connection. The parent disk is not programmatically connected because the difference disk already has the reference location for its parent disk. In this example, VS2005 will connect the drive at address IDE 0:0:
vm.AddHardDiskConnection("d:\vms\vm01.vhd", VMDriveBusType.vmDriveBusType_IDE, 0, 0);
Undoable mode is an important VS2005 feature because it allows you to maintain a working session for your server. When using undoable drives, you can maintain, commit, or discard the working session. There is minimal performance impact for this feature, and it eliminates the time wasted recovering or rebuilding server environments. Undoable mode is an attribute of the VM and applies to all drives:
vm.undoable = true;
Connecting the new network adapter to the correct host network is more challenging. The result is that the attached adapters are available as a NetworkAdapters array on the VM object. To create the network adapter for the VM:
When installed, VS2005 automatically creates a virtual network for each physical host network interface card (NIC) and an extra "internal" network that can be shared between VMs but is not externally connected. Virtual networks may be created or added from the Web interface in the Virtual Networks section. The host object offers an array of VirtualNetworks. Connect a VM to a network by providing a reference to the desired host network with AttachToVirtualNework method for an adapter:
Managing VM Power
VS2005 allows absolute control over a VM's power, including a saved state that releases a VM's memory and CPU resources. Suspend is useful because the VM immediately resumes work when restarted, avoiding an operating system reboot.
Basic power management uses the VM's Startup and TurnOff methods. These are not advised for most cases. TurnOff is dangerous because it does not gracefully shutdown, and Startup does not wait for the start before returning control.
To provide a graceful shutdown, the "Virtual Machine Additions" must be installed on the VM's GuestOS - Microsoft's name for the operating system running on the VM. VS2005 prompts you for the Additions in the Web interface. Once the additions are installed, you first check the CanShutdown property from the VM's GuestOS attribute:
If (vm.GuestOS.CanShutown vm.GuestOS.Shutdown();
Waiting for start or shutdown completion requires asynchronous calls to the VS2005 interface. Many VS2005 methods return a VMTask object that can be used to monitor task completion:
VMTask vt = vs.GuestOS.Shutdown();
if (vt !=null) vt.WaitForCompletion(-1);
Programming helps you unlock and automate some of the most powerful features of Microsoft Virtual Server 2005. This article covered key points to consider about using and programming Virtual Server. The complete sample application provides additional context and more features, including switching a VM's differencing disk as discussed in the example scenario. We believe that virtualization technology can radically improve the way you use server capacity and hope this article takes you a step closer to that realization.
|lawrence hordy 01/18/05 01:06:39 PM EST|
i see a 3d spreadsheet emulating a 3d array of strings == done in RPG or RPG2 == done IN CALCSTAR for a Z80 with CPM/80
Data is an unusual currency; it is not restricted by the same transactional limitations as money or people. In fact, the more that you leverage your data across multiple business use cases, the more valuable it becomes to the organization. And the same can be said about the organization’s analytics. In his session at 19th Cloud Expo, Bill Schmarzo, CTO for the Big Data Practice at EMC, will introduce a methodology for capturing, enriching and sharing data (and analytics) across the organizati...
Sep. 24, 2016 09:45 PM EDT Reads: 1,583
DevOps at Cloud Expo, taking place Nov 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 19th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long dev...
Sep. 24, 2016 09:30 PM EDT Reads: 3,316
I'm a lonely sensor. I spend all day telling the world how I'm feeling, but none of the other sensors seem to care. I want to be connected. I want to build relationships with other sensors to be more useful for my human. I want my human to understand that when my friends next door are too hot for a while, I'll soon be flaming. And when all my friends go outside without me, I may be left behind. Don't just log my data; use the relationship graph. In his session at @ThingsExpo, Ryan Boyd, Engi...
Sep. 24, 2016 09:15 PM EDT Reads: 1,186
The vision of a connected smart home is becoming reality with the application of integrated wireless technologies in devices and appliances. The use of standardized and TCP/IP networked wireless technologies in line-powered and battery operated sensors and controls has led to the adoption of radios in the 2.4GHz band, including Wi-Fi, BT/BLE and 802.15.4 applied ZigBee and Thread. This is driving the need for robust wireless coexistence for multiple radios to ensure throughput performance and th...
Sep. 24, 2016 08:30 PM EDT Reads: 1,430
The Internet of Things can drive efficiency for airlines and airports. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Sudip Majumder, senior director of development at Oracle, will discuss the technical details of the connected airline baggage and related social media solutions. These IoT applications will enhance travelers' journey experience and drive efficiency for the airlines and the airports. The session will include a working demo and a technical d...
Sep. 24, 2016 08:00 PM EDT Reads: 1,641
SYS-CON Events announced today the Enterprise IoT Bootcamp, being held November 1-2, 2016, in conjunction with 19th Cloud Expo | @ThingsExpo at the Santa Clara Convention Center in Santa Clara, CA. Combined with real-world scenarios and use cases, the Enterprise IoT Bootcamp is not just based on presentations but with hands-on demos and detailed walkthroughs. We will introduce you to a variety of real world use cases prototyped using Arduino, Raspberry Pi, BeagleBone, Spark, and Intel Edison. Y...
Sep. 24, 2016 07:00 PM EDT Reads: 2,769
Fact is, enterprises have significant legacy voice infrastructure that’s costly to replace with pure IP solutions. How can we bring this analog infrastructure into our shiny new cloud applications? There are proven methods to bind both legacy voice applications and traditional PSTN audio into cloud-based applications and services at a carrier scale. Some of the most successful implementations leverage WebRTC, WebSockets, SIP and other open source technologies. In his session at @ThingsExpo, Da...
Sep. 24, 2016 06:45 PM EDT Reads: 1,463
If you’re responsible for an application that depends on the data or functionality of various IoT endpoints – either sensors or devices – your brand reputation depends on the security, reliability, and compliance of its many integrated parts. If your application fails to deliver the expected business results, your customers and partners won't care if that failure stems from the code you developed or from a component that you integrated. What can you do to ensure that the endpoints work as expect...
Sep. 24, 2016 04:30 PM EDT Reads: 1,498
Information technology is an industry that has always experienced change, and the dramatic change sweeping across the industry today could not be truthfully described as the first time we've seen such widespread change impacting customer investments. However, the rate of the change, and the potential outcomes from today's digital transformation has the distinct potential to separate the industry into two camps: Organizations that see the change coming, embrace it, and successful leverage it; and...
Sep. 24, 2016 03:00 PM EDT Reads: 1,019
SYS-CON Events announced today that China Unicom will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. China United Network Communications Group Co. Ltd ("China Unicom") was officially established in 2009 on the basis of the merger of former China Netcom and former China Unicom. China Unicom mainly operates a full range of telecommunications services including mobile broadband (GSM, WCDMA, LTE F...
Sep. 24, 2016 01:30 PM EDT Reads: 1,671
Enterprise IT has been in the era of Hybrid Cloud for some time now. But it seems most conversations about Hybrid are focused on integrating AWS, Microsoft Azure, or Google ECM into existing on-premises systems. Where is all the Private Cloud? What do technology providers need to do to make their offerings more compelling? How should enterprise IT executives and buyers define their focus, needs, and roadmap, and communicate that clearly to the providers?
Sep. 24, 2016 01:00 PM EDT Reads: 1,478
The Transparent Cloud-computing Consortium (abbreviation: T-Cloud Consortium) will conduct research activities into changes in the computing model as a result of collaboration between "device" and "cloud" and the creation of new value and markets through organic data processing High speed and high quality networks, and dramatic improvements in computer processing capabilities, have greatly changed the nature of applications and made the storing and processing of data on the network commonplace.
Sep. 24, 2016 12:00 PM EDT Reads: 742
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Sep. 24, 2016 12:00 PM EDT Reads: 753
Digital innovation is the next big wave of business transformation based on digital technologies of which IoT and Big Data are key components, For example: Business boundary innovation is a challenge to excavate third-party business value using IoT and BigData, like Nest Business structure innovation may propose re-building business structure from scratch, as Uber does in the taxicab industry The social model innovation is also a big challenge to the new social architecture with the design fr...
Sep. 24, 2016 11:45 AM EDT Reads: 1,023
SYS-CON Events announced today that Pulzze Systems will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Pulzze Systems, Inc. provides infrastructure products for the Internet of Things to enable any connected device and system to carry out matched operations without programming. For more information, visit http://www.pulzzesystems.com.
Sep. 24, 2016 10:45 AM EDT Reads: 1,718
IoT is fundamentally transforming the auto industry, turning the vehicle into a hub for connected services, including safety, infotainment and usage-based insurance. Auto manufacturers – and businesses across all verticals – have built an entire ecosystem around the Connected Car, creating new customer touch points and revenue streams. In his session at @ThingsExpo, Macario Namie, Head of IoT Strategy at Cisco Jasper, will share real-world examples of how IoT transforms the car from a static p...
Sep. 24, 2016 10:30 AM EDT Reads: 1,470
Big Data has been changing the world. IoT fuels the further transformation recently. How are Big Data and IoT related? In his session at @BigDataExpo, Tony Shan, a renowned visionary and thought leader, will explore the interplay of Big Data and IoT. He will anatomize Big Data and IoT separately in terms of what, which, why, where, when, who, how and how much. He will then analyze the relationship between IoT and Big Data, specifically the drilldown of how the 4Vs of Big Data (Volume, Variety,...
Sep. 24, 2016 10:00 AM EDT Reads: 904
The many IoT deployments around the world are busy integrating smart devices and sensors into their enterprise IT infrastructures. Yet all of this technology – and there are an amazing number of choices – is of no use without the software to gather, communicate, and analyze the new data flows. Without software, there is no IT. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the protocols that communicate data and the emerging data analy...
Sep. 24, 2016 09:00 AM EDT Reads: 1,520
Video experiences should be unique and exciting! But that doesn’t mean you need to patch all the pieces yourself. Users demand rich and engaging experiences and new ways to connect with you. But creating robust video applications at scale can be complicated, time-consuming and expensive. In his session at @ThingsExpo, Zohar Babin, Vice President of Platform, Ecosystem and Community at Kaltura, will discuss how VPaaS enables you to move fast, creating scalable video experiences that reach your...
Sep. 24, 2016 09:00 AM EDT Reads: 758
WebRTC adoption has generated a wave of creative uses of communications and collaboration through websites, sales apps, customer care and business applications. As WebRTC has become more mainstream it has evolved to use cases beyond the original peer-to-peer case, which has led to a repeating requirement for interoperability with existing infrastructures. In his session at @ThingsExpo, Graham Holt, Executive Vice President of Daitan Group, will cover implementation examples that have enabled ea...
Sep. 24, 2016 07:00 AM EDT Reads: 1,470