Книга: Mastering VMware® Infrastructure3

Creating Templates and Deploying Virtual Machines 

Creating Templates and Deploying Virtual Machines 

If you've ever wished there were a faster way to provision a new server into your environment, then VMware fulfills that wish in a big way. In a VI3 environment, what would traditionally take several hours to do is now reduced to a matter of minutes. With the templates feature of VirtualCenter, you can roll out new virtual machines quickly and easily with limited administrative effort.


Figure 6.29 The Snapshot Manager can revert to original virtual machines, but all data written between now and the last backup will be lost.

VirtualCenter offers two different options for creating templates: Clone to Template and Convert to Template. As the name suggests, the Clone to Template feature copies a virtual machine to a template format, leaving the original virtual machine intact. Similarly, the Convert to Template feature involves a virtual machine that is changed to a template format, thereby removing the ability to turn on the virtual machine without converting back to a virtual machine format.

Virtual machines that become templates should not be critical servers for production environments. The idea behind a template is to have a pristine system configuration that can be customized as needed for deployment to the target environment. Any information stored on a virtual machine that becomes a template will become part of the new system that is deployed from that template. Thus, if a template is updated, all of the virtual machines previously deployed from that template do not experience the same update.

You can convert a virtual machine to a template using the right-click menu of the virtual machine or the Convert to Template link in the Commands list. Figure 6.30 shows two ways an existing virtual machine can be converted into a template format. To make updates to a template, you must first convert the template back to a virtual machine, then update it, and finally convert it back to a template.

The Clone to Template feature provides the same end result as the conversion method in creating a template that can be deployed as a new virtual machine, but it differs from the conversion method in that the virtual machine remains intact. By leaving the virtual machine in a format that can be turned on, the Clone to Template feature facilitates making updates to the template. This means you don't have to store the template object definition in the same datastore from which the virtual machine was built.

Follow these steps to clone a virtual machine into a template format:

1. Use the VI Client to connect to a VirtualCenter server or an individual ESX Server host.

2. Right-click the virtual machine to be used as a template and select the Clone to Template option.

3. Type a name for the new template in the Template Name text box, select a location in the inventory to store the template, and then click Next, as shown in Figure 6.31.

4. Select the host or cluster where the template should be hosted and click Next.

5. Select the datastore where the template should be stored and click Next.

6. Select the disk format for the template, shown in Figure 6.32, and click Next. The Normal template disk format allows for quicker conversion back into a running virtual machine. The Compact template disk format creates a more compact template, which is a benefit when portability is a key requirement.

7. Review the template configuration information and click Finish.


Figure 6.30 A virtual machine can be converted to a template.

A completed template is signified by a different icon than the one used to identify a virtual machine in the VirtualCenter inventory. The template objects are available by clicking on a datacenter object and then selecting the Virtual Machines tab, or by adjusting the inventory view to the Virtual Machines & Templates view.

Once you've created a library of templates, provisioning a new virtual machine is as simple as right-clicking on the template required as the system image baseline. For virtual machines running Windows as the guest operating system, VMware has included a component within the template processes that eliminates the need for administrators to perform tasks that force uniqueness on the virtual machine upon which the template is created. The catch is that the component must extract sysprep and its associated files to a directory on the VirtualCenter server that was created during the installation. If these files are not extracted before you deploy a virtual machine, the guest customization page of the Deploy Template Wizard will be unavailable. Figure 6.33 shows the Guest Customization page of the Deploy Template Wizard on a VirtualCenter that has not had the sysprep files extracted.


Figure 6.31 Templates should have meaningful names that describe the pristine environment provided by the template.


Figure 6.32 Templates can be stored in a format that supports quicker provisioning or that provides greater portability.

Perform these steps to allow guest operating system customization of Windows guest operating system templates:

1. Insert the Windows Server 2003 CD into the disk drive of the VirtualCenter server.

2. Navigate to the ../support/tools/deploy.cab directory on the Windows Server 2003 CD.


Figure 6.33 If the sysprep files are not extracted and stored on the VirtualCenter server, you won't be able to customize the guest operating system when you deploy from a template.

3. Copy the sysprep.exe and setupcl.exe files to this directory:

C:Documents and SettingsAll UsersApplication DataVMwareVMware Virtual Centersvr2003

As shown in Figure 6.34.


Figure 6.34 Customizing the Windows guest operating system requires the extraction of the sysprep.exe and setupcl.exe files to an existing directory on the VirtualCenter server.

Follow these steps to deploy a virtual machine from a template:

1. Use the VI Client to connect to a VirtualCenter server.

2. Locate the template object to be used as the virtual machine baseline.

3. Right-click the template object and select Deploy Virtual Machine from This Template.

4. As shown in Figure 6.35, type a name for the new virtual machine in the Virtual Machine Name text box, select a location in the inventory to store the virtual machine, and then click Next. Click the Advanced button if you want to specify an alternate storage location for virtual machine disk files.


Figure 6.35 The virtual machine's display name is the friendly name reflected in the VirtualCenter inventory and should match the guest operating system's hostname.

5. Select a host on which the virtual machine should run and then click Next.

6. Select a datastore location for the virtual machine files, as shown in Figure 6.36.


Figure 6.36 Select a datastore for a new virtual machine based on the VMotion, DRS, and HA constraints of your organization.

7. For first-time template deployments, as shown in Figure 6.37, select the Customize Using the Customization Wizard option to create a new XML-based answer file, and then click Next.


Figure 6.37 The Guest Customization Wizard allows you to create an answer file that provides zero-touch installs of a guest operating system. The answer file data is stored in the Virtual-Center database.

8. Provide a name and organization to be used for virtual machines built from the customization file.

9. For simplicity and consistency, as shown in Figure 6.37, select the Use the Virtual Machine Name option to specify that the guest operating system hostname be the same as the display name, and then click Next.

10. Enter a valid Windows product key, configure the licensing mode, and click Next.

11. Enter an administrator password and click Next.

12. Enter the appropriate time zone for the new virtual machine and click Next.

13. Enter any commands that should run one time at the end of setup and click Next.

14. Configure the Network Interface Settings for DHCP obtained addressing (Typical) or static addressing (Custom) and then click Next.

15. Specify the workgroup or domain membership of the new guest operating system and click Next.

16. For mass virtual machine deployments, ensure that the Generate New Security ID (SID) checkbox is selected. Select the Delete All User Accounts checkbox as needed to clear the local security accounts manager (SAM) of the new guest operating system to allow for a change to the administrator password. Click Next.

17. As shown in Figure 6.38, ensure the Save This Customization Specification for Later Use checkbox is selected, provide a name for the customization file, enter a description as needed, and then click Next.


Figure 6.38 Customizations can be saved for zero-touch deployments of new guest operating systems.

18. Review the customization information and then click Finish.

19. Review the template deployment information, select the Power On the New Virtual Machine After Creation option as needed, and then click Finish.

Virtual Machine Cloning

While templates might be the most common means of deploying a new virtual machine, it is possible to clone any virtual machine in a powered-off state. The right-click menu of a powered-off virtual machine provides a Clone option that allows you to make a copy without first converting to a template. The Clone to New Virtual Machine option from the Commands list on a virtual machine summary page accomplishes the same task. The wizard that initiates this will provide similar options to the wizard you use when cloning from a template. Keep in mind that unless you customize the guest operating system, an exact copy of the original virtual machine will be made. This could be especially useful when you're looking to create a test environment that mirrors a live production environment. 

Оглавление книги


Генерация: 1.180. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз