executing the following code works as expected if we have the diskpath created and mapped to the LUN,
we need to allow the requestor to enter the Universal address as part of the request and have the path created as part of the mapping, (provide naa,xxxxx and desired filename)
we are unable to make that work, we have tried bcking.lunUuid = <Universal address> but geta an error in vcenter of Incompatible device backing dpecified for device '0'
anyone have some ideas?
var backing = new VcVirtualDiskRawDiskMappingVer1BackingInfo() ;
backing.fileName = diskPath;
backing.diskMode = "independent_persistent";
// backing.thinProvisioned = false;
// backing.eagerlyScrub = true;
// backing.writeThrough = false;
// backing.split = false;
var connectable = new VcVirtualDeviceConnectInfo();
connectable.startConnected = true;
connectable.allowGuestControl = false;
connectable.connected = true;
var dcArr = [];
// do we need a controller?
if (scsiControllerKey < 0) {
var controller = new VcVirtualLsiLogicSASController() ;
controller.sharedBus = VcVirtualSCSISharing.fromString("physicalSharing");
controller.busNumber = scsiBusNumber;
controller.key = -100;
scsiControllerKey = -100;
var deviceChange = new VcVirtualDeviceConfigSpec();
deviceChange.operation = VcVirtualDeviceConfigSpecOperation.add;
deviceChange.device = controller;
dcArr.push(deviceChange);
}
var device = new VcVirtualDisk();
device.key = -101;
device.backing = backing;
device.connectable = connectable;
device.controllerKey = scsiControllerKey;
device.unitNumber = scsiChannelNumber;
//device.capacityInKB = size*1024*1024;
var deviceChange = new VcVirtualDeviceConfigSpec();
deviceChange.operation = VcVirtualDeviceConfigSpecOperation.add;
deviceChange.device = device;
dcArr.push(deviceChange);
var spec = new VcVirtualMachineConfigSpec();
spec.deviceChange = dcArr;
// This is used to enable multi-writer on the disk
var option = new VcOptionValue();
option.key = "scsi" + scsiBusNumber + ":" + scsiChannelNumber + ".sharing";
option.value = "multi-writer";
var extraConfig = [];
extraConfig.push(option);
spec.extraConfig = extraConfig;
task = vm.reconfigVM_Task(spec);