VMware {code} Community
Dreamer732
Contributor
Contributor

adding rdm to VM : what is devicename in VirtualDiskRawDiskMappingVer1BackingInfo?

Hi,

I am trying to add a rdm to a vm in vi sdk.

I understanding that a backinginfo need to be created for virtual device. ( VirtualDiskRawDiskMappingVer1BackingInfo )

What is devicename? from the documentation in http://pubs.vmware.com/vi-sdk/visdk250/ReferenceGuide/vim.vm.device.VirtualDisk.RawDiskMappingVer1Ba...

deviceName*xsd:string

The host-specific device the LUN is being accessed through. If the target LUN is not available on the host then it is empty. For example, this could happen if it has accidentally been masked out.

So is it a mandatory property to give/fill before adding a rdm to a vm?

what are all the valid values for it.

basically i am having difficulty in adding rdm to a vm.

please look at the below links for more details.

http://communities.vmware.com/message/1994853#1994853

http://communities.vmware.com/message/1994900#1994900

any help/thoughts/references/sample code is greatly appreciated.

http://communities.vmware.com/thread/392115

Regards,

Naresh

0 Kudos
1 Reply
Dreamer732
Contributor
Contributor

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

0 Kudos