VMware {code} Community
Afgdd
Contributor
Contributor

Change LUN of RDM of VM using vSphere SDK for perl

I have a VM, which have a raw device mapper disk (RDM). The RDM is added by using LUN 6 of my storage device. Now, I want to change the RDM to LUN 9 (same properties as LUN 6), but it does not success. My source code as below:

my $backing = $disk->backing;

$backing->lunUuid("01000900003030303935374342313743385453315f5343");

$backing->deviceName("vml.01000900003030303935374342313743385453315f5343");

$disk->backing($backing);

$devspec = VirtualDeviceConfigSpec->new(operation => VirtualDeviceConfigSpecOperation>new('edit'), device => $disk, fileOperation=>VirtualDeviceConfigSpecFileOperation->new('replace'));

$vmspec = VirtualMachineConfigSpec->new(deviceChange => [$devspec] );

$task = $vm->ReconfigVM_Task( spec => $vmspec );

But when I run, it return error: "Invalid operation for device '0'". By the same way, I can change mapping file of RDM successfully. Do you have any idea how to change LUN for RDM?

$backing->deviceName("vml.01000900003030303935374342313743385453315f5343");
    $disk->backing($backing);
0 Kudos
0 Replies