Chapter 12. Managing Virtual Machine Clones and Templates

This chapter covers the following subjects:

Image Cloning and Template Options

Image Configuring Virtual Machine Options

Image Adding/Removing Virtual Machines

Image Creating a Template from an Existing Virtual Machine

Image Deploying a Virtual Machine from a Template

Image Updating Existing Virtual Machine Templates

Image Configuring CPU and Memory Reservations and Shares

If you have a VM that you like and you want another one identical to it, you can clone the VM. The catch is that a clone is an exact copy, and you might not want an exact copy. For example, it’s unlikely that you want the same NetBIOS name, IP address, or SID, especially if you are planning to continue to use the VM that you cloned. In these cases (with VMs using a Microsoft guest OS), you can use Sysprep to provide customization while you are creating the clone.

Suppose that you don’t want just one copy of a VM that you currently have running. Assume instead that you are in charge of standardizing the OS and applications that will be used for a certain type of VM. In that case, you might want to create a template that will thereafter be used by anyone who creates that type of VM. A template is a VM that cannot be powered on but that can be used as a master copy to create VMs that can be powered on. By enforcing the use of the template to create certain VMs, you will improve not only the speed at which VMs can be created but also the accuracy of their creation.

In this chapter, you learn about your options in regard to virtual machine clones and templates, and why you might choose one over the other. In addition, I discuss configuring the VMs that you have and adding more or removing those that you don’t need. Finally, I discuss the process of deploying VMs from templates, updating existing templates, and configuring resources, such as CPU and memory reservations and shares.

“Do I Know This Already?” Quiz

The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter or simply jump to the “Exam Preparation Tasks” section for review. If you are in doubt, read the entire chapter. Table 12-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A, “Answers to the ‘Do I Know This Already?’ Quizzes and Chapter Review Questions.”

Image

Table 12-1 “Do I Know This Already?” Section-to-Question Mapping

1. Which of the following are true regarding the cloning of a VM? (Choose two.)

a. You must power a VM off before cloning it.

b. You can clone a VM that is powered on.

c. You can clone a VM that is powered off.

d. Cloning a VM that is powered off will likely take much longer than cloning one that is powered on.

2. Which of the following are true regarding a VM clone? (Choose two.)

a. Without customization, a clone is an exact copy of a VM.

b. You cannot customize a VM while you clone it.

c. You can customize a VM while you clone it.

d. Customizing Microsoft VMs is not possible.

3. Which tab under Edit Settings for a VM contains the categories of VMware Tools and Power Management?

a. Virtual Hardware

b. VMware Tools

c. General Options

d. VM Options

4. Which of the following are configurable under VMware Tools? (Choose two.)

a. Power Operations

b. VMware Tools Scripts

c. Memory Management (vmmemctl)

d. Swap file location

5. If you removed a VM by selecting Delete from Disk, how can you recover the VM?

a. Restore the VM from the new datastore that was automatically created during the deletion of the VM from its original disk.

b. Restore the files from the datastore in which the VM was originally created.

c. Restore the VM from your latest backup.

d. You cannot restore the VM because to save space, deleting the disk will also delete any backups of the VM.

6. Which of the following are true regarding converting a VM to a template? (Choose two.)

a. The VM can be powered on or off.

b. The VM must be powered off.

c. The VM and the template will exist in the inventory afterward.

d. Only the template will exist in the inventory afterward.

7. Which of the following are true regarding the cloning of VM to a template? (Choose two.)

a. The VM may be powered off or powered on.

b. A VM and a template will exist in the inventory afterward.

c. The VM must be powered off.

d. Only the cloned template will exist in the inventory afterward. The VM will be deleted.

8. Which of the following are true regarding deploying a VM from a template? (Choose two.)

a. You can deploy the VM only on the host on which the template exists.

b. You can deploy a VM anywhere in the vCenter from a template on any host connected to the vCenter.

c. You must select the compute resource as you deploy the VM.

d. You can delay selecting a compute resource until you first want to start the VM.

9. Which of the following are true regarding VM templates? (Choose two.)

a. You can edit the settings of VM templates, just like VMs.

b. You cannot edit the setting of templates.

c. You cannot power on a template.

d. You can power on a template as long as the VM to which it is connected is powered on.

10. Which of the following are true regarding CPU and memory reservations for VMs? (Choose two.)

a. It is not possible to change the CPU and memory reservations and shares on individual VMs.

b. It is not recommended to change the CPU and memory reservations and shares on individual VMs.

c. Resource pools provide the best environment to control CPU and memory reservations, not VMs.

d. VMs provide the best environment to control CPU and memory resources, not resource pools.

Foundation Topics

Cloning and Template Options

Suppose that you have a VM that you want to clone. Can you clone it with it powered on, or do you have to power it off first? The answer is “yes,” you can clone it with it powered on, but you could also clone it with it powered off; it’s your choice. The trade-off is that cloning with the VM powered on might be more convenient because the users can continue to use it, but cloning with it powered off will definitely be a bit faster. To clone an existing VM, follow the steps outlined in Activity 12-1.

Image

Configuring Virtual Machine Options

Now you have another VM that is just like the one that you cloned. In this case, Prod5 is identical to Prod1. Chances are good that you don’t need both to be absolutely identical, so you might want to change the options of the VM after you have cloned it from the other one. With a little knowledge, you can make the needed changes with minimal effort.

You might have noticed that when you right-click a VM and then click Edit Settings, there are multiple tabs, each with its own set of configuration settings, as shown in Figure 12-7.

Image
Image

Figure 12-7 Edit Setting for VMs

One of these tabs is the VM Options tab, on which you can configure VM options. Also note that the version of the VM and its compatibility with regard to hosts is indicated in the bottom-left corner; in this case, we are viewing a Version 11 VM’s settings. The options for a Version 11 VM are organized into the following categories:

Image

Image General

Image VMware Remote Console

Image VMware Tools

Image Power Management

Image Boot Options

Image Advanced

Image Fibre Channel NPIV

This section briefly overviews the settings in each of the categories.

General Options

There are many settings and areas of information on the General Options page, as shown in Figure 12-8. On the first section at the top, the VM name is listed. This is the only parameter on this page that can be changed with the VM powered on. The VM name listed here is also referred to as the display name. It is the name that the VM will be represented by in your vCenter inventory. Still further down, the VM’s configuration file and working location are listed. The names of these files will start with the display name. The last setting is that of the OS on the VM. Based on this setting, the system updates the VM with the latest drivers and VMware Tools. This setting should always match the actual OS that starts when you power on your VM.

Image
Image

Figure 12-8 General Options

VMware Remote Console Options

This option controls the behavior of a remote connection or connections to the VM. Specifically, you can configure the VM to lock the guest OS when the last remote user disconnects (remember that this is a server), and you can limit the number of simultaneous connections to the VM, as shown in Figure 12-9.

Image
Image

Figure 12-9 VM Remote Console Options

VMware Tools

The VMware Tools options are organized into four categories, as shown in Figure 12-10:

Image Power Operations

Image Run VMware Tools Scripts

Image Tools Upgrades

Image Time

Image
Image

Figure 12-10 VMware Tools Options with VM Powered Off

The default setting of Power Operations provides for a graceful shutdown of the guest OS, suspend, and restart guest. These default settings should be fine for most VMs. Below that, the Run VMware Tools Scripts controls when the scripts are run. These are optional scripts installed in a VM along with VMware Tools that do things like answer the annoying Windows Server 2008 “Why are you shutting down?” question. If the tools have changed, running the scripts takes a short period of time, but the trade-off is that you have the latest options. You can decide whether you want that to happen when changing power states or before shutting down the guest OS. The VM represented in Figure 12-10 is powered off; therefore, all options are available. Changing most of these settings requires powering down the VM; otherwise, many of the settings would be grayed out (dimmed) and unavailable, as shown in Figure 12-11 with the same VM power on.

Image
Image

Figure 12-11 VMware Tools Options with VM Powered On

Power Management

The Power Management setting determines how the VM will respond when the guest OS is placed into standby mode. It is set by default to leave the VM powered on. The section “Configuring Virtual Machine Power Settings” discusses configuration options for this setting.


Note

Don’t worry, I’m not forgetting about Boot Options. I will cover those in a few sections within a section called “Configuring Virtual Machine Boot Options.”


Advanced Options

As you can see from Figure 12-12, the options such as debugging settings, swap file location, and other configuration parameters that are included under the Advanced category can usually be left at their defaults. They are configurable for the unusual “one-off” situation when you might need to make a change.

Image
Image

Figure 12-12 Advanced Options

Fibre Channel NPIV

This option enables you to examine worldwide names (WWNs) for individual VMs running on hosts that are using Fibre Channel hardware. These WWNs are normally assigned by the host of the vCenter for VMs that are enabled for NPIV. The details of this option are beyond the scope of this book.

Configuring Virtual Machine Power Settings

As mentioned previously, you can set the power management options for a VM on the VM Options tab. The default setting is that the VM will remain powered on even when the OS is placed into standby mode. For servers, this is usually the appropriate setting.

If you elect to suspend the VM, the VM will have to be resumed to be used when the guest OS comes out of standby mode. Because standby mode was originally created to save energy and reduce the amount of heat that a computer puts into a room, and because this does not apply to a VM, it might be best to let the VM’s guest OS go into standby mode but keep the VM powered on, as shown in Figure 12-13. Changing this setting requires first powering down the VM.

Image
Image

Figure 12-13 Power Management Settings

Configuring Virtual Machine Boot Options

You can configure VM boot options in four categories, as shown in Figure 12-14:

Image Firmware: Allows you to specify the boot firmware for your VM, but changing to a setting that does not match your capabilities may render the VM unbootable. You should use this setting if your host supports EFI.

Image Boot Delay: Allows you to specify a number of milliseconds between the time that POST is finished and the OS begins to load. This can give you time to press the appropriate key (such as F2) to enter setup. This might be useful, for example, to change the boot sequence to recognize a CD-ROM drive, but it will delay the start of the VM every time you power it on.

Image Force BIOS Setup: This is a run-once type of setting that will clear itself automatically after you use it.

Image Failed Boot Recovery: Used to configure the action of the VM if it should fail to find a boot device. This could be especially helpful if you are attempting to boot and install an operating system through a network, which can cause a delay in the VM’s sensing the boot device.

Image
Image

Figure 12-14 Advanced Boot Options

Configuring Virtual Machine Troubleshooting Options

Troubleshooting is a process of isolating an issue. To isolate an issue, what you need more than anything is information (in other words, logs). Normal logging of events and tasks associated with a VM is enabled by default. You can see this by logging on to your vSphere Client, choosing a VM, and examining the advanced options, as shown in Figure 12-15. You can disable logging on this setting, but that is not a recommended practice. In addition, if you are troubleshooting a VM and you want verbose debugging information or statistics, you can change this setting to force the system to record the information that you want. The information that is collected might also be useful to VMware technical support.

Image
Image

Figure 12-15 Advanced Troubleshooting Options

Adding/Removing Virtual Machines

There are many ways to add a virtual machine (VM) to your host and your vCenter inventory. In fact, we have already discussed many of them. You can add the VM by building it “from scratch,” cloning, deploying from a template, or just acquiring a virtual appliance and installing it. Regardless of how you have added the VM, you can manage it with all the same tools as you manage the others. Many of these tools are covered in the coming chapters of this book.

In contrast, there are only two ways to remove a VM from your vCenter inventory. You can remove it from the inventory but leave the files on the datastore, so you can add it back later as needed, as shown in Figure 12-16. As an alternative, you can completely delete the VM from the datastore at the same time that you remove it from your vCenter inventory, as shown in Figure 12-17. If you choose this option, the VM is said to be “permanently” deleted, but if you change your mind, you could still restore it with your latest backup. You did make a backup, didn’t you?

Image
Image

Figure 12-16 Removing a VM from Inventory

Image
Image

Figure 12-17 “Permanently” Deleting a VM

Creating a Template from an Existing Virtual Machine

As mentioned earlier, you might use a template to create a new standard that you want everyone to use in the future. In that case, the VM that you are using for the template might not even be in your production environment. In that situation, the easiest and fastest way to create a template from the VM would be to convert the VM into the template. Of course, then you wouldn’t have your VM anymore until you created a new VM from the template or converted it back. The upside of this method is that it happens almost instantaneously.

Another method of creating the template would be to clone the template from the running VM. As you can imagine, this takes longer to do; however, it allows the users to continue to use the VM while the template is being created, possibly with minor loss in performance. Either way, you end up with a template. However, cloning the template from the running VM results in your ending up with a template and still retaining the VM from which you created the template.

To create a template from an existing VM, follow the steps outlined in Activity 12-2.

Image

Deploying a Virtual Machine from a Template

Of course, the reason that you made the template is not just to have a template, but to be able to deploy VMs more quickly and accurately by using the template. After you have created the template, you can deploy VMs from it and create them anywhere in your vCenter. To deploy a VM from your template, follow the steps outlined in Activity 12-3.

Image

Updating Existing Virtual Machine Templates

Not only is a template a VM that can’t be powered on, but it’s a VM on which you can’t change settings, at least not as long as it’s a template. If you right-click a template, you will see that the options to edit its settings and to power it on are not available, as shown in Figure 12-25. This is actually good, because it makes it unlikely that someone could change your template by accident.

Image

Figure 12-25 Templates Cannot Be Powered On

However, what if you need to update the software or the virtual hardware settings on the template? In the case of virtual hardware settings, it would seem that you don’t have the option. In the case of the software, you certainly can’t update software on a VM that you can’t power on, so what is the solution to this problem?

If you look again at Figure 12-25, you will see that you can convert the template back to a VM. After you have converted the template to a VM, you can apply the updates and convert the VM back to a template to use the updates for future VMs created with the template. To convert a template into a VM, follow the steps outlined in Activity 12-4.

Image

Note

You can also use software, such as VMware Update Manager, to automate much of this process. You learn about Update Manager in Chapter 19, “Updating ESXi and Virtual Machines.”


Configuring CPU and Memory Reservations and Shares

Strictly speaking, it’s not usually a best practice to configure CPU and memory reservations for individual VMs. This is because a reservation that is configured arbitrarily too high can prevent a VM from starting up. However, if you really need to configure these on a VM, you can find them on the Virtual Hardware tab of the VM’s settings, as shown in Figure 12-29.

Image

Figure 12-29 Configuring CPU and Memory Settings for a VM

So, you might be wondering where you should configure these settings instead of on the VM itself. The best place to use CPU reservations and shares is in conjunction with resource pools for VMs. Chapter 16, “Creating and Administering Resource Pools,” covers the best practices related to CPU and memory reservations and shares.

Summary

This chapter covers the following main topics:

Image The options for configuring virtual machines, clones, and templates.

Image Adding and removing virtual machines in your inventory.

Image Creating templates, deploying VMs from templates, and updating VM templates.

Image You learned that it’s not a best practice to configure individual CPU and memory reservations on VMs and that you should use resource pools instead.

Exam Preparation Tasks

Review All the Key Topics

Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 12-2 lists these key topics and the page numbers where each is found.

Image
Image

Table 12-2 Key Topics for Chapter 12

Review Questions

The answers to these review questions are in Appendix A.

1. Which of the following are not true regarding the cloning of a VM? (Choose two.)

a. You must power a VM off before cloning it.

b. You can clone a VM that is powered on.

c. You can clone a VM that is powered off.

d. Cloning a VM that is powered off will likely take much longer than cloning one that is powered on.

2. Which of the following are not true regarding a VM clone? (Choose two.)

a. Without customization, a clone is an exact copy of a VM.

b. You cannot customize a VM while you clone it.

c. You can customize a VM while you clone it.

d. Customizing Microsoft VMs is not possible.

3. Which tab under Edit Settings for a VM contains the categories of VMware Remote Console and Fibre Channel NPIV?

a. Virtual Hardware

b. VMware Tools

c. Boot Options

d. VM Options

4. Which of the following are configurable under VMware Tools? (Choose two.)

a. Tools Upgrades

b. Time Synchronization

c. Memory Management (vmmemctl)

d. Swap file location

5. If you removed a VM by selecting Remove from Inventory, how can you recover the VM?

a. Restore the VM from the new datastore that was automatically created during the deletion of the VM from its original disk.

b. Restore the files from the datastore in which the VM was located.

c. Restore the VM from your latest backup.

d. You cannot restore the VM, because deleting the disk will also delete any backups of the VM, to save space.

6. Which of the following are not true regarding converting a VM to a template? (Choose two.)

a. The VM can be powered on or off.

b. The VM must be powered off.

c. The VM and the template will exist in the inventory afterward.

d. Only the template will exist in the inventory afterward.

7. Which of the following are not true regarding the cloning of VM to a template? (Choose two.)

a. The VM may be powered off or powered on.

b. A VM and a template will exist in the inventory afterward.

c. The VM must be powered off.

d. Only the cloned template will exist in the inventory afterward. The VM will be deleted.

8. Which of the following are not true regarding deploying a VM from a template? (Choose two.)

a. You can only deploy the VM on the host on which the template exists.

b. You can deploy a VM anywhere in the vCenter from a template on any host connected to the vCenter.

c. You must select the compute resource as you deploy the VM.

d. You can delay selecting a compute resource until you first want to start the VM.

9. Which of the following are not true regarding VM templates? (Choose two.)

a. You can edit the settings of VM templates, just like VMs.

b. You cannot edit the setting of templates.

c. You cannot power on a template.

d. You can power on a template as long as the VM that it’s connected to is powered on.

10. Which of the following are not true regarding CPU and memory reservations for VMs? (Choose two.)

a. It is not possible to change the CPU and memory reservations and shares on individual VMs.

b. It is not recommended to change the CPU and memory reservations and shares on individual VMs.

c. Resource Pools provide the best environment to control CPU and memory reservations, not VMs.

d. VMs provide the best environment to control CPU and memory resources, not resource pools.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.197.201