Hi,
I am using the below configuration spec to attach a RDM (raw disk - pass-throuh)
However attaching is failing:(
It says Invalid configuration for device '0'.
Any help is greatly appreciated as i am struck:(?
VirtualDisk virtualDisk = new VirtualDisk();
//disk info
virtualDisk.controllerKey = controllerKey;
virtualDisk.controllerKeySpecified = true;
virtualDisk.unitNumber = location;
virtualDisk.unitNumberSpecified = true;
//backing file info
VirtualDiskRawDiskMappingVer1BackingInfo backing = new VirtualDiskRawDiskMappingVer1BackingInfo();
backing.lunUuid = uuid;
backing.compatibilityMode = "physicalMode";
backing.diskMode ="persistent";
backing.deviceName = "vml.0200030000600601607f412e003c84c498fc52e111565241494420"; //TODO
backing.datastore = datastoremor
backing.fileName = "[DS_193]"; //do i have to specify the file? is it the mapping vmdk file?
//isnt the framework automaitcally create mapping file?
virtualDisk.backing = backing;
//config spec
VirtualDeviceConfigSpec vdConfigSpecEdit = new VirtualDeviceConfigSpec();
vdConfigSpecEdit.device = virtualDisk;
vdConfigSpecEdit.operation =VirtualDeviceConfigSpecOperation.add;
vdConfigSpecEdit.operationSpecified = true;
vdConfigSpecEdit.fileOperation =VirtualDeviceConfigSpecFileOperation.create;
vdConfigSpecEdit.fileOperationSpecified =false;
VirtualMachineConfigSpec vmConfigSpecEdit = new VirtualMachineConfigSpec();
vmConfigSpecEdit.deviceChange = new VirtualDeviceConfigSpec[1];
vmConfigSpecEdit.deviceChange[0] = vdConfigSpecEdit;
Regards,
Dreamer
I tried this. Basically i didnt specify the filename and datastore.
VirtualDiskRawDiskMappingVer1BackingInfo backing = new VirtualDiskRawDiskMappingVer1BackingInfo();
backing.lunUuid = taskSpec.ScsiLun.Uuid;
backing.compatibilityMode =
"physicalMode"; //TODO
backing.diskMode =
"persistent"; //TODO
backing.deviceName =
"vml.0200030000600601607f412e003c84c498fc52e111565241494420"; //TODO
Debug.Assert(this.m_vmIdDatastoreMap.ContainsKey(taskSpec.VmGuid)
&&
this.m_vmIdDatastoreMap[taskSpec.VmGuid].Length > 0);
//backing.datastore = this.m_vmIdDatastoreMap[taskSpec.VmGuid][0];
//backing.fileName = "[DS_193]";
virtualDisk.backing = backing;
And its giving the following error:(
Looks like i should give a file. BUT SHOULD I CREATE A FILE OR JUST GIVE A FILENAME TO BE CREATED?
ANY DOCUMENTATION?
TaskStatus: Faulted
Required property fileName is missing from data object of type VirtualDiskRawDiskMappingVer1BackingInfo
while parsing serialized DataObject of type vim.vm.device.VirtualDisk.RawDiskMappingVer1BackingInfo
at line 1, column 380
while parsing property "backing" of static type VirtualDeviceBackingInfo
while parsing serialized DataObject of type vim.vm.device.VirtualDisk
at line 1, column 337
while parsing property "device" of static type VirtualDevice
while parsing serialized DataObject of type vim.vm.device.VirtualDeviceSpec
at line 1, column 297
while parsing property "deviceChange" of static type ArrayOfVirtualDeviceConfigSpec
while parsing serialized DataObject of type vim.vm.ConfigSpec
at line 1, column 291
while parsing call information for method ReconfigVM_Task
at line 1, column 218
while parsing SOAP body
at line 1, column 207
while parsing SOAP envelope
at line 1, column 38
while parsing HTTP request for method reconfigure
on object of type vim.VirtualMachine
at line 1, column 0
PS C:\>
Regards,
Naresh
Now, i tried this by giving the datastore but leaving the filename empty as assuming the framework will generate one for me.
VirtualDiskRawDiskMappingVer1BackingInfo backing = new VirtualDiskRawDiskMappingVer1BackingInfo();
backing.lunUuid = taskSpec.ScsiLun.Uuid;
backing.compatibilityMode ="physicalMode"; //TODO
backing.diskMode ="persistent"; //TODO
backing.deviceName ="vml.0200030000600601607f412e003c84c498fc52e111565241494420"; //TODO
backing.datastore = mor;
backing.fileName ="";
virtualDisk.backing = backing;
Now, i am getting the following error:
Invalid datastore format ''.
Regards,
Naresh
Now, i gave the connectable info, but still getting the same error.
VirtualDiskRawDiskMappingVer1BackingInfo backing = new VirtualDiskRawDiskMappingVer1BackingInfo();
backing.lunUuid = taskSpec.ScsiLun.Uuid;
backing.compatibilityMode ="physicalMode"; //TODO
backing.diskMode ="persistent"; //TODO
backing.deviceName ="vml.0200030000600601607f412e003c84c498fc52e111565241494420"; //TODO
backing.datastore = mor;
backing.fileName ="";
VirtualDeviceConnectInfo connectable = new VirtualDeviceConnectInfo();
connectable.startConnected =true;
connectable.allowGuestControl =false;
connectable.connected =true;
virtualDisk.connectable = connectable;
virtualDisk.backing = backing;
Invalid datastore format ''.
Regards,
Dreamer
Take a look at this script which allows you to add/remote and RDM to a VM (it's written using vSphere SDK for Perl) but you can disect it to convert it to .NET - http://communities.vmware.com/docs/DOC-10974
Hi,
Finally i was able to add rdm after lots of trail and errors...
1. I am giving wrong device name. I was giving "vml" + lunuuid as the managed object browser showed that. Now assigning the device name from the ScsiLun.
2. I need to set the fileOperationSpecified to true even though i specified the file operation to create.
3. Filename can be set to "" to let the framework give a name for the mapping file.
the config spec i used:
VirtualDisk rdmDisk = new VirtualDisk();
//disk info
rdmDisk.controllerKey = key;
rdmDisk.controllerKeySpecified = true;
rdmDisk.unitNumber = location;
rdmDisk.unitNumberSpecified = true;
//backing rawdevice info
VirtualDiskRawDiskMappingVer1BackingInfo backing = new VirtualDiskRawDiskMappingVer1BackingInfo();
backing.lunUuid = taskSpec.ScsiLun.Uuid;
backing.compatibilityMode = "physicalMode"; //TODO
backing.diskMode = "independent_persistent"; //TODO
backing.deviceName = taskSpec.ScsiLun.DeviceName;
backing.datastore = mor;
//Framework will automatically assigns filename
backing.fileName = "";
rdmDisk.backing = backing;
//config spec
VirtualDeviceConfigSpec vdConfigSpecEdit = new VirtualDeviceConfigSpec();
vdConfigSpecEdit.device = rdmDisk;
vdConfigSpecEdit.operation = VirtualDeviceConfigSpecOperation.add;
vdConfigSpecEdit.operationSpecified = true;
vdConfigSpecEdit.fileOperation = VirtualDeviceConfigSpecFileOperation.create;
vdConfigSpecEdit.fileOperationSpecified = true;
VirtualMachineConfigSpec vmConfigSpecEdit = new VirtualMachineConfigSpec();
vmConfigSpecEdit.deviceChange = new VirtualDeviceConfigSpec[1];
vmConfigSpecEdit.deviceChange[0] = vdConfigSpecEdit;
Regards,
Dreamer
I am using 5.0 sdk and the code is working for adding rdm disks to VMs of ESX hosts (5.0).
But the same code is failing for vms on ESX 4.1
I am getting the same error again: Invalid configuration for device '0'
Any help is greatly appreciated as i have no clue how to fix it...
Regards,
Naresh
Now I tried using 4.1 sdk and still getting the same error.
Not sure whats happening. Same code works for vms on 5.0 esx host with 5.0 sdk (vim25 definitions) and not for vms on 4.1 esx host (both 5.0 and 4.1 sdks)
And the error doesnt give any info.
It simply says invalid configuration for device '0'.
i have no clue what does that mean.
its frustrating...
-Naresh
HI All
I am getting same error while add rdm to vm.
Same eror : Invalid Operation for device '0'
I didn't set the controller key,unitnumber and key in virtualdevice object.
Where i find those info in mob.