Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

I get the error-"incompatible device backing specified for device '0'" when i try to add a raw lun via powershell

$
0
0

Hi,

Here is my script where i am trying to add a raw lun to a VM via powershell script. I get the error - "incompatible device backing specified for device '0'". I dont see this error when i do it using vsphere client. Any idea why i get this error?

 

# ------- ReconfigVM_Task -------
Connect-VIServer -Server losas147 -User itops -Password itops

 

$vmMo = Get-View (Get-VM losaz093).ID
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.changeVersion = $vmMo.Config.ChangeVersion

 

$spec.deviceChange = New-Object VMware.Vim.VirtualDeviceConfigSpec[] (1)
$spec.deviceChange[0] = New-Object VMware.Vim.VirtualDeviceConfigSpec
$spec.deviceChange[0].operation = "add"
$spec.deviceChange[0].fileOperation = "create"
$spec.deviceChange[0].device = New-Object VMware.Vim.VirtualDisk
$spec.deviceChange[0].device.key = -100
$spec.deviceChange[0].device.backing = New-Object VMware.Vim.VirtualDiskRawDiskMappingVer1BackingInfo
$spec.deviceChange[0].device.backing.fileName = ""
$spec.deviceChange[0].device.backing.deviceName = "/vmfs/devices/disks/naa.6006016034c12c0012f008fdb959e111"
$spec.deviceChange[0].device.backing.diskMode = ""
$spec.deviceChange[0].device.connectable = New-Object VMware.Vim.VirtualDeviceConnectInfo
$spec.deviceChange[0].device.connectable.startConnected = $true
$spec.deviceChange[0].device.connectable.allowGuestControl = $false
$spec.deviceChange[0].device.connectable.connected = $true
$spec.deviceChange[0].device.controllerKey = 1000
$spec.deviceChange[0].device.unitNumber = 7
$spec.deviceChange[0].device.capacityInKB = 1048576
$VmMo.ReconfigVM_Task($spec)


Viewing all articles
Browse latest Browse all 207710

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>