Hi,
I want to make some automation on my VSphere environment.
In order to to have the ability to to add RDM disk to VM with CLI (I am not familiar with CLI), I used Onyx to intercept VSpehre Client GUI operations on a CLI script.
The resulting script is showed below :
WARNING: Method 'FindAssociatedStorageProfile' is not available in the public API.
# ------- ReconfigVM_Task -------
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.changeVersion = "2013-08-23T06:07:35.293487Z"
$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 = "[datastore swap]"
$spec.deviceChange[0].device.backing.deviceName = "/vmfs/devices/disks/naa.600a0b80004746fe000099695212d83f"
$spec.deviceChange[0].device.backing.compatibilityMode = "physicalMode"
$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 = 1003
$spec.deviceChange[0].device.unitNumber = 0
$spec.deviceChange[0].device.capacityInKB = 2097152000
$_this = Get-View -Id 'VirtualMachine-vm-235'
$_this.ReconfigVM_Task($spec)
WARNING: Method 'TrackTask' is not available in the public API.
I am surprising that this script won't run on VSphere. When I run it from PowerCLI, I have the error message on VShpere client :
Reconfigure virtual machine ENF-BLADE-BACKUP Cannot complete operation due to concurrent modification by another operation.
I can't understand this error because there is no any other concurrent task .
I can't understand also the Warning messages generated by Onyx.
Is there a manner to execute script without errors.
Regards,
Mustapha.