forked from ader1990/configs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-scsi-vm-fail.ps1
44 lines (31 loc) · 1.37 KB
/
create-scsi-vm-fail.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function Create-SCSI-Vhd([string]$scsiVhdPath){
$vhdBytes = (100*1024*1024*1024)
New-VHD $scsiVhdPath -SizeBytes $vhdBytes -Dynamic
}
function Create-Test-Vm([string]$vmName, [string]$rootVhdPath, [string]$netAdapterVMSwitch){
$vmMemoryBytes = (1024*1024*1024)
New-VM $vmName -MemoryStartupBytes $vmmemorybytes
Set-Vm $vmName -ProcessorCount 4
Add-VMHardDiskDrive $vmName -ControllerType IDE -Path $rootVhdPath
Connect-VMNetworkAdapter $vmName -SwitchName $netAdapterVMSwitch
Add-VMScsiController $vmName
Start-Vm $vmName
}
function Attach-SCSI-Disk([string]$vmName, [int]$address, [string]$scsiVhdPath){
Add-VMHardDiskDrive $vmName -ControllerType SCSI -ControllerLocation $address -Path $scsiVhdPath
}
$vmName = "SCSITest3"
#Centos 6.5 with LIS 3.5 drivers installed
$rootVhdPath = "C:\VM\root3.vhd"
$netAdapterVMSwitch = "external"
Create-Test-Vm $vmName $rootVhdPath $netAdapterVMSwitch
$scsiVhdPath = "C:\VM\SCSITest3.VHDX"
$address = 10
Create-SCSI-Vhd $scsiVhdPath
Attach-SCSI-Disk $vmName $address $scsiVhdPath
#if inside the linux vm we run "ls -lia /dev/s*", it will NOT show the attached scsi disk
#by attaching another scsi disk at the first address, both scsi disks will be visible inside the linx vm
#$address = 0
#$scsiVhdPath = "C:\VM\SCSITest4.VHDX"
#Create-SCSI-Vhd $scsiVhdPath
#Attach-SCSI-Disk $vmName $address $scsiVhdPath