0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PCIデバイスを仮想マシンに割り当てる

Posted at

パススルーを有効にするスクリプト

あとでWhere条件式をかえてNVMeだけにする予定。

ひとまず最初にConnect-VIServer

$esxName = 'MyEsx'

$esx = Get-VMHost -Name $esxName
$ptMgr = Get-View -Id $esx.ExtensionData.ConfigManager.PciPassthruSystem
$config = @()
$ptMgr.PciPassthruInfo | where{$_.PassthruCapable -and -not $_.PassthruEnabled} | %{
    $ptConfig = New-Object VMware.Vim.HostPciPassthruConfig
    $ptConfig.Id = $_.Id
    $ptConfig.PassthruEnabled = $true
    $config += $ptConfig
}
if($config){
    $ptMgr.UpdatePassthruConfig($config)
}
else{
    Write-Host "No Passthru capable devices found"
}

ホストを再起動して、

テンプレートから仮想マシンをデプロイして、デバイスを追加

テンプレートからデプロイ
$NewVM = New-VM -Name 'VMNAME' -VMHost 'HOSTNAME' -OSCustomizationSpec 'OSTEMPLATE' -Template 'TEMPLATENAME' -Datastore 'DATASTORE'

$ESX = get-vmhost -name esxi01.aaa.local

$ScsiDevice = Get-PassthroughDevice -VMHost $ESX -Id "Uid"
Add-PassthroughDevice -VM $NewVM -PassthroughDevice $ScsiDevice

参考文献

https://thinkit.co.jp/story/2011/02/24/2008
https://qiita.com/nori4k/items/3028d4ba349bf53b63d5
https://communities.vmware.com/thread/566477

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?