VMware vSphere PowerCLI Reference. Graf Brian
Чтение книги онлайн.
Читать онлайн книгу VMware vSphere PowerCLI Reference - Graf Brian страница 9
Listing 1-13: Configuring DRS on a new cluster
To complete this same action on an existing cluster, you would again need to retrieve the cluster object and push the object through the pipe into the Set-Cluster cmdlet, as shown in Listing 1-14.
Listing 1-14: Configuring DRS on an existing cluster
Configuring Enhanced vMotion Compatibility
EVC allows you to add multiple hosts with different CPU architectures to your cluster. EVC will, for example, allow you to add older hosts with Intel processors to a cluster that includes hosts with newer Intel processors. It does this by setting a mask on the VMs and ensuring the instruction sets are the same for both sets of hosts. Unfortunately, at this point in time VMware does not include either a PowerCLI cmdlet or a method to enable this feature programmatically. Therefore, configuring EVC is outside the scope of this book.
Configuring Distributed Power Management
DPM provides cost savings by dynamically consolidating VMs onto fewer hosts during periods of low usage. Once the VMs are consolidated onto fewer hosts, the remaining hosts that are no longer hosting any VMs are powered off to save power. Once utilization starts to increase, the vSphere Server will power these hosts back on as needed.
While there are currently no options to enable DPM through the native cmdlets that are provided with PowerCLI, you can address the API and create your own function to enable DPM. For more information about using the SDK/API or Project Onyx, read Chapter 18, “The SDK.”
Listing 1-15 shows how you can enable DPM on a cluster.
Listing 1-15: Configuring DPM on a cluster
Licensing
Licensing is one of the first areas that will be critical to setting up a new host. Without a valid license, you can manage and use your host-to-host VMs for a maximum of 60 days.
You may be surprised to learn that there are no cmdlets to help with licensing ESX hosts or even viewing the current license details. However, the licensing information is available through the Get-View cmdlet, and you can manipulate the SDK to perform the actions necessary to both view license information and set the license key for your hosts. You can write functions to help you deal with these cmdlets and make them a little friendlier than the SDK code.
Viewing License Information
To make things easier, you can use the functions we’ll show you next to list all license keys registered on the vCenter Server and also to set a license key on a host. The Get-LicenseKey function in Listing 1-16 lists all existing license keys.
Listing 1-16: Retrieving license key information from vCenter Server
Each of the existing license keys will be returned in an output listing like this:
Licensing a Host
Once you have a list of the keys, you can use that information to license the ESX hosts attached to the vCenter Server. Listing 1-17 shows how you set the license key for a specific host. Once the license key is set, it will return the server and license key that were specified.
Listing 1-17: Adding a license key to a host
Chapter 2
Automating vSphere Hypervisor Deployment and Configuration
In this chapter, you will learn to:
• Prepare for an Installation
• Customizing the vSphere ISO
• The Installation Medium
• Gathering Required Software
• Automate an Installation
• Customizing an Installation with Kickstart
• Postinstallation Configuration
There was a time when automating an installation and configuration of the vSphere Hypervisor was quite difficult. Fortunately, VMware has worked hard to simplify the overall process. Today 90 percent of the installation is automated out of the box. In this chapter we will briefly walk through the various installation methods before taking a deep dive into automating that last 10 percent. We will cover several techniques for streamlining the installation and configuration of vSphere.
Prepare for an Installation
The first step in preparing for an installation is to ensure that your install media is up-to-date and has all of the needed drivers and other vendor packages for your servers. This includes things like storage vendor plug-ins, as well as the Fiber Channel Host Based Adapter (HBA), NIC, SCSI controller, and IPMI/CIM drivers that enable vSphere to better interact with your hardware and provide increased performance, stability, and reporting. PowerCLI has a feature known as the Image Builder CLI, which enables you to manage the packages contained in the install ISO and customize them for your needs.
Customizing the vSphere ISO
VMware ships the ESXi ISO with many default packages. You may not need all of them. Often, you need additional drivers. The install image can be customized using PowerCLI. You can tailor it specifically for your environment and include only those packages that are required for your servers.
To get started, make sure that you have downloaded the offline bundle for the version of ESXi you plan to use. Offline bundles are zip files that typically are much larger than the default ISO download. Once you have downloaded an offline bundle, download to the same directory the driver packages that you need. Like the ESXi packages, if your vendor gives you options for online or offline bundles, choose the offline bundle.
To start, you need to add the packages that have been downloaded, which are treated as depots of software packages by PowerCLI. Listing 2-1 shows how to make the Image Builder CLI aware of a downloaded update package. We also want to make sure that the PSSnapin that provides the cmdlets has been added to the environment.
Listing 2-1: Adding an offline bundle package as a software depot
TIP VMware provides a public Internet–accessible repository of all images and update packages at this address: