A számítógép rétege (parancsfájl) bővítő

 

Hatókör: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager

Miután telepített egy szolgáltatást a VMM, ki lehet terjeszteni a szolgáltatás által a virtuális gépek felvétele egy számítógépréteghez. Megadhatja, hogy a számítógépréteg kiterjeszthető beállításával a InstanceMaximumCount paraméter a számítógépréteg-sablon.

Jogi nyilatkozatot

A következő parancsfájl ellenőrzi, hogy meg tudja kiterjeszteni egy réteget biztosítva, hogy a virtuális gépek hozzáadása nem haladhatja meg a réteg maximális számítógépszámnál. A parancsfájl majd méretezi a szolgáltatást, adja hozzá a virtuális gép egy számítógépréteghez.

  
# Description:      This script scales out a service by adding a virtual machine  
#                   to a computer tier.  
  
# Get the service and the computer tier.  
$Service = Get-SCService -Name "Service01"  
$Tier = Get-SCComputerTier -Service $Service | where {$_.Name -eq "Web Tier"}  
  
# Ensure that you are able to scale out the tier.  
If ($Tier.VMs.count -eq $Tier.InstanceMaximumCount) {throw "You have reached the instance maximum for this tier."}  
  
# Create a virtual machine configuration for the computer tier.  
$VMConfig = New-SCVMConfiguration -ComputerTier $Tier -Name "NewServiceVM01" -Description "New virtual machine configuration for tier"  
  
# Get the best host on which to deploy the virtual machine.  
$VMHosts = Get-SCVMHost  
$HostRatings = @(Get-SCVMHostRating -VMHost $VMHosts -VMConfiguration $VMConfig | where {$_.Rating -gt 0} | sort -Property Rating -Descending)  
If ($HostRating.Count -eq 0) {throw "No hosts meet the placement requirements."}  
$VMHost = $HostRatings[0].vmhost  
  
# Set the host on the virtual machine configuration.  
Set-SCVMConfiguration -VMConfiguration $VMConfig -VMHost $VMHost  
Update-SCVMConfiguration -VMConfiguration $VMConfig  
  
# Create a virtual machine for the service.  
$VM = New-SCVirtualMachine -Name "NewServiceVM01" -VMConfigurationScaleOut $VMConfig  
  

Lásd még:

Skála egy Számítógépréteghez (parancsfájl)