Share via


How to: Create an Environment from Virtual Machine Templates

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

You can create a virtual environment from virtual machine templates. This topic explains how to do the following procedures:

  • Name and locate a virtual environment

  • Select roles for a virtual environment

  • Assign machines to roles in a virtual environment

  • Add machine properties in a virtual environment

  • Specify capabilities and properties in a virtual environment

You can also create a virtual machine from another environment. For information about how to use other environments, see How to: Create an Environment from Another Environment.

Naming and Locating a Virtual Environment

When you create a new virtual environment, you must specify the name of the environment and a team project host group, that is, the physical host, where the environment will be deployed. You can also provide an optional description for the environment. To create a new virtual environment, you must be a member of the team project contributors group.

To name and locate the environment

  1. On the client machine, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test and Lab Manager.

  2. If you are prompted to connect to a team project, click Add. Type the URL, or just the name of the Team System 2010 Team Foundation Server, and then click Add.

    The connection string that will be used to connect to Team Foundation Server is shown in Preview.

    Note

    If you do not know the name of your Team System 2010 Team Foundation Server, contact your system administrator.

  3. To select a team project, click the arrow to view the list of team projects in the project collection. Select the name of your team project in the list, and then click Connect.

    If you successfully connect to this team project, the name of the team project is displayed in the Microsoft Test and Lab Manager window following Context.

  4. When you are prompted to set context, click Don’t set context.

  5. In the upper-left drop-down list, click Lab Center.

  6. On the Environments tab, click New.

  7. In the Name text box, type the name of the environment you are creating.

  8. In the Description text box, type a description of the environment you are creating.

  9. Under Select the type of environment, select Virtual.

  10. From the drop-down list under Select the destination, select one of the host groups, and then click Next.

    The list of available team project host groups is determined by your system administrator when a team project collection is configured for Visual Studio Team System Lab Management. If you do not see the desired team project host group in the list, contact your system administrator for further instructions.

Selecting Roles for a Virtual Environment

Each virtual machine in an environment has one or more roles associated with it. Roles are used to identify the application components that are installed on a virtual machine. For example, if you are developing a three-tier application, you can associate the role of Web server with the virtual machine that has the web-tier in it, the role of database server with the virtual machine that has the data-tier in it, and the role of Web client with the virtual machine that has the browser in it. Lab Management has five predefined roles:

  • Web server

  • Database server

  • Web client

  • Desktop client

  • Server

You can add new roles when you create a new virtual environment. However, these new roles are not visible to other users or even to you when you create another environment. The predefined roles have different icons associated with them. These icons are displayed against each virtual machine in Microsoft Test and Lab Manager and in Environment Viewer, making it easy to recognize each virtual machine.

There can be multiple virtual machines with the same role in an environment. For example, you can create an environment that uses two virtual machines serving as a Web server.

To select the roles for the environment

  1. In the Available roles pane, click a role, and then click Add.

  2. For each additional role in the environment, repeat the previous step.

  3. If you want to add a role other than one of the five predefined roles, click New role and type the name of the role.

  4. Click Next.

Assigning Machines to Roles in a Virtual Environment

Each role in the environment is fulfilled by a virtual machine that is created from a VM template. You must assign at least one VM template to each role.

To assign a VM template to each role in the environment

  1. In the Roles and machines pane, click a role.

  2. In the list of available VM templates, click a template, and then click Add.

  3. Repeat steps 1 and 2 for each role in the environment, and then click Next.

    You can assign the same VM template to more than one role.

Adding or Removing Machine Properties in a Virtual Environment

You can associate custom name-value properties with an environment and with each virtual machine in an environment. The following are examples of data that you could associate with each environment:

  • Names of the people currently using the environment.

  • Reservation information.

  • Expiration dates.

  • Information about the tests that have been run or bugs that have been found.

  • Information about the builds that are installed.

The following are examples of data that you could associate with each virtual machine:

  • Installed applications.

  • Version number of the agents installed.

  • Information about the tests run or bugs found.

You can also use custom properties to write applications that simplify management of environments or to integrate Lab Management with other tools. For example, you could write a virtual machine proliferation control tool that would remove environments that are past their expiration date. Or, you can search for an environment in the library that has the desired build deployed on it. 

As part of creating an environment from virtual machine templates, you can customize the hardware and the operating system of the virtual machines. The original virtual machine templates in the team project library share might have been configured with a certain set of parameters. However, you can override these parameters when you create a new environment.

To add machine properties to the environment

  1. In the Roles and machines pane, click a machine.

  2. In the list of properties, click Add property.

  3. Type a name and value for the property.

  4. Repeat steps 1through 3 for each appropriate machine in the environment

  5. If you want to change the hardware profile or OS profile for the environment, click Advanced.

    1. On the Hardware profile tab, in the Virtual machine memory text box, type the amount of memory to be allocated to the new environment.

    2. On the OS profile tab, click the setting, and then type the custom information. For more information about how to customize the profile for the environment, see "Hardware and OS Profiles" later in this topic.

  6. When you are finished customizing the hardware and OS profiles, click Save settings.

Specifying Capabilities and Properties in a Virtual Environment

If the system administrator has set up a build controller and a test agent controller, you can enable the environment to deploy and test applications. If you want to create and run multiple copies of the environment concurrently, you can enable the network isolation capability.

To specify the capabilities and properties of the environment

  1. Under Environment capabilities, select the appropriate capability.

    1. If you want use the environment to run tests, select Testing. If you prefer to use a specific test agent controller to run those tests, select the test agent controller from the drop-down list. If you do not have a preference, the system will automatically select a controller.

    2. If you want use the environment to run deploy builds of an application, select Run workflow. If you prefer to use a specific build controller to deploy the build, select the build controller from the drop-down list. If you do not have a preference, the system will automatically select a controller.

    3. If you want to create and run multiple copies of the same virtual machines without networking conflicts, Network isolation.

  2. If you want to add environment-level properties to be used later, for example, to use a build number, click Add property and type the name and a value for the property.

  3. After you have added all the environment properties, click Next.

  4. On the Summary page, review the settings for the new environment. If the settings are correct, click Finish. If the settings are incorrect, click Previous to return to the page that has to be changed.

Hardware and OS Profiles

Every virtual machine template has a hardware profile associated with it. Currently, the hardware profile consists of only one parameter. That parameter is Memory. For example, assume that a team project library share has a Windows Server 2003 virtual machine template. The project administrator configured a memory of 512MB in this template. When a new environment is created by using this virtual machine template, the corresponding copy of virtual machine will be allocated a memory of 512MB on the host. But, before you create the environment, you can override the value and specify a value of 1GB. The original virtual machine template retains the value of 512MB.

Another useful form of customization is supported for virtual machines that are running Windows operating systems. Windows has a capability called ‘sysprep’, that allows a user to remove the identity information off Windows and easily use that to image multiple systems. The process of removing the identity and preparing a golden Windows image is called generalization. The process of using the golden image to create a specific instance with an identity is called customization. Tools such as System Center Virtual Machine Manager let administrators generalize Windows virtual machines. They also let administrators associate a set of parameters called OS profile, which can be used during customization of that virtual machine.

When a generalized virtual machine template that is stored in a team project library share is used to create an environment, the user will be able to review the OS profile parameters and to override them. The following OS profile parameters are supported by Lab Management:

  • Name of the computer

  • User and organization

  • Product key

  • Administrator account and password

  • Whether the computer has to be joined to a domain or be part of a workgroup. For joining to a domain, credentials of a user who has rights to join the computer to domain.

  • Post customization commands/scripts

Consider a team project library share that contains a Windows Server 2003 generalized virtual machine template. The team project administrator can set the OS profile of the virtual machine template with all the previous details. Each user creating an environment from that virtual machine template can override any of these values.

If the OS profile parameters are not specified in the original virtual machine template or during environment creation, then Windows prompts the user to enter this information when the virtual machine is created and started. Certain parameters such as product key must be specified in OS profile. If these properties are not specified, you cannot create the environment.

Sensitive information such as product key, administrator credentials, and domain credentials can only be set in the OS profile and cannot be read back. For complete details about OS profile parameters, refer to the VMM documentation.

In this release of Lab Management, you cannot create or edit virtual machines with complex hardware profile needs by using Microsoft Test and Lab Manager. For example, you cannot edit the hardware profile of a virtual machine and specify that you need multiple hard disks, multiple NICs, a different type of CPU, and so on. For all these, you must contact your administrator and have these properties changed on the virtual machine templates using VMM.

Creation Process

As soon as you start to create an active environment, Lab Management takes the following steps:

  • Identify the hosts on which newly created virtual machines can be deployed.

  • Create copies of virtual machines from virtual machine templates.

  • Configure the networking of virtual machines in the Environment.

  • Perform OS customization if the source virtual machine templates are generalized.

  • Configure each selected environment capabilities.

Placement is specifying a host for deploying an active environment. When you create an active environment, the only target location that you can only specify is a project host group. Lab Management automatically specifies the most appropriate host from the host group. Automating this task removes the burden from you and also optimizes the use of the physical hosts.

The actual placement is based on how the administrator configured the placement policy. The person who creates environments cannot tell on which hosts those environments were created. For more information about placement policies, see How to: Configure or Reconfigure Host Groups for Team Project Collections.

At the end of creation, the active environment will be in a Stopped state. You have to start the environment if you want to start the operating systems in virtual machines and to work on them.

The series of steps for creating a stored environment is shorter and involves just creating the copies of virtual machines. At the end of creation, the environment will be in a Stored state.

Failures in any of the previous steps can cause the environment creation to fail. For example, if there are no hosts that satisfy the constraints of the virtual machines, or if there is a network failure during the copying of virtual machine from library to host, the creation process fails. When the creation fails, the environment goes into a Create Failed state. From this state, you can retry the operation. Upon retrying, the creation process is resumed from where it was left off.

The actual time taken to create a new environment depends on the number and size of virtual machines inside that environment in addition to on your lab’s network topology. It also depends on the load of various servers including lab service, library servers, and hosts.

You can expect to take about 5 minutes to create an environment with two virtual machines of around 4GB hard disk size each, under the following assumptions:

  • The library server and host are different.

  • Both library server and host have Windows Server 2008 R2.

  • The library server and host are connected to a gigabit switch.

  • There is no other creation operation going on in parallel that involves the same library server and/or host.

If any of the previous assumptions are not true, the creation operation can take longer, for example, up to 20 minutes if multiple (around 3) environment creations are happening in parallel that involve the same library server and/or host. In slower networks and with a large number of creations in parallel, the time to create a single environment can go up to a few hours.

While you create the environment, you can see a progress bar for each virtual machine, as well as for the whole environment.

you can cancel a creation or a copy in progress, or recover from failures, by retrying the operation. When you do so, the creation of the environment is suspended and any partial environment that has been created thus far is removed.

See Also

Concepts

How to: Create an Environment from Another Environment

Working with Environments